From ee442551e1531712226a3a3ba26afff466100bb5 Mon Sep 17 00:00:00 2001 From: Karl Ramm Date: Mon, 21 Jan 2008 07:57:32 +0000 Subject: passes gcc -Wall with no warnings other than des cryppt C_block sadness and getsid problem --- clients/zctl/zctl.c | 9 ++++++--- clients/zleave/zleave.c | 5 +++-- clients/znol/znol.c | 3 ++- clients/zshutdown_notify/zshutdown_notify.c | 12 +++++++----- clients/zstat/zstat.c | 7 ++++--- clients/zwrite/zwrite.c | 16 ++++++++++------ 6 files changed, 32 insertions(+), 20 deletions(-) (limited to 'clients') diff --git a/clients/zctl/zctl.c b/clients/zctl/zctl.c index de96d16..e48a651 100644 --- a/clients/zctl/zctl.c +++ b/clients/zctl/zctl.c @@ -17,7 +17,7 @@ #include #include #ifndef lint -static const char *rcsid_zctl_c = "$Id$"; +static const char rcsid_zctl_c[] = "$Id$"; #endif #define SUBSATONCE 7 @@ -52,6 +52,7 @@ void add_file(short, ZSubscription_t *, int); void del_file(short, ZSubscription_t *, int); void fix_macros(ZSubscription_t *, ZSubscription_t *, int); void fix_macros2(char *, char **); +int make_exist(char *); int main(int argc, @@ -538,8 +539,10 @@ add_file(short wgport, return; } fix_macros(subs,&sub2,1); - if (retval = (unsub ? ZUnsubscribeTo(&sub2,1,(u_short)wgport) : - ZSubscribeToSansDefaults(&sub2,1,(u_short)wgport))) + retval = (unsub + ? ZUnsubscribeTo(&sub2,1,(u_short)wgport) + : ZSubscribeToSansDefaults(&sub2,1,(u_short)wgport)); + if (retval) ss_perror(sci_idx,retval, unsub ? "while unsubscribing" : "while subscribing"); diff --git a/clients/zleave/zleave.c b/clients/zleave/zleave.c index 4483138..e7ce4b6 100644 --- a/clients/zleave/zleave.c +++ b/clients/zleave/zleave.c @@ -17,7 +17,7 @@ #include #ifndef lint -static char rcsid_zlocate_c[] = "$Id$"; +static const char rcsid_zlocate_c[] = "$Id$"; #endif /* lint */ /* @@ -254,7 +254,8 @@ doalarm(long nmins) daytime += gseconds; whenleave = ctime(&daytime); - if (fp = fopen(tempfile,"r")) { + fp = fopen(tempfile,"r"); + if (fp) { if (fscanf(fp, "%d", &oldpid) == 1) if (!kill(oldpid,9)) printf("Old zleave process killed.\n"); diff --git a/clients/znol/znol.c b/clients/znol/znol.c index cdb0349..33f5096 100644 --- a/clients/znol/znol.c +++ b/clients/znol/znol.c @@ -137,7 +137,8 @@ main(int argc, if (cleanname[0] == '#' || cleanname[0] == '\0' || cleanname[0] == '\n') continue; /* ignore comment and empty lines */ - if (comment_ptr = strchr(cleanname, '#')) + comment_ptr = strchr(cleanname, '#'); + if (comment_ptr) *comment_ptr = '\0'; /* Ignore from # onwards */ /* Get rid of old-style nol entries, just in case */ cp = cleanname + strlen(cleanname) - 1; diff --git a/clients/zshutdown_notify/zshutdown_notify.c b/clients/zshutdown_notify/zshutdown_notify.c index f2b4932..4e2eaa0 100644 --- a/clients/zshutdown_notify/zshutdown_notify.c +++ b/clients/zshutdown_notify/zshutdown_notify.c @@ -19,7 +19,7 @@ #include #ifndef lint -static const char *rcsid_zshutdown_notify_c = +static const char rcsid_zshutdown_notify_c[] = "$Id$"; #endif @@ -83,14 +83,16 @@ main(int argc, fprintf(stderr, "%s: can't figure out canonical hostname\n",argv[0]); exit(1); } - if (retval = krb_get_lrealm(rlm, 1)) { + retval = krb_get_lrealm(rlm, 1); + if (retval) { fprintf(stderr, "%s: can't get local realm: %s\n", argv[0], krb_get_err_text(retval)); exit(1); } - if (retval = krb_get_svc_in_tkt(SVC_NAME, hn2, rlm, - SERVER_SERVICE, SERVER_INSTANCE, 1, - KEYFILE)) { + retval = krb_get_svc_in_tkt(SVC_NAME, hn2, rlm, + SERVER_SERVICE, SERVER_INSTANCE, 1, + KEYFILE); + if (retval) { fprintf(stderr, "%s: can't get tickets: %s\n", argv[0], krb_get_err_text(retval)); exit(1); diff --git a/clients/zstat/zstat.c b/clients/zstat/zstat.c index 04951cc..2e0be61 100644 --- a/clients/zstat/zstat.c +++ b/clients/zstat/zstat.c @@ -15,6 +15,8 @@ #include #include +#include +#include #include "zserver.h" #if !defined(lint) && !defined(SABER) @@ -49,6 +51,8 @@ u_short srv_port; void usage(char *); void do_stat(char *); +int srv_stat(char *); +int hm_stat(char *, char *); RETSIGTYPE timeout(int ignored) @@ -145,9 +149,6 @@ hm_stat(char *host, time_t runtime; struct tm *tim; ZNotice_t notice; -#ifdef _POSIX_VERSION - struct sigaction sa; -#endif if ((inaddr.s_addr = inet_addr(host)) == (unsigned)(-1)) { if ((hp = gethostbyname(host)) == NULL) { diff --git a/clients/zwrite/zwrite.c b/clients/zwrite/zwrite.c index a7f1fc4..1774aaf 100644 --- a/clients/zwrite/zwrite.c +++ b/clients/zwrite/zwrite.c @@ -61,20 +61,23 @@ main(int argc, verbose = quiet = msgarg = nrecips = nocheck = filsys = nodot = 0; tabexpand = 1; - if (class = ZGetVariable("zwrite-class")) { + class = ZGetVariable("zwrite-class"); + if (class) { (void) strcpy(classbfr, class); class = classbfr; } else class = DEFAULT_CLASS; - if (inst = ZGetVariable("zwrite-inst")) { + inst = ZGetVariable("zwrite-inst"); + if (inst) { (void) strcpy(instbfr, inst); inst = instbfr; } else inst = DEFAULT_INSTANCE; - if (opcode = ZGetVariable("zwrite-opcode")) + opcode = ZGetVariable("zwrite-opcode"); + if (opcode) opcode = strcpy(opbfr, opcode); else opcode = DEFAULT_OPCODE; @@ -243,11 +246,12 @@ main(int argc, if (!nocheck && nrecips) send_off(¬ice, 0); - if (!msgarg && isatty(0)) + if (!msgarg && isatty(0)) { if (nodot) printf("Type your message now. End with the end-of-file character.\n"); else printf("Type your message now. End with control-D or a dot on a line by itself.\n"); + } message = NULL; msgsize = 0; @@ -314,7 +318,7 @@ main(int argc, message = realloc(message, (unsigned)(msgsize+1)); } else { /* Use read so you can send binary messages... */ - while (nchars = read(fileno(stdin), bfr, sizeof bfr)) { + while ((nchars = read(fileno(stdin), bfr, sizeof bfr))) { if (nchars == -1) { fprintf(stderr, "Read error from stdin! Can't continue!\n"); exit(1); @@ -343,7 +347,7 @@ send_off(ZNotice_t *notice, int real) { int i, success, retval; - char bfr[BUFSIZ], realm_recip[BUFSIZ], dest[3 * BUFSIZ], *cp; + char bfr[BUFSIZ], realm_recip[BUFSIZ], dest[3 * BUFSIZ]; ZNotice_t retnotice; success = 0; -- cgit v1.2.3