From a151529de62bd6049ddc507c62bc09747c3ec111 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Fri, 10 Jul 2009 13:30:20 +0100 Subject: [PATCH] Tidy up util Resolve a number of minor warnings Prototype the stolower function for use elsewhere Reviewed-on: http://gerrit.openafs.org/21 Verified-by: Russ Allbery Reviewed-by: Russ Allbery --- src/util/afsutil_prototypes.h | 2 ++ src/util/casestrcpy.c | 8 ++++---- src/util/fstab.c | 1 + src/util/netutils.c | 2 ++ src/util/softsig.c | 7 +++++-- src/util/volparse.c | 8 ++++---- 6 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/util/afsutil_prototypes.h b/src/util/afsutil_prototypes.h index d4324cad2..589da526c 100644 --- a/src/util/afsutil_prototypes.h +++ b/src/util/afsutil_prototypes.h @@ -32,6 +32,8 @@ extern int base64_to_int(char *s); extern char *lcstring(char *d, char *s, int n); extern char *ucstring(char *d, char *s, int n); extern char *strcompose(char *buf, size_t len, ...); +extern void stolower(char *s); +extern void stoupper(char *s); /* daemon.c */ #ifndef HAVE_DAEMON diff --git a/src/util/casestrcpy.c b/src/util/casestrcpy.c index e8caafcc3..c9e038fd1 100644 --- a/src/util/casestrcpy.c +++ b/src/util/casestrcpy.c @@ -59,7 +59,7 @@ ucstring(char *d, char *s, int n) return original_d; } -int +void stolower(char *s) { while (*s) { @@ -67,10 +67,10 @@ stolower(char *s) *s = tolower(*s); s++; } - return 0; + return; } -int +void stoupper(char *s) { while (*s) { @@ -78,7 +78,7 @@ stoupper(char *s) *s = toupper(*s); s++; } - return 0; + return; } /* strcompose - concatenate strings passed to it. diff --git a/src/util/fstab.c b/src/util/fstab.c index 2ddefe55f..a39ab46c2 100644 --- a/src/util/fstab.c +++ b/src/util/fstab.c @@ -71,6 +71,7 @@ #include #include #include +#include #define STDERR_FILENO 2 diff --git a/src/util/netutils.c b/src/util/netutils.c index 9d0427f54..03a90e3b6 100644 --- a/src/util/netutils.c +++ b/src/util/netutils.c @@ -40,6 +40,8 @@ #include #endif +#include + #include "assert.h" #include "afsutil.h" #include "dirpath.h" diff --git a/src/util/softsig.c b/src/util/softsig.c index 33981b870..24a241254 100644 --- a/src/util/softsig.c +++ b/src/util/softsig.c @@ -68,7 +68,9 @@ softsig_thread(void *arg) while (1) { void (*h) (int); +#if !defined(AFS_DARwiN60_ENV) && !defined(AFS_NBSD_ENV) int sigw; +#endif h = NULL; @@ -101,6 +103,7 @@ softsig_thread(void *arg) } else if (h) h(i); } + return NULL; } static void @@ -110,7 +113,7 @@ softsig_usr1(int signo) } void -softsig_init() +softsig_init(void) { int rc; AFS_SIGSET_DECL; @@ -146,7 +149,7 @@ print_foo(int signo) } int -main() +main(int argc, char **argv) { softsig_init(); softsig_signal(SIGINT, print_foo); diff --git a/src/util/volparse.c b/src/util/volparse.c index 3cfbc78ae..72bee5ee4 100644 --- a/src/util/volparse.c +++ b/src/util/volparse.c @@ -232,7 +232,7 @@ util_GetInt32(register char *as, afs_int32 * aval) negative = 0; /* skip over leading spaces */ - for (; tc = *as; as++) { + for (tc = *as; tc !='\0'; as++, tc = *as) { if (tc != ' ' && tc != '\t') break; } @@ -255,7 +255,7 @@ util_GetInt32(register char *as, afs_int32 * aval) base = 10; /* compute the # itself */ - for (; tc = *as; as++) { + for (tc = *as; tc !='\0'; as++, tc = *as) { if (!ismeta(tc, base)) return -1; total *= base; @@ -279,7 +279,7 @@ util_GetUInt32(register char *as, afs_uint32 * aval) total = 0; /* initialize things */ /* skip over leading spaces */ - for (; tc = *as; as++) { + for (tc = *as; tc !='\0'; as++, tc = *as) { if (tc != ' ' && tc != '\t') break; } @@ -296,7 +296,7 @@ util_GetUInt32(register char *as, afs_uint32 * aval) base = 10; /* compute the # itself */ - for (;tc = *as; as++) { + for (tc = *as; tc !='\0'; as++, tc = *as) { if (!ismeta(tc, base)) return -1; total *= base; -- 2.39.5