sh: ansify string.c
authorAlan Cox <alan@linux.intel.com>
Sun, 10 May 2015 22:41:41 +0000 (23:41 +0100)
committerAlan Cox <alan@linux.intel.com>
Sun, 10 May 2015 22:41:41 +0000 (23:41 +0100)
(most of this wants swapping for ANSI C string funcs later)

Applications/V7/cmd/sh/defs.h
Applications/V7/cmd/sh/string.c

index 136bf7b..19cbfa5 100644 (file)
@@ -316,3 +316,8 @@ extern void error(const STRING s);
 extern void exitsh(int xno);
 extern void done(void);
 extern void rmtemp(IOPTR base);
+/* string.c */
+extern char *movstr(register const char *a, register char *b);
+extern int any(char c, const char *s);
+extern int cf(register const char *s1, register const char *s2);
+extern int length(const char *as);
index 58b2c6a..0d893ff 100644 (file)
 /* ========    general purpose string handling ======== */
 
 
-STRING movstr(a, b)
-register STRING a, b;
+char *movstr(register const char *a, register char *b)
 {
        while (*b++ = *a++);
        return (--b);
 }
 
-int any(c, s)
-register CHAR c;
-STRING s;
+int any(char c, const char *s)
 {
-       register CHAR d;
+       register char d;
 
        while (d = *s++) {
                if (d == c) {
@@ -37,8 +34,7 @@ STRING s;
        return (FALSE);
 }
 
-int cf(s1, s2)
-register STRING s1, s2;
+int cf(register const char *s1, register const char *s2)
 {
        while (*s1++ == *s2) {
                if (*s2++ == 0) {
@@ -49,10 +45,9 @@ register STRING s1, s2;
        return (*--s1 - *s2);
 }
 
-int length(as)
-STRING as;
+int length(const char *as)
 {
-       register STRING s;
+       register const char *s;
 
        if (s = as) {
                while (*s++);;