diff options
| author | Kacper <kacper@mail.openlinux.dev> | 2025-12-07 22:22:16 +0100 |
|---|---|---|
| committer | Kacper <kacper@mail.openlinux.dev> | 2025-12-07 22:22:16 +0100 |
| commit | 8f9e448b2ef6db7cd905540c21f3c5b190e7a1e7 (patch) | |
| tree | ae0285dd15042d1e9236a5ce2e60daf65acbdca0 /lib/libc/strings | |
| parent | fc00c656c96528112d05cf0edf8631bd5eaea446 (diff) | |
Add bin/true and bin/false implementations
- Added assembly implementations for `true` and `false` commands.
- Updated Kbuild files to include new binaries.
- Removed unused libraries and headers.
- Cleaned up makefile and unused code.
Diffstat (limited to 'lib/libc/strings')
| -rw-r--r-- | lib/libc/strings/Kbuild | 5 | ||||
| -rw-r--r-- | lib/libc/strings/ffs.c | 4 | ||||
| -rw-r--r-- | lib/libc/strings/ffsl.c | 12 | ||||
| -rw-r--r-- | lib/libc/strings/strcasecmp.c | 3 | ||||
| -rw-r--r-- | lib/libc/strings/strncasecmp.c | 4 |
5 files changed, 20 insertions, 8 deletions
diff --git a/lib/libc/strings/Kbuild b/lib/libc/strings/Kbuild new file mode 100644 index 00000000..0f22da20 --- /dev/null +++ b/lib/libc/strings/Kbuild @@ -0,0 +1,5 @@ +obj-y += ffs.o +obj-y += ffsl.o +obj-y += ffsll.o +obj-y += strcasecmp.o +obj-y += strncasecmp.o diff --git a/lib/libc/strings/ffs.c b/lib/libc/strings/ffs.c index 3b836021..2c49cf4d 100644 --- a/lib/libc/strings/ffs.c +++ b/lib/libc/strings/ffs.c @@ -1,7 +1,8 @@ int ffs(int i) { - if (i == 0) + if (i == 0) { return 0; + } int pos = 1; unsigned int u = (unsigned int)i; @@ -10,5 +11,6 @@ int ffs(int i) u >>= 1; pos++; } + return pos; } diff --git a/lib/libc/strings/ffsl.c b/lib/libc/strings/ffsl.c index 2f2e7d44..c84a2905 100644 --- a/lib/libc/strings/ffsl.c +++ b/lib/libc/strings/ffsl.c @@ -1,14 +1,18 @@ int ffsl(long i) { - if (i == 0) - return 0; + int pos; + unsigned long u; - int pos = 1; - unsigned long u = (unsigned long)i; + if (i == 0) { + return 0; + } + pos = 1; + u = (unsigned long)i; while ((u & 1UL) == 0UL) { u >>= 1; pos++; } + return pos; } diff --git a/lib/libc/strings/strcasecmp.c b/lib/libc/strings/strcasecmp.c index 90ccc59b..e96f059a 100644 --- a/lib/libc/strings/strcasecmp.c +++ b/lib/libc/strings/strcasecmp.c @@ -18,7 +18,8 @@ int strcasecmp(const char *s1, const char *s2) (unsigned char)tolower((unsigned char)*s2); } -weak int strcasecmp_l(const char *s1, const char *s2, locale_t unused locale) +__weak int strcasecmp_l(const char *s1, const char *s2, + locale_t __unused locale) { return strcasecmp(s1, s2); } diff --git a/lib/libc/strings/strncasecmp.c b/lib/libc/strings/strncasecmp.c index 679cf245..f2f4c22c 100644 --- a/lib/libc/strings/strncasecmp.c +++ b/lib/libc/strings/strncasecmp.c @@ -25,8 +25,8 @@ int strncasecmp(const char *s1, const char *s2, size_t n) (unsigned char)tolower((unsigned char)*s2); } -weak int strncasecmp_l(const char *s1, const char *s2, size_t n, - locale_t unused locale) +__weak int strncasecmp_l(const char *s1, const char *s2, size_t n, + locale_t __unused locale) { return strncasecmp(s1, s2, n); } |
