diff --git a/modules/src/string/ack_string.h b/modules/src/string/ack_string.h index c43b19b56..56b646e4c 100644 --- a/modules/src/string/ack_string.h +++ b/modules/src/string/ack_string.h @@ -7,25 +7,16 @@ #ifndef __ACK_STRING_INCLUDED__ #define __ACK_STRING_INCLUDED__ -#include - -_PROTOTYPE(char *strcpy, (char *s1, const char *s2)); -_PROTOTYPE(char *strncpy, (char *s1, const char *s2, size_t n)); -_PROTOTYPE(char *strcat, (char *s1, const char *s2)); -_PROTOTYPE(char *strncat, (char *s1, const char *s2, size_t n)); -_PROTOTYPE(int strcmp, (const char *s1, const char *s2)); -_PROTOTYPE(int strncmp, (const char *s1, const char *s2, size_t n)); -_PROTOTYPE(_SIZET strlen, (const char *s)); -_PROTOTYPE(char *strindex, (char *s, int c)); -_PROTOTYPE(char *strrindex, (char *s, int c)); -_PROTOTYPE(char *strzero, (char *s)); -_PROTOTYPE(char *str2bts, (char *s, char *b, int *n)); -_PROTOTYPE(char *long2str, (long l, int b)); -_PROTOTYPE(long str2long, (char *s, int b)); -_PROTOTYPE(char *btscpy, (char *s1, char *s2, int n)); -_PROTOTYPE(char *btscat, (char *s1, int n1, char *s2, int n2)); -_PROTOTYPE(int btscmp, (char *s1, int n1, char *s2, int n2)); -_PROTOTYPE(char *btszero, (char *b, int n)); -_PROTOTYPE(char *bts2str, (char *b, int n, char *s)); +char *strindex(char *s, int c); +char *strrindex(char *s, int c); +char *strzero(char *s); +char *str2bts(char *s, char *b, int *n); +char *long2str(long l, int b); +long str2long(char *s, int b); +char *btscpy(char *s1, char *s2, int n); +char *btscat(char *s1, int n1, char *s2, int n2); +int btscmp(char *s1, int n1, char *s2, int n2); +char *btszero(char *b, int n); +char *bts2str(char *b, int n, char *s); #endif /* __ACK_STRING_INCLUDED__ */ diff --git a/modules/src/string/build.lua b/modules/src/string/build.lua index b2aa4b9c3..647a32146 100644 --- a/modules/src/string/build.lua +++ b/modules/src/string/build.lua @@ -1,10 +1,13 @@ clibrary { name = "lib", - srcs = { "./*.c" }, + srcs = { + "./bts2str.c", "./btscat.c", "./btscmp.c", + "./btscpy.c", "./btszero.c", "./long2str.c", + "./str2bts.c", "./str2long.c", "./strindex.c", + "./strrindex.c", "./strzero.c", + }, deps = { + "./ack_string.h", "modules+headers", - "./*.h" }, } - - diff --git a/modules/src/string/strcat.c b/modules/src/string/strcat.c deleted file mode 100644 index a1d3085b8..000000000 --- a/modules/src/string/strcat.c +++ /dev/null @@ -1,24 +0,0 @@ -/* $Id$ */ -/* - * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. - * See the copyright notice in the ACK home directory, in the file "Copyright". - */ -/* append t to s -*/ - -#include "ack_string.h" - -char * -strcat(s, t) - register char *s; - register _CONST char *t; -{ - register char *b = s; - - while (*s++) - ; - s--; - while (*s++ = *t++) - ; - return b; -} diff --git a/modules/src/string/strcmp.c b/modules/src/string/strcmp.c deleted file mode 100644 index f6ba8bfa7..000000000 --- a/modules/src/string/strcmp.c +++ /dev/null @@ -1,20 +0,0 @@ -/* $Id$ */ -/* - * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. - * See the copyright notice in the ACK home directory, in the file "Copyright". - */ -/* return negative, zero or positive value if - resp. s < t, s == t or s > t -*/ - -#include "ack_string.h" - -int -strcmp(s, t) - register _CONST char *s, *t; -{ - while (*s == *t++) - if (*s++ == '\0') - return 0; - return *s - *--t; -} diff --git a/modules/src/string/strcpy.c b/modules/src/string/strcpy.c deleted file mode 100644 index 220cf9687..000000000 --- a/modules/src/string/strcpy.c +++ /dev/null @@ -1,21 +0,0 @@ -/* $Id$ */ -/* - * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. - * See the copyright notice in the ACK home directory, in the file "Copyright". - */ -/* Copy t into s -*/ - -#include "ack_string.h" - -char * -strcpy(s, t) - register char *s; - register _CONST char *t; -{ - register char *b = s; - - while (*s++ = *t++) - ; - return b; -} diff --git a/modules/src/string/string.3 b/modules/src/string/string.3 index 22bfd71a9..8d1877a22 100644 --- a/modules/src/string/string.3 +++ b/modules/src/string/string.3 @@ -1,8 +1,7 @@ .TH STRING 3 "$Revision$" .ad .SH NAME -strcpy, strncpy, strcat, strncat, strcmp, strncmp, -strlen, strindex, strrindex, strzero, str2bts, +strindex, strrindex, strzero, str2bts, long2str, str2long, btscpy, btscat, btscmp, btszero, bts2str \- operations on and conversions between strings and row of bytes @@ -10,27 +9,6 @@ conversions between strings and row of bytes .nf .B #include .PP -.B char *strcpy(s1, s2) -.B char *s1, *s2; -.PP -.B char *strncpy(s1, s2, n) -.B char *s1, *s2; -.PP -.B char *strcat(s1, s2) -.B char *s1, *s2; -.PP -.B char *strncat(s1, s2, n) -.B char *s1, *s2; -.PP -.B int strcmp(s1, s2) -.B char *s1, *s2; -.PP -.B int strncmp(s1, s2, n) -.B char *s1, *s2; -.PP -.B int strlen(s) -.B char *s; -.PP .B char *strindex(s, c) .B char *s, c; .PP @@ -82,56 +60,6 @@ functions operate on variable-length rows of bytes, regardless of null bytes. Neither of these functions check for overflow of any receiving area. .PP -.I Strcpy -copies string -.I s2 -to -.I s1, -stopping after the null character has been moved. -.I Strncpy -copies exactly -.I n -characters, -truncating or null-padding -.I s2; -the target may not be null-terminated if the length -of -.I s2 -is -.I n -or more. -Both return -.IR s1 . -.PP -.I Strcat -appends a copy of string -.I s2 -to the end of string -.IR s1 . -.I Strncat -copies at most -.I n -characters. -Both return a pointer to the null-terminated result -.IR s1 . -.PP -.I Strcmp -compares its arguments and returns an integer -greater than, equal to, or less than 0, if -.I s1 -is lexicographically greater than, equal to, or -less than -.IR s2 , -respectively. -.I Strncmp -makes the same comparison but checks at most -.I n -characters. -.PP -.I Strlen -returns the number of characters before the null-character. -.IR s . -.PP .I Strindex .RI ( strrindex ) returns a pointer to the first (last) diff --git a/modules/src/string/strlen.c b/modules/src/string/strlen.c deleted file mode 100644 index 8e429f261..000000000 --- a/modules/src/string/strlen.c +++ /dev/null @@ -1,20 +0,0 @@ -/* $Id$ */ -/* - * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. - * See the copyright notice in the ACK home directory, in the file "Copyright". - */ -/* return length of s -*/ - -#include "ack_string.h" - -_SIZET -strlen(s) - _CONST char *s; -{ - register _CONST char *b = s; - - while (*b++) - ; - return b - s - 1; -} diff --git a/modules/src/string/strncat.c b/modules/src/string/strncat.c deleted file mode 100644 index c6ecd31ed..000000000 --- a/modules/src/string/strncat.c +++ /dev/null @@ -1,25 +0,0 @@ -/* $Id$ */ -/* - * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. - * See the copyright notice in the ACK home directory, in the file "Copyright". - */ -/* append t to s, upto n characters -*/ - -#include "ack_string.h" - -char * -strncat(s, t, n) - register char *s; - register _CONST char *t; - register _SIZET n; -{ - register char *b = s; - - while (*s++) - ; - s--; - while ((n-- > 0) && (*s++ = *t++)) - ; - return b; -} diff --git a/modules/src/string/strncmp.c b/modules/src/string/strncmp.c deleted file mode 100644 index c9464765c..000000000 --- a/modules/src/string/strncmp.c +++ /dev/null @@ -1,26 +0,0 @@ -/* $Id$ */ -/* - * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. - * See the copyright notice in the ACK home directory, in the file "Copyright". - */ -/* return negative, zero or positive value if - resp. s < t, s == t or s > t; compare at most n characters -*/ - -#include "ack_string.h" - -int -strncmp(s, t, n) - register _CONST char *s, *t; - register _SIZET n; -{ - while (n-- > 0) { - if (*s == *t++) { - if (*s++ == '\0') - return 0; - } - else - return *s - *--t; - } - return 0; -} diff --git a/modules/src/string/strncpy.c b/modules/src/string/strncpy.c deleted file mode 100644 index a12f80c64..000000000 --- a/modules/src/string/strncpy.c +++ /dev/null @@ -1,22 +0,0 @@ -/* $Id$ */ -/* - * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. - * See the copyright notice in the ACK home directory, in the file "Copyright". - */ -/* Copy t into s, upto n characters -*/ - -#include "ack_string.h" - -char * -strncpy(s, t, n) - register char *s; - register _CONST char *t; - register _SIZET n; -{ - register char *b = s; - - while ((n-- > 0) && (*s++ = *t++)) - ; - return b; -}