diff --git a/Cargo.lock b/Cargo.lock index d695d178dc..224eaaa31c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -23,20 +23,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cbindgen" -version = "0.5.1" +version = "0.5.2" dependencies = [ "clap 2.31.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", - "standalone-syn 0.12.10 (registry+https://github.com/rust-lang/crates.io-index)", + "standalone-syn 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "tempdir 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cc" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -74,7 +75,7 @@ dependencies = [ name = "ctype" version = "0.1.0" dependencies = [ - "cbindgen 0.5.1", + "cbindgen 0.5.2", "platform 0.1.0", ] @@ -87,7 +88,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "errno" version = "0.1.0" dependencies = [ - "cbindgen 0.5.1", + "cbindgen 0.5.2", "platform 0.1.0", ] @@ -95,7 +96,7 @@ dependencies = [ name = "fcntl" version = "0.1.0" dependencies = [ - "cbindgen 0.5.1", + "cbindgen 0.5.2", "platform 0.1.0", ] @@ -103,7 +104,7 @@ dependencies = [ name = "fenv" version = "0.1.0" dependencies = [ - "cbindgen 0.5.1", + "cbindgen 0.5.2", "platform 0.1.0", ] @@ -111,7 +112,7 @@ dependencies = [ name = "float" version = "0.1.0" dependencies = [ - "cbindgen 0.5.1", + "cbindgen 0.5.2", "fenv 0.1.0", "platform 0.1.0", ] @@ -134,7 +135,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "grp" version = "0.1.0" dependencies = [ - "cbindgen 0.5.1", + "cbindgen 0.5.2", "platform 0.1.0", ] @@ -177,7 +178,7 @@ dependencies = [ name = "mman" version = "0.1.0" dependencies = [ - "cbindgen 0.5.1", + "cbindgen 0.5.2", "platform 0.1.0", ] @@ -186,34 +187,6 @@ name = "num-traits" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "owning_ref" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "stable_deref_trait 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "parking_lot" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot_core 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "parking_lot_core" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "platform" version = "0.1.0" @@ -232,11 +205,8 @@ dependencies = [ [[package]] name = "quote" -version = "0.4.2" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "ralloc" @@ -292,6 +262,7 @@ dependencies = [ "platform 0.1.0", "resource 0.1.0", "semaphore 0.1.0", + "signal 0.1.0", "stat 0.1.0", "stdio 0.1.0", "stdlib 0.1.0", @@ -316,87 +287,11 @@ dependencies = [ name = "resource" version = "0.1.0" dependencies = [ - "cbindgen 0.5.1", + "cbindgen 0.5.2", "platform 0.1.0", "sys_time 0.1.0", ] -[[package]] -name = "rustc-ap-proc_macro" -version = "40.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rustc-ap-rustc_errors 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-syntax 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-syntax_pos 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc-ap-rustc_cratesio_shim" -version = "40.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc-ap-rustc_data_structures" -version = "40.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot_core 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-serialize 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "stable_deref_trait 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc-ap-rustc_errors" -version = "40.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rustc-ap-rustc_data_structures 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-serialize 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-syntax_pos 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc-ap-serialize" -version = "40.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rustc-ap-syntax" -version = "40.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_cratesio_shim 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_data_structures 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_errors 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-serialize 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-syntax_pos 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc-ap-syntax_pos" -version = "40.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rustc-ap-rustc_data_structures 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-serialize 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "sc" version = "0.2.2" @@ -406,36 +301,35 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "semaphore" version = "0.1.0" dependencies = [ - "cbindgen 0.5.1", + "cbindgen 0.5.2", "platform 0.1.0", ] [[package]] name = "serde" -version = "1.0.29" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde_derive 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive" -version = "1.0.29" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive_internals 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.12.14 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive_internals 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive_internals" -version = "0.20.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.12.14 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", + "synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -446,45 +340,32 @@ dependencies = [ "dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "smallvec" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "stable_deref_trait" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "standalone-proc-macro2" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" +name = "signal" +version = "0.1.0" dependencies = [ - "rustc-ap-proc_macro 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cbindgen 0.5.2", + "platform 0.1.0", ] [[package]] name = "standalone-quote" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rustc-ap-proc_macro 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "standalone-proc-macro2 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "standalone-syn" -version = "0.12.10" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rustc-ap-proc_macro 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "standalone-proc-macro2 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "standalone-quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "standalone-quote 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -492,7 +373,7 @@ dependencies = [ name = "stat" version = "0.1.0" dependencies = [ - "cbindgen 0.5.1", + "cbindgen 0.5.2", "platform 0.1.0", ] @@ -500,7 +381,7 @@ dependencies = [ name = "stdio" version = "0.1.0" dependencies = [ - "cbindgen 0.5.1", + "cbindgen 0.5.2", "errno 0.1.0", "platform 0.1.0", "va_list 0.1.0", @@ -510,7 +391,7 @@ dependencies = [ name = "stdlib" version = "0.1.0" dependencies = [ - "cbindgen 0.5.1", + "cbindgen 0.5.2", "ctype 0.1.0", "errno 0.1.0", "platform 0.1.0", @@ -521,7 +402,7 @@ dependencies = [ name = "string" version = "0.1.0" dependencies = [ - "cbindgen 0.5.1", + "cbindgen 0.5.2", "compiler_builtins 0.1.0 (git+https://github.com/rust-lang-nursery/compiler-builtins.git)", "errno 0.1.0", "platform 0.1.0", @@ -535,19 +416,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "syn" -version = "0.12.14" +version = "0.11.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "synom" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sys_time" version = "0.1.0" dependencies = [ - "cbindgen 0.5.1", + "cbindgen 0.5.2", "platform 0.1.0", ] @@ -560,15 +449,6 @@ dependencies = [ "remove_dir_all 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "term" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "termion" version = "1.5.1" @@ -591,7 +471,7 @@ dependencies = [ name = "time" version = "0.1.0" dependencies = [ - "cbindgen 0.5.1", + "cbindgen 0.5.2", "platform 0.1.0", ] @@ -600,7 +480,7 @@ name = "toml" version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -613,6 +493,11 @@ name = "unicode-width" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "unicode-xid" +version = "0.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "unicode-xid" version = "0.1.0" @@ -622,7 +507,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "unistd" version = "0.1.0" dependencies = [ - "cbindgen 0.5.1", + "cbindgen 0.5.2", "platform 0.1.0", ] @@ -637,7 +522,7 @@ dependencies = [ name = "va_list-helper" version = "0.0.2" dependencies = [ - "cc 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -649,7 +534,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "wait" version = "0.1.0" dependencies = [ - "cbindgen 0.5.1", + "cbindgen 0.5.2", "platform 0.1.0", "resource 0.1.0", ] @@ -658,7 +543,7 @@ dependencies = [ name = "wctype" version = "0.1.0" dependencies = [ - "cbindgen 0.5.1", + "cbindgen 0.5.2", "platform 0.1.0", ] @@ -695,7 +580,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" "checksum atty 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "af80143d6f7608d746df1520709e5d141c96f240b0e62b0aa41bdfb53374d9d4" "checksum bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b3c30d3802dfb7281680d6285f2ccdaa8c2d8fee41f93805dba5c4cf50dc23cf" -"checksum cc 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fedf677519ac9e865c4ff43ef8f930773b37ed6e6ea61b6b83b400a7b5787f49" +"checksum cc 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "87f38f122db5615319a985757e526c00161d924d19b71a0f3e80c52bab1adcf6" "checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de" "checksum clap 2.31.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5dc18f6f4005132120d9711636b32c46a233fad94df6217fa1d81c5e97a9f200" "checksum compiler_builtins 0.1.0 (git+https://github.com/rust-lang-nursery/compiler-builtins.git)" = "" @@ -708,41 +593,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" "checksum log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "89f010e843f2b1a31dbd316b3b8d443758bc634bed37aabade59c686d644e0a2" "checksum num-traits 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3c2bd9b9d21e48e956b763c9f37134dc62d9e95da6edb3f672cacb6caf3cd3" -"checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" -"checksum parking_lot 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "9fd9d732f2de194336fb02fe11f9eed13d9e76f13f4315b4d88a14ca411750cd" -"checksum parking_lot_core 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "538ef00b7317875071d5e00f603f24d16f0b474c1a5fc0ccb8b454ca72eafa79" "checksum proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cd07deb3c6d1d9ff827999c7f9b04cdfd66b1b17ae508e14fe47b620f2282ae0" -"checksum quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1eca14c727ad12702eb4b6bfb5a232287dcf8385cb8ca83a3eeaf6519c44c408" +"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" "checksum rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "eba5f8cb59cc50ed56be8880a5c7b496bfd9bd26394e176bc67884094145c2c5" "checksum redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "0d92eecebad22b767915e4d529f89f28ee96dbbf5a4810d2b844373f136417fd" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" "checksum remove_dir_all 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b5d2f806b0fcdabd98acd380dc8daef485e22bcb7cddc811d1337967f2528cf5" -"checksum rustc-ap-proc_macro 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d96f017dd18a6925618e1caf4a375ba2a5a175471172e18cc4855ac0587231ff" -"checksum rustc-ap-rustc_cratesio_shim 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6773cafaa546d932d62eb22fe854772f4d1b973245b36727c893a9fea3dbc4c6" -"checksum rustc-ap-rustc_data_structures 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a64e8c55c343448d6a0904e2066710be2734284d904b52b8fd064ca201ca854b" -"checksum rustc-ap-rustc_errors 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ad6d84133da5f6b51c544b981c6b405e79db0a4fca41e34d77849846ed3b9121" -"checksum rustc-ap-serialize 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "43d227b1b3de1ec6d3fb48e10799d08c073c57e45f536766e1d897d46b737e0b" -"checksum rustc-ap-syntax 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b6e525fc674e8a75eaed08a90a6df7adfa73a66135056577722185dd7ca0771" -"checksum rustc-ap-syntax_pos 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e157f53ad5c4a6cf9ae5b5be15325dd2eeca190c03ab9873cc1460788767e5e9" "checksum sc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4ebbb026ba4a707c25caec2db5ef59ad8b41f7ad77cad06257e06229c891f376" -"checksum serde 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)" = "4763b773978e495252615e814d2ad04773b2c1f85421c7913869a537f35cb406" -"checksum serde_derive 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)" = "8ab31f00ae5574bb643c196d5e302961c122da1c768604c6d16a35c5d551948a" -"checksum serde_derive_internals 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1fc848d073be32cd982380c06587ea1d433bc1a4c4a111de07ec2286a3ddade8" +"checksum serde 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)" = "c73f63e08b33f6e59dfb3365b009897ebc3a3edc4af6e4f3ce8e483cf3d80ce7" +"checksum serde_derive 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)" = "652bc323d694dc925829725ec6c890156d8e70ae5202919869cb00fe2eff3788" +"checksum serde_derive_internals 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)" = "32f1926285523b2db55df263d2aa4eb69ddcfa7a7eade6430323637866b513ab" "checksum serde_json 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "fab6c4d75bedcf880711c85e39ebf8ccc70d0eba259899047ec5d7436643ee17" -"checksum smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44db0ecb22921ef790d17ae13a3f6d15784183ff5f2a01aa32098c7498d2b4b9" -"checksum stable_deref_trait 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "15132e0e364248108c5e2c02e3ab539be8d6f5d52a01ca9bbf27ed657316f02b" -"checksum standalone-proc-macro2 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "04b0e28c7fb04d85743490bd2a24bd0ec0ff6efc74e7c848748fd9fd2b105410" -"checksum standalone-quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "45bd227b8113ff91db4f6eadcc73928dc602af00a851f4fe65f3c1cb1a96b5e1" -"checksum standalone-syn 0.12.10 (registry+https://github.com/rust-lang/crates.io-index)" = "d800cb9b3b2e08877667aace544bb0882ea3d5cf3ae83c2730a9032becf1f6bd" +"checksum standalone-quote 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dcedac1d6d98e7e9d1d6e628f5635af9566688ae5f6cea70a3976f495ae8d839" +"checksum standalone-syn 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "115808f5187c07c23cb93eee49d542fae54c6e8285d3a24c6ff683fcde9243db" "checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" -"checksum syn 0.12.14 (registry+https://github.com/rust-lang/crates.io-index)" = "8c5bc2d6ff27891209efa5f63e9de78648d7801f085e4653701a692ce938d6fd" +"checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" +"checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" "checksum tempdir 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f73eebdb68c14bcb24aef74ea96079830e7fa7b31a6106e42ea7ee887c1e134e" -"checksum term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1" "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" "checksum textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c0b59b6b4b44d867f1370ef1bd91bfb262bf07bf0ae65c202ea2fbc16153b693" "checksum toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a7540f4ffc193e0d3c94121edb19b055670d369f77d5804db11ae053a45b6e7e" "checksum unborrow 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e92e959f029e4f8ee25d70d15ab58d2b46f98a17bc238b9265ff0c26f6f3d67f" "checksum unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f" +"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum vec_map 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "887b5b631c2ad01628bbbaa7dd4c869f80d3186688f8d0b6f58774fbe324988c" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" diff --git a/Cargo.toml b/Cargo.toml index 85785975e8..ffd5eea4ec 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,6 +22,7 @@ mman = { path = "src/mman" } platform = { path = "src/platform" } resource = { path = "src/resource" } semaphore = { path = "src/semaphore" } +signal = { path = "src/signal" } stat = { path = "src/stat" } stdio = { path = "src/stdio" } stdlib = { path = "src/stdlib" } diff --git a/cbindgen b/cbindgen index fe26d47afd..95821b3bbe 160000 --- a/cbindgen +++ b/cbindgen @@ -1 +1 @@ -Subproject commit fe26d47afd3e959a8cd73f81f430b061d28c4c3b +Subproject commit 95821b3bbe857354e3fb1efa96ed5252ecc3ec3e diff --git a/include/bits/timespec.h b/include/bits/timespec.h index 52d696fc31..5f36eaa8cc 100644 --- a/include/bits/timespec.h +++ b/include/bits/timespec.h @@ -1,4 +1,9 @@ +#ifndef _BITS_TIMESPEC_H +#define _BITS_TIMESPEC_H + typedef struct { time_t tv_sec; long tv_nsec; } timespec; + +#endif diff --git a/src/fcntl/cbindgen.toml b/src/fcntl/cbindgen.toml index e9893c078d..d49feaa87a 100644 --- a/src/fcntl/cbindgen.toml +++ b/src/fcntl/cbindgen.toml @@ -3,5 +3,9 @@ include_guard = "_FCNTL_H" trailer = "#include " language = "C" +[defines] +"target_os=linux" = "__linux__" +"target_os=redox" = "__redox__" + [enum] prefix_with_name = true diff --git a/src/fenv/src/lib.rs b/src/fenv/src/lib.rs index b97e7e3b5e..49ad7d29cf 100644 --- a/src/fenv/src/lib.rs +++ b/src/fenv/src/lib.rs @@ -17,46 +17,57 @@ pub struct fenv_t { pub cw: u64, } +#[no_mangle] pub unsafe extern "C" fn feclearexcept(excepts: c_int) -> c_int { unimplemented!(); } +#[no_mangle] pub unsafe extern "C" fn fegenenv(envp: *mut fenv_t) -> c_int { unimplemented!(); } +#[no_mangle] pub unsafe extern "C" fn fegetexceptflag(flagp: *mut fexcept_t, excepts: c_int) -> c_int { unimplemented!(); } +#[no_mangle] pub unsafe extern "C" fn fegetround() -> c_int { FE_TONEAREST } +#[no_mangle] pub unsafe extern "C" fn feholdexcept(envp: *mut fenv_t) -> c_int { unimplemented!(); } +#[no_mangle] pub unsafe extern "C" fn feraiseexcept(except: c_int) -> c_int { unimplemented!(); } +#[no_mangle] pub unsafe extern "C" fn fesetenv(envp: *const fenv_t) -> c_int { unimplemented!(); } +#[no_mangle] pub unsafe extern "C" fn fesetexceptflag(flagp: *const fexcept_t, excepts: c_int) -> c_int { unimplemented!(); } +#[no_mangle] pub unsafe extern "C" fn fesetround(round: c_int) -> c_int { unimplemented!(); } +#[no_mangle] pub unsafe extern "C" fn fetestexcept(excepts: c_int) -> c_int { unimplemented!(); } +#[no_mangle] pub unsafe extern "C" fn feupdateenv(envp: *const fenv_t) -> c_int { unimplemented!(); } diff --git a/src/float/src/lib.rs b/src/float/src/lib.rs index e594fdba78..723e0d6fb4 100644 --- a/src/float/src/lib.rs +++ b/src/float/src/lib.rs @@ -11,6 +11,7 @@ use fenv::{fegetround, FE_TONEAREST}; pub const FLT_RADIX: c_int = 2; +#[no_mangle] pub unsafe extern "C" fn flt_rounds() -> c_int { match fegetround() { FE_TONEAREST => 1, diff --git a/src/signal/Cargo.toml b/src/signal/Cargo.toml new file mode 100644 index 0000000000..b1847d0801 --- /dev/null +++ b/src/signal/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "signal" +version = "0.1.0" +authors = ["Dan Robertson "] +build = "build.rs" + +[build-dependencies] +cbindgen = { path = "../../cbindgen" } + +[dependencies] +platform = { path = "../platform" } diff --git a/src/signal/build.rs b/src/signal/build.rs new file mode 100644 index 0000000000..011ccd1588 --- /dev/null +++ b/src/signal/build.rs @@ -0,0 +1,11 @@ +extern crate cbindgen; + +use std::{env, fs}; + +fn main() { + let crate_dir = env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set"); + fs::create_dir_all("../../target/include").expect("failed to create include directory"); + cbindgen::generate(crate_dir) + .expect("failed to generate bindings") + .write_to_file("../../target/include/signal.h"); +} diff --git a/src/signal/cbindgen.toml b/src/signal/cbindgen.toml new file mode 100644 index 0000000000..c69f579e82 --- /dev/null +++ b/src/signal/cbindgen.toml @@ -0,0 +1,11 @@ +sys_includes = ["sys/types.h"] +include_guard = "_SIGNAL_H" +style = "Tag" +language = "C" + +[defines] +"target_os=linux" = "__linux__" +"target_os=redox" = "__redox__" + +[enum] +prefix_with_name = true diff --git a/src/signal/src/lib.rs b/src/signal/src/lib.rs new file mode 100644 index 0000000000..052cb13770 --- /dev/null +++ b/src/signal/src/lib.rs @@ -0,0 +1,126 @@ +//! signal implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/signal.h.html + +#![no_std] + +extern crate platform; + +#[cfg(target_os = "linux")] +#[path = "linux.rs"] +pub mod sys; + +#[cfg(target_os = "redox")] +#[path = "redox.rs"] +pub mod sys; + +pub use sys::*; + +use platform::types::*; + +#[repr(C)] +pub struct sigaction { + pub sa_handler: extern "C" fn(usize), + pub sa_mask: sigset_t, + pub sa_flags: usize, +} + +pub type sigset_t = sys_sigset_t; + +#[no_mangle] +pub extern "C" fn kill(pid: pid_t, sig: c_int) -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn killpg(pgrp: pid_t, sig: c_int) -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn raise(sig: c_int) -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn sigaction(sig: c_int, act: *const sigaction, oact: *const sigaction) -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn sigaddset(set: *mut sigset_t, signo: c_int) -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn sigdelset(set: *mut sigset_t, signo: c_int) -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn sigemptyset(set: *mut sigset_t) -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn sigfillset(set: *mut sigset_t) -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn sighold(sig: c_int) -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn sigignore(sig: c_int) -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn siginterrupt(sig: c_int, flag: c_int) -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn sigismember(set: *const sigset_t, signo: c_int) -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn signal(sig: c_int, func: fn(c_int)) -> fn(c_int) { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn sigpause(sig: c_int) -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn sigpending(set: *mut sigset_t) -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn sigprocmask(how: c_int, set: *const sigset_t, oset: *mut sigset_t) -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn sigrelse(sig: c_int) -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn sigset(sig: c_int, func: fn(c_int)) -> fn(c_int) { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn sigsuspend(sigmask: *const sigset_t) -> c_int { + unimplemented!(); +} + +#[no_mangle] +pub extern "C" fn sigwait(set: *const sigset_t, sig: *mut c_int) -> c_int { + unimplemented!(); +} diff --git a/src/signal/src/linux.rs b/src/signal/src/linux.rs new file mode 100644 index 0000000000..628e813390 --- /dev/null +++ b/src/signal/src/linux.rs @@ -0,0 +1,48 @@ +#[repr(C)] +pub struct sys_sigset_t { + pub bits: [u64; 16], +} + +pub const SIGHUP: usize = 1; +pub const SIGINT: usize = 2; +pub const SIGQUIT: usize = 3; +pub const SIGILL: usize = 4; +pub const SIGTRAP: usize = 5; +pub const SIGABRT: usize = 6; +pub const SIGIOT: usize = SIGABRT; +pub const SIGBUS: usize = 7; +pub const SIGFPE: usize = 8; +pub const SIGKILL: usize = 9; +pub const SIGUSR1: usize = 10; +pub const SIGSEGV: usize = 11; +pub const SIGUSR2: usize = 12; +pub const SIGPIPE: usize = 13; +pub const SIGALRM: usize = 14; +pub const SIGTERM: usize = 15; +pub const SIGSTKFLT: usize = 16; +pub const SIGCHLD: usize = 17; +pub const SIGCONT: usize = 18; +pub const SIGSTOP: usize = 19; +pub const SIGTSTP: usize = 20; +pub const SIGTTIN: usize = 21; +pub const SIGTTOU: usize = 22; +pub const SIGURG: usize = 23; +pub const SIGXCPU: usize = 24; +pub const SIGXFSZ: usize = 25; +pub const SIGVTALRM: usize = 26; +pub const SIGPROF: usize = 27; +pub const SIGWINCH: usize = 28; +pub const SIGIO: usize = 29; +pub const SIGPOLL: usize = 29; +pub const SIGPWR: usize = 30; +pub const SIGSYS: usize = 31; +pub const SIGUNUSED: usize = SIGSYS; + +pub const SA_NOCLDSTOP: usize = 1; +pub const SA_NOCLDWAIT: usize = 2; +pub const SA_SIGINFO: usize = 4; +pub const SA_ONSTACK: usize = 0x08000000; +pub const SA_RESTART: usize = 0x10000000; +pub const SA_NODEFER: usize = 0x40000000; +pub const SA_RESETHAND: usize = 0x80000000; +pub const SA_RESTORER: usize = 0x04000000; diff --git a/src/signal/src/redox.rs b/src/signal/src/redox.rs new file mode 100644 index 0000000000..b5108b5a62 --- /dev/null +++ b/src/signal/src/redox.rs @@ -0,0 +1,44 @@ +#[repr(C)] +pub struct sys_sigset_t { + pub bits: [u64; 2], +} + +pub const SIGHUP: usize = 1; +pub const SIGINT: usize = 2; +pub const SIGQUIT: usize = 3; +pub const SIGILL: usize = 4; +pub const SIGTRAP: usize = 5; +pub const SIGBUS: usize = 7; +pub const SIGFPE: usize = 8; +pub const SIGKILL: usize = 9; +pub const SIGUSR1: usize = 10; +pub const SIGSEGV: usize = 11; +pub const SIGUSR2: usize = 12; +pub const SIGPIPE: usize = 13; +pub const SIGALRM: usize = 14; +pub const SIGTERM: usize = 15; +pub const SIGSTKFLT: usize = 16; +pub const SIGCHLD: usize = 17; +pub const SIGCONT: usize = 18; +pub const SIGSTOP: usize = 19; +pub const SIGTSTP: usize = 20; +pub const SIGTTIN: usize = 21; +pub const SIGTTOU: usize = 22; +pub const SIGURG: usize = 23; +pub const SIGXCPU: usize = 24; +pub const SIGXFSZ: usize = 25; +pub const SIGVTALRM: usize = 26; +pub const SIGPROF: usize = 27; +pub const SIGWINCH: usize = 28; +pub const SIGIO: usize = 29; +pub const SIGPWR: usize = 30; +pub const SIGSYS: usize = 31; + +pub const SA_NOCLDSTOP: usize = 0x00000001; +pub const SA_NOCLDWAIT: usize = 0x00000002; +pub const SA_SIGINFO: usize = 0x00000004; +pub const SA_RESTORER: usize = 0x04000000; +pub const SA_ONSTACK: usize = 0x08000000; +pub const SA_RESTART: usize = 0x10000000; +pub const SA_NODEFER: usize = 0x40000000; +pub const SA_RESETHAND: usize = 0x80000000; diff --git a/src/string/src/lib.rs b/src/string/src/lib.rs index ca56dff001..3fd95d0014 100644 --- a/src/string/src/lib.rs +++ b/src/string/src/lib.rs @@ -125,7 +125,7 @@ pub unsafe extern "C" fn strcspn(s1: *const c_char, s2: *const c_char) -> c_ulon // The below logic is effectively ripped from the musl implementation - let mut byteset = [0u8; 32 / mem::size_of::()]; + let mut byteset = [0usize; 32 / mem::size_of::()]; let mut i = 0; while *s2.offset(i) != 0 { @@ -135,9 +135,9 @@ pub unsafe extern "C" fn strcspn(s1: *const c_char, s2: *const c_char) -> c_ulon } i = 0; // reset - while *s2.offset(i) != 0 { - if byteset[(*s2.offset(i) as usize) / (8 * byteset.len())] - & 1 << (*s2.offset(i) as usize % (8 * byteset.len())) > 0 + while *s1.offset(i) != 0 { + if byteset[(*s1.offset(i) as usize) / (8 * byteset.len())] + & 1 << (*s1.offset(i) as usize % (8 * byteset.len())) > 0 { break; } @@ -250,8 +250,13 @@ pub unsafe extern "C" fn strncpy(s1: *mut c_char, s2: *const c_char, n: usize) - } #[no_mangle] -pub extern "C" fn strpbrk(s1: *const c_char, s2: *const c_char) -> *mut c_char { - unimplemented!(); +pub unsafe extern "C" fn strpbrk(s1: *const c_char, s2: *const c_char) -> *mut c_char { + let p = s1.offset(strcspn(s1, s2) as isize); + if *p != 0 { + p as *mut c_char + } else { + ptr::null_mut() + } } #[no_mangle] @@ -277,7 +282,7 @@ pub unsafe extern "C" fn strspn(s1: *const c_char, s2: *const c_char) -> c_ulong // The below logic is effectively ripped from the musl implementation - let mut byteset = [0u8; 32 / mem::size_of::()]; + let mut byteset = [0usize; 32 / mem::size_of::()]; let mut i = 0; while *s2.offset(i) != 0 { @@ -287,9 +292,9 @@ pub unsafe extern "C" fn strspn(s1: *const c_char, s2: *const c_char) -> c_ulong } i = 0; // reset - while *s2.offset(i) != 0 { - if byteset[(*s2.offset(i) as usize) / (8 * byteset.len())] - & 1 << (*s2.offset(i) as usize % (8 * byteset.len())) < 1 + while *s1.offset(i) != 0 { + if byteset[(*s1.offset(i) as usize) / (8 * byteset.len())] + & 1 << (*s1.offset(i) as usize % (8 * byteset.len())) < 1 { break; } @@ -299,8 +304,22 @@ pub unsafe extern "C" fn strspn(s1: *const c_char, s2: *const c_char) -> c_ulong } #[no_mangle] -pub extern "C" fn strstr(s1: *const c_char, s2: *const c_char) -> *mut c_char { - unimplemented!(); +pub unsafe extern "C" fn strstr(s1: *const c_char, s2: *const c_char) -> *mut c_char { + let mut i = 0; + while *s1.offset(i) != 0 { + let mut j = 0; + while *s2.offset(j) != 0 && *s1.offset(j + i) != 0 { + if *s2.offset(j) != *s1.offset(j + i) { + break; + } + j += 1; + if *s2.offset(j) == 0 { + return s1.offset(i) as *mut c_char; + } + } + i += 1; + } + ptr::null_mut() } #[no_mangle] diff --git a/src/wait/cbindgen.toml b/src/wait/cbindgen.toml index 186d5f9573..528282cf3a 100644 --- a/src/wait/cbindgen.toml +++ b/src/wait/cbindgen.toml @@ -1,5 +1,6 @@ sys_includes = ["sys/types.h", "sys/resource.h"] include_guard = "_SYS_WAIT_H" +style = "Tag" language = "C" [enum] diff --git a/tests/Makefile b/tests/Makefile index e0bbb3fffb..c2aad5593a 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -27,6 +27,8 @@ EXPECT_BINS=\ string/strchr \ string/strrchr \ string/strspn \ + string/strstr \ + string/strpbrk \ unlink \ waitpid \ write diff --git a/tests/expected/string/strpbrk.stderr b/tests/expected/string/strpbrk.stderr new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/expected/string/strpbrk.stdout b/tests/expected/string/strpbrk.stdout new file mode 100644 index 0000000000..7a6bc8b089 --- /dev/null +++ b/tests/expected/string/strpbrk.stdout @@ -0,0 +1,3 @@ +The quick drawn fix jumps over the lazy bug +lazy bug +NULL diff --git a/tests/expected/string/strstr.stderr b/tests/expected/string/strstr.stderr new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/expected/string/strstr.stdout b/tests/expected/string/strstr.stdout new file mode 100644 index 0000000000..e978edff7f --- /dev/null +++ b/tests/expected/string/strstr.stdout @@ -0,0 +1,3 @@ +rust +libc we trust +NULL diff --git a/tests/string/strcspn.c b/tests/string/strcspn.c index fa433d7e4f..859d880435 100644 --- a/tests/string/strcspn.c +++ b/tests/string/strcspn.c @@ -2,8 +2,9 @@ #include int main(int argc, char* argv[]) { - printf("%ld\n", strcspn("hello", "world")); // should be 2 - printf("%ld\n", strcspn("banana", "world")); // should be 6 + char *world = "world"; + printf("%ld\n", strcspn("hello", world)); // should be 2 + printf("%ld\n", strcspn("banana", world)); // should be 6 return 0; } diff --git a/tests/string/strpbrk.c b/tests/string/strpbrk.c new file mode 100644 index 0000000000..dc0ebf7c53 --- /dev/null +++ b/tests/string/strpbrk.c @@ -0,0 +1,20 @@ +#include +#include + +int main(int argc, char* argv[]) { + char* source = "The quick drawn fix jumps over the lazy bug"; + + // should be "The quick drawn fix jumps over the lazy bug" + char* res1 = strpbrk(source, "From The Very Beginning"); + printf("%s\n", (res1) ? res1 : "NULL"); + + // should be "lazy bug" + char* res2 = strpbrk(source, "lzbg"); + printf("%s\n", (res2) ? res2 : "NULL"); + + // should be "NULL" + char* res3 = strpbrk(source, "404"); + printf("%s\n", (res3) ? res3 : "NULL"); + + return 0; +} diff --git a/tests/string/strspn.c b/tests/string/strspn.c index 9e4fc70c5b..52431a70ff 100644 --- a/tests/string/strspn.c +++ b/tests/string/strspn.c @@ -2,9 +2,12 @@ #include int main(int argc, char* argv[]) { - printf("%lu\n", strspn("hello", "hello")); // should be 5 - printf("%lu\n", strspn("world", "wendy")); // should be 1 - printf("%lu\n", strspn("banana", "apple")); // should be 0 + char *hello = "hello"; + char *world = "world"; + char *banana = "banana"; + printf("%lu\n", strspn(hello, "hello")); // should be 5 + printf("%lu\n", strspn(world, "wendy")); // should be 1 + printf("%lu\n", strspn(banana, "apple")); // should be 0 return 0; } diff --git a/tests/string/strstr.c b/tests/string/strstr.c new file mode 100644 index 0000000000..6a074d18d8 --- /dev/null +++ b/tests/string/strstr.c @@ -0,0 +1,18 @@ +#include +#include + +int main(int argc, char* argv[]) { + // should be "rust" + char* res1 = strstr("In relibc we trust", "rust"); + printf("%s\n", (res1) ? res1 : "NULL"); + + // should be "libc we trust" + char* res2 = strstr("In relibc we trust", "libc"); + printf("%s\n", (res2) ? res2 : "NULL"); + + // should be "NULL" + char* res3 = strstr("In relibc we trust", "bugs"); + printf("%s\n", (res3) ? res3 : "NULL"); + + return 0; +}