From: Alan Cox Date: Sun, 10 May 2015 22:41:41 +0000 (+0100) Subject: sh: ansify string.c X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=880a4903c107439421e46e77dd9ea91f6303cc27;p=FUZIX.git sh: ansify string.c (most of this wants swapping for ANSI C string funcs later) --- diff --git a/Applications/V7/cmd/sh/defs.h b/Applications/V7/cmd/sh/defs.h index 136bf7be..19cbfa53 100644 --- a/Applications/V7/cmd/sh/defs.h +++ b/Applications/V7/cmd/sh/defs.h @@ -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); diff --git a/Applications/V7/cmd/sh/string.c b/Applications/V7/cmd/sh/string.c index 58b2c6ab..0d893ffb 100644 --- a/Applications/V7/cmd/sh/string.c +++ b/Applications/V7/cmd/sh/string.c @@ -15,18 +15,15 @@ /* ======== 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++);;