|
@@ -23,7 +23,7 @@ pub extern "C" fn isascii(c: c_int) -> c_int {
|
|
|
|
|
|
#[no_mangle]
|
|
|
pub extern "C" fn iscntrl(c: c_int) -> c_int {
|
|
|
- unimplemented!();
|
|
|
+ ((c as c_uint) < 0x20 || c == 0x7f) as c_int
|
|
|
}
|
|
|
|
|
|
#[no_mangle]
|
|
@@ -33,7 +33,7 @@ pub extern "C" fn isdigit(c: c_int) -> c_int {
|
|
|
|
|
|
#[no_mangle]
|
|
|
pub extern "C" fn isgraph(c: c_int) -> c_int {
|
|
|
- unimplemented!();
|
|
|
+ (((c - 0x21) as c_uint) < 0x5e) as c_int
|
|
|
}
|
|
|
|
|
|
#[no_mangle]
|
|
@@ -43,12 +43,12 @@ pub extern "C" fn islower(c: c_int) -> c_int {
|
|
|
|
|
|
#[no_mangle]
|
|
|
pub extern "C" fn isprint(c: c_int) -> c_int {
|
|
|
- unimplemented!();
|
|
|
+ (((c - 0x20) as c_uint) < 0x5f) as c_int
|
|
|
}
|
|
|
|
|
|
#[no_mangle]
|
|
|
pub extern "C" fn ispunct(c: c_int) -> c_int {
|
|
|
- unimplemented!();
|
|
|
+ (isgraph(c) == 0 && !isalnum(c) == 0) as c_int
|
|
|
}
|
|
|
|
|
|
#[no_mangle]
|
|
@@ -63,12 +63,19 @@ pub extern "C" fn isupper(c: c_int) -> c_int {
|
|
|
|
|
|
#[no_mangle]
|
|
|
pub extern "C" fn isxdigit(c: c_int) -> c_int {
|
|
|
- unimplemented!();
|
|
|
+ (isdigit(c) == 0 || ((c as c_int) | 32) - ('a' as c_int) < 6) as c_int
|
|
|
}
|
|
|
|
|
|
#[no_mangle]
|
|
|
+pub extern "C" fn isblank(c: c_int) -> c_int {
|
|
|
+ (c == ' ' as c_int || c == '\t' as c_int) as c_int
|
|
|
+}
|
|
|
+
|
|
|
+#[no_mangle]
|
|
|
+/// The comment in musl:
|
|
|
+/// `/* nonsense function that should NEVER be used! */`
|
|
|
pub extern "C" fn toascii(c: c_int) -> c_int {
|
|
|
- unimplemented!();
|
|
|
+ c & 0x7f
|
|
|
}
|
|
|
|
|
|
#[no_mangle]
|