]> asedeno.scripts.mit.edu Git - 1ts-debian.git/commitdiff
r4275@bucket (orig r265): kcr | 2008-01-21 02:57:32 -0500
authorkcr <kcr@cbed1d16-5ef5-0310-b6a1-d4a37b08ba1f>
Thu, 18 Dec 2008 04:49:46 +0000 (04:49 +0000)
committerkcr <kcr@cbed1d16-5ef5-0310-b6a1-d4a37b08ba1f>
Thu, 18 Dec 2008 04:49:46 +0000 (04:49 +0000)
 passes gcc -Wall with no warnings other than des cryppt C_block sadness and getsid problem

git-svn-id: svn://svn.1ts.org/debian/trunk@337 cbed1d16-5ef5-0310-b6a1-d4a37b08ba1f

48 files changed:
zephyr/clients/zctl/zctl.c
zephyr/clients/zleave/zleave.c
zephyr/clients/znol/znol.c
zephyr/clients/zshutdown_notify/zshutdown_notify.c
zephyr/clients/zstat/zstat.c
zephyr/clients/zwrite/zwrite.c
zephyr/server/bdump.c
zephyr/server/class.c
zephyr/server/client.c
zephyr/server/dispatch.c
zephyr/server/kstuff.c
zephyr/server/main.c
zephyr/server/realm.c
zephyr/server/server.c
zephyr/server/subscr.c
zephyr/server/timer.c
zephyr/server/uloc.c
zephyr/server/zserver.h
zephyr/zhm/queue.c
zephyr/zhm/timer.c
zephyr/zhm/zhm.c
zephyr/zhm/zhm.h
zephyr/zhm/zhm_client.c
zephyr/zhm/zhm_server.c
zephyr/zwgc/X_driver.c
zephyr/zwgc/X_fonts.c
zephyr/zwgc/X_gram.c
zephyr/zwgc/X_gram.h
zephyr/zwgc/character_class.c
zephyr/zwgc/file.c
zephyr/zwgc/formatter.c
zephyr/zwgc/lexer.c
zephyr/zwgc/main.c
zephyr/zwgc/port.c
zephyr/zwgc/standard_ports.c
zephyr/zwgc/string_dictionary_aux.c
zephyr/zwgc/subscriptions.c
zephyr/zwgc/substitute.c
zephyr/zwgc/text_operations.c
zephyr/zwgc/tty_filter.c
zephyr/zwgc/variables.c
zephyr/zwgc/xcut.c
zephyr/zwgc/xmark.c
zephyr/zwgc/xrevstack.h
zephyr/zwgc/xselect.c
zephyr/zwgc/xshow.c
zephyr/zwgc/zephyr.c
zephyr/zwgc/zephyr.h

index de96d16142217cf90be948ca6ec7a8d9a2f2b072..e48a6512865f974a2a322a25f8071128157d68d3 100644 (file)
@@ -17,7 +17,7 @@
 #include <pwd.h>
 #include <netdb.h>
 #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");
index 44831384df400820855a783f4f12a4fbf5f51457..e7ce4b6c189fcfc8d46ed8082d9c24c84b951a96 100644 (file)
@@ -17,7 +17,7 @@
 #include <com_err.h>
 
 #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");
index cdb03499c318785cfb10e4c64b88bd68f66c61c5..33f5096b35624a3d2f0d6ee89cd97a5f0a3c5738 100644 (file)
@@ -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;
index f2b493289959577ade261a9b99cc80ffa4840e6b..4e2eaa0bf6d6c15619ee9fd3b433789596c5945d 100644 (file)
@@ -19,7 +19,7 @@
 #include <netdb.h>
 
 #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);
index 04951cce1b9cb1f4e5ed8d56749f435abb047b1d..2e0be612571a6dff2e9752e096ec484bb0a3fab5 100644 (file)
@@ -15,6 +15,8 @@
 #include <internal.h>
 
 #include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
 #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) {
index a7f1fc4257b73d703b51ebb89ad67eb23fd76003..1774aafdbd2f8bc9fc571569977ba2b6b484c015 100644 (file)
@@ -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(&notice, 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;
index 9efc3b5e8897ada5d25d6884bd06014f6ca8a7df..63fbe9cf17dbf80fe73a91d1fada9f0a68e8a300 100644 (file)
@@ -83,7 +83,6 @@ return 0;
 
 static void close_bdump(void* arg);
 static Code_t bdump_send_loop(Server *server);
-static Code_t bdump_ask_for(char *inst);
 static Code_t bdump_recv_loop(Server *server);
 static void bdump_get_v12(ZNotice_t *, int, struct sockaddr_in *,
                               Server *);
@@ -183,7 +182,7 @@ bdump_offer(struct sockaddr_in *who)
        return;
     }
     if (!bdump_sin.sin_port) {
-       int len = sizeof(bdump_sin);
+       unsigned int len = sizeof(bdump_sin);
 
        if (getsockname(bdump_socket,
                        (struct sockaddr *) &bdump_sin, &len) < 0) {
@@ -252,7 +251,7 @@ bdump_send(void)
     struct sockaddr_in from;
     Server *server;
     Code_t retval;
-    int fromlen = sizeof(from);
+    unsigned int fromlen = sizeof(from);
     int on = 1;
 #ifdef _POSIX_VERSION
     struct sigaction action;
@@ -272,7 +271,6 @@ bdump_send(void)
     /* may be moved into kstuff.c */
     krb5_principal principal;
     krb5_data k5data;
-    krb5_ap_rep_enc_part *rep;
     krb5_keytab kt;
 #endif
 #if !defined(HAVE_KRB4) && !defined(HAVE_KRB5)
@@ -1010,10 +1008,6 @@ get_tgt(void)
      * at least INST_SZ bytes long. */
     static char buf[INST_SZ + 1] = SERVER_INSTANCE;
     int retval = 0;
-    CREDENTIALS cred;
-#ifndef NOENCRYPTION
-    Sched *s;
-#endif
     
     /* have they expired ? */
     if (ticket_time < NOW - tkt_lifetime(TKTLIFETIME) + (15L * 60L)) {
@@ -1039,7 +1033,7 @@ get_tgt(void)
 #ifndef NOENCRYPTION
        retval = read_service_key(SERVER_SERVICE, SERVER_INSTANCE,
                                  ZGetRealm(), 0 /*kvno*/,
-                                 srvtab_file, serv_key);
+                                 srvtab_file, (char *)serv_key);
        if (retval != KSUCCESS) {
            syslog(LOG_ERR, "get_tgt: read_service_key: %s",
                   krb_get_err_text(retval));
@@ -1138,7 +1132,7 @@ bdump_recv_loop(Server *server)
     Client *client = NULL;
     struct sockaddr_in who;
 #ifdef HAVE_KRB5
-    char buf[512];
+    unsigned char buf[512];
     int blen;
 #endif
 #if defined(HAVE_KRB4) || defined(HAVE_KRB5)    
@@ -1268,7 +1262,7 @@ bdump_recv_loop(Server *server)
                                        serv_ksched.s, DES_DECRYPT);
                    }
                } else if (*cp == 'Z') { /* Zcode! Long live the new flesh! */
-                   retval = ZReadZcode(cp, buf, sizeof(buf), &blen);
+                   retval = ZReadZcode((unsigned char *)cp, buf, sizeof(buf), &blen);
                    if (retval != ZERR_NONE) {
                        syslog(LOG_ERR,"brl bad cblk read: %s (%s)",
                               error_message(retval), cp);
@@ -1329,7 +1323,7 @@ bdump_recv_loop(Server *server)
                           error_message(retval));
                    return retval;
                }
-           } /* else 
+           } /* else */
                 /* Other side tried to send us subs for a realm we didn't
                    know about, and so we drop them silently */
        
index 73ac0f2d6dbb996e6a016c1381a0fc672c171593..047b3e6bd7acdb32146e9785bcb2fd23a530d461 100644 (file)
@@ -130,7 +130,7 @@ triplet_register(Client *client,
 
     /* Triplet not present in hash table, insert it. */
     triplet = triplet_alloc(dest->classname, dest->inst, dest->recip);
-    LIST_INSERT(&triplet_bucket[hashval], triplet);
+    Triplet_insert(&triplet_bucket[hashval], triplet);
     return insert_client(triplet, client, realm);
 }
 
@@ -156,7 +156,7 @@ triplet_deregister(Client *client,
            if (retval != ZERR_NONE)
                return retval;
            if (*triplet->clients == NULL && !triplet->acl) {
-               LIST_DELETE(triplet);
+               Triplet_delete(triplet);
                free_triplet(triplet);
                return ZSRV_EMPTYCLASS;
            }
@@ -265,7 +265,7 @@ class_setup_restricted(char *class_name,
     if (!triplet)
        return ENOMEM;
     triplet->acl = acl;
-    LIST_INSERT(&triplet_bucket[hashval], triplet);
+    Triplet_insert(&triplet_bucket[hashval], triplet);
     return ZERR_NONE;
 }
 
@@ -279,7 +279,6 @@ triplet_alloc(String *classname,
              String *recipient)
 {
     Triplet *triplet;
-    Client *clist;
 
     triplet = (Triplet *) malloc(sizeof(Triplet));
     if (!triplet)
index e56c9b9b5f4ba6ffaee5e5bdb79e24f9248fb9aa..90d83bc31a57717633544bbc5b224b1bc2526f9e 100644 (file)
@@ -65,7 +65,6 @@ client_register(ZNotice_t *notice,
                int wantdefaults)
 {
     Client *client;
-    Code_t retval;
 
     /* chain the client's host onto this server's host list */
 
@@ -98,8 +97,8 @@ client_register(ZNotice_t *notice,
        client->subs = NULL;
        client->realm = NULL;
        client->principal = make_string(notice->z_sender, 0);
-       LIST_INSERT(&client_bucket[INET_HASH(&client->addr.sin_addr,
-                                            notice->z_port)], client);
+       Client_insert(&client_bucket[INET_HASH(&client->addr.sin_addr,
+                                              notice->z_port)], client);
     }
 
     /* Add default subscriptions only if this is not resulting from a brain
@@ -120,7 +119,7 @@ void
 client_deregister(Client *client,
                  int flush)
 {
-    LIST_DELETE(client);
+    Client_delete(client);
     nack_release(client);
     subscr_cancel_client(client);
     free_string(client->principal);
index 0bbd67561de802b591ddbb8f11fa9138c9d3617f..cb529232b71bac7e9c7e0275e7ea2f53ac73e12c 100644 (file)
@@ -199,7 +199,8 @@ handle_packet(void)
         if (new_notice.z_kind == SERVACK || new_notice.z_kind == SERVNAK) {
           authentic = ZAUTH_YES;
         } else {
-          if (realm = realm_which_realm(&input_sin)) {
+         realm = realm_which_realm(&input_sin);
+          if (realm) {
             authentic = ZCheckRealmAuthentication(&new_notice,
                                                       &input_sin,
                                                       realm->name);
@@ -214,7 +215,8 @@ handle_packet(void)
         if (new_notice.z_kind == SERVACK || new_notice.z_kind == SERVNAK) {
           authentic = ZAUTH_YES;
         } else {
-          if (realm = realm_which_realm(&whoisit)) {
+         realm = realm_which_realm(&whoisit);
+          if (realm) {
             authentic = ZCheckRealmAuthentication(&new_notice,
                                                   &whoisit,
                                                   realm->name);
@@ -518,7 +520,7 @@ nack_release(Client *client)
            next = nacked->next;
            if (nacked->client == client) {
                timer_reset(nacked->timer);
-               LIST_DELETE(nacked);
+               Unacked_delete(nacked);
                free(nacked->packet);
                free(nacked);
            }
@@ -543,7 +545,7 @@ xmit_frag(ZNotice_t *notice,
     char *savebuf;
     Unacked *nacked;
     Code_t retval;
-    int hashval, sendfail = 0;
+    int sendfail = 0;
 
     retval = ZSendPacket(buf, len, 0);
     if (retval != ZERR_NONE) {
@@ -579,7 +581,7 @@ xmit_frag(ZNotice_t *notice,
     nacked->packsz = len;
     nacked->uid = notice->z_uid;
     nacked->timer = timer_set_rel(rexmit_times[0], rexmit, nacked);
-    LIST_INSERT(&nacktab[NACKTAB_HASHVAL(sin, nacked->uid)], nacked);
+    Unacked_insert(&nacktab[NACKTAB_HASHVAL(sin, nacked->uid)], nacked);
     return(ZERR_NONE);
 }
 
@@ -654,10 +656,10 @@ xmit(ZNotice_t *notice,
          * same thing with authentic Zephyrs.
          */
         if (retval == ZERR_PKTLEN) {
-          ZNotice_t partnotice, newnotice;
+          ZNotice_t partnotice;
           char multi[64];
           char *buffer, *ptr;
-          int buffer_len, hdrlen, offset, fragsize, ret_len, message_len;
+          int buffer_len, hdrlen, offset, fragsize, message_len;
           int origoffset, origlen;
 
           free(noticepack);
@@ -790,7 +792,7 @@ xmit(ZNotice_t *notice,
     nacked->packsz = packlen;
     nacked->uid = notice->z_uid;
     nacked->timer = timer_set_rel(rexmit_times[0], rexmit, nacked);
-    LIST_INSERT(&nacktab[NACKTAB_HASHVAL(*dest, nacked->uid)], nacked);
+    Unacked_insert(&nacktab[NACKTAB_HASHVAL(*dest, nacked->uid)], nacked);
 }
 
 /*
@@ -808,7 +810,7 @@ rexmit(void *arg)
 #if 1
     syslog(LOG_DEBUG, "rexmit %s/%d #%d time %d",
           inet_ntoa(nacked->dest.addr.sin_addr),
-          ntohs(nacked->dest.addr.sin_port), nacked->rexmits + 1, NOW);
+          ntohs(nacked->dest.addr.sin_port), nacked->rexmits + 1, (int)NOW);
 #endif
 
     nacked->rexmits++;
@@ -821,7 +823,7 @@ rexmit(void *arg)
             * nack list before calling client_deregister(), which
             * scans the nack list.)
             */
-           LIST_DELETE(nacked);
+           Unacked_delete(nacked);
            if (nacked->client) {
                server_kill_clt(nacked->client);
                client_deregister(nacked->client, 1);
@@ -873,7 +875,6 @@ clt_ack(ZNotice_t *notice,
     ZNotice_t acknotice;
     ZPacket_t ackpack;
     int packlen;
-    int notme = 0;
     char *sent_name;
     Code_t retval;
 
@@ -982,7 +983,7 @@ nack_cancel(ZNotice_t *notice,
                nacked->client->last_ack = NOW;
            timer_reset(nacked->timer);
            free(nacked->packet);
-           LIST_DELETE(nacked);
+           Unacked_delete(nacked);
            free(nacked);
            return;
        }
@@ -1008,9 +1009,7 @@ hostm_dispatch(ZNotice_t *notice,
               struct sockaddr_in *who,
               Server *server)
 {
-    Server *owner;
     char *opcode = notice->z_opcode;
-    Code_t retval;
     int i, add = 0, remove = 0;
 
 #if 0
@@ -1291,7 +1290,6 @@ void
 realm_shutdown(void)
 {
     int i, s, newserver;
-    struct sockaddr_in sin;
 
     for (i = 0; i < nservers; i++) {
         if (i != me_server_idx && otherservers[i].state == SERV_UP)
index 53b651972123e05cd7f5f00d9083a4d9301fcbf4..6275e16ff71aa254c7757f2102ab2aa5a4ce2b0f 100644 (file)
@@ -22,8 +22,9 @@ static const char rcsid_kstuff_c[] = "$Id$";
 
 #ifdef HAVE_KRB4
 
-static ZChecksum_t compute_checksum __P((ZNotice_t *, C_Block));
-static ZChecksum_t compute_rlm_checksum __P((ZNotice_t *, C_Block));
+static ZChecksum_t compute_checksum(ZNotice_t *, C_Block);
+static ZChecksum_t compute_rlm_checksum(ZNotice_t *, C_Block);
+static Code_t ZCheckAuthentication4(ZNotice_t *notice, struct sockaddr_in *from);
 
 /*
  * GetKerberosData
@@ -126,8 +127,7 @@ Code_t
 ReadKerberosData(int fd, int *size, char **data, int *proto) {
     char p[20];
     int i;
-    unsigned char *dst;
-    Code_t retval;
+    char *dst;
     int len = 0;
 
     for (i=0; i<20; i++) {
@@ -152,7 +152,7 @@ ReadKerberosData(int fd, int *size, char **data, int *proto) {
     else if ((len = atoi(p)) > 0)
        *proto = 4;
 
-    if (*proto < 4 | *proto > 5) {
+    if ((*proto < 4) | (*proto > 5)) {
        syslog(LOG_WARNING, "ReadKerberosData: error parsing authenticator length (\"%s\")", p);
        return KFAILURE;
     }
@@ -188,8 +188,7 @@ Code_t
 GetKrb5Data(int fd, krb5_data *data) {
     char p[20];
     int i;
-    unsigned char *dst;
-    Code_t retval;
+    char *dst;
 
     for (i=0; i<20; i++) {
        if (read(fd, &p[i], 1) != 1) {
@@ -260,8 +259,9 @@ ZCheckRealmAuthentication(ZNotice_t *notice,
     krb5_data cksumbuf;
     int valid;
     char *cksum0_base, *cksum1_base, *cksum2_base; 
-    char *svcinst, *x, *y; 
-    char *asn1_data, *key_data; 
+    char *x; 
+    unsigned char *asn1_data;
+    unsigned char *key_data; 
     int asn1_len, key_len, cksum0_len, cksum1_len, cksum2_len; 
 #ifdef KRB5_AUTH_CON_GETAUTHENTICATOR_TAKES_DOUBLE_POINTER
     krb5_authenticator *authenticator;
@@ -280,11 +280,11 @@ ZCheckRealmAuthentication(ZNotice_t *notice,
         return ZAUTH_FAILED;
 
     len = strlen(notice->z_ascii_authent)+1;
-    authbuf=malloc(len);
+    authbuf = malloc(len);
 
     /* Read in the authentication data. */
-    if (ZReadZcode(notice->z_ascii_authent, 
-                   authbuf,
+    if (ZReadZcode((unsigned char *)notice->z_ascii_authent, 
+                   (unsigned char *)authbuf,
                    len, &len) == ZERR_BADFIELD) {
         return ZAUTH_FAILED;
     }
@@ -492,7 +492,7 @@ ZCheckRealmAuthentication(ZNotice_t *notice,
         return ZAUTH_FAILED; 
     } 
     /* HOLDING: authctx, authenticator, cksumbuf.data, asn1_data */ 
-    result = ZReadZcode(notice->z_ascii_checksum, 
+    result = ZReadZcode((unsigned char *)notice->z_ascii_checksum, 
                         asn1_data, asn1_len, &asn1_len); 
     if (result != ZERR_NONE) { 
         krb5_free_keyblock(Z_krb5_ctx, keyblock);
@@ -526,7 +526,7 @@ ZCheckAuthentication(ZNotice_t *notice,
                     struct sockaddr_in *from)
 {       
 #ifdef HAVE_KRB5
-    char *authbuf;
+    unsigned char *authbuf;
     krb5_principal princ;
     krb5_data packet;
     krb5_ticket *tkt;
@@ -541,8 +541,8 @@ ZCheckAuthentication(ZNotice_t *notice,
     krb5_data cksumbuf;
     int valid;
     char *cksum0_base, *cksum1_base, *cksum2_base; 
-    char *svcinst, *x, *y
-    char *asn1_data, *key_data; 
+    char *x
+    unsigned char *asn1_data, *key_data; 
     int asn1_len, key_len, cksum0_len, cksum1_len, cksum2_len; 
 #ifdef KRB5_AUTH_CON_GETAUTHENTICATOR_TAKES_DOUBLE_POINTER
     krb5_authenticator *authenticator;
@@ -566,17 +566,17 @@ ZCheckAuthentication(ZNotice_t *notice,
 #endif
     
     len = strlen(notice->z_ascii_authent)+1;
-    authbuf=malloc(len);
+    authbuf = malloc(len);
 
     /* Read in the authentication data. */
-    if (ZReadZcode(notice->z_ascii_authent, 
+    if (ZReadZcode((unsigned char *)notice->z_ascii_authent, 
                    authbuf,
                    len, &len) == ZERR_BADFIELD) {
         return ZAUTH_FAILED;
     }
 
     packet.length = len;
-    packet.data = authbuf;
+    packet.data = (char *)authbuf;
 
     result = krb5_kt_resolve(Z_krb5_ctx, 
                         keytab_file, &keytabid);
@@ -776,7 +776,7 @@ ZCheckAuthentication(ZNotice_t *notice,
         return ZAUTH_FAILED; 
     } 
     /* HOLDING: authctx, authenticator, cksumbuf.data, asn1_data */ 
-    result = ZReadZcode(notice->z_ascii_checksum, 
+    result = ZReadZcode((unsigned char *)notice->z_ascii_checksum, 
                         asn1_data, asn1_len, &asn1_len); 
     if (result != ZERR_NONE) { 
         krb5_free_keyblock(Z_krb5_ctx, keyblock);
@@ -807,17 +807,16 @@ ZCheckAuthentication(ZNotice_t *notice,
 
 #undef KRB5AUTHENT
 
-Code_t
+static Code_t
 ZCheckAuthentication4(ZNotice_t *notice,
                      struct sockaddr_in *from)
 {      
 #ifdef HAVE_KRB4
     int result;
     char srcprincipal[ANAME_SZ+INST_SZ+REALM_SZ+4];
-    KTEXT_ST authent, ticket;
+    KTEXT_ST authent;
     AUTH_DAT dat;
     ZChecksum_t checksum;
-    C_Block session_key;
     char instance[INST_SZ+1];
 
     if (!notice->z_auth)
@@ -881,9 +880,9 @@ compute_checksum(ZNotice_t *notice,
 
     cstart = notice->z_default_format + strlen(notice->z_default_format) + 1;
     cend = cstart + strlen(cstart) + 1;
-    checksum = des_quad_cksum(hstart, NULL, cstart - hstart, 0, session_key);
-    checksum ^= des_quad_cksum(cend, NULL, hend - cend, 0, session_key);
-    checksum ^= des_quad_cksum(notice->z_message, NULL, notice->z_message_len,
+    checksum = des_quad_cksum((unsigned char *)hstart, NULL, cstart - hstart, 0, session_key);
+    checksum ^= des_quad_cksum((unsigned char *)cend, NULL, hend - cend, 0, session_key);
+    checksum ^= des_quad_cksum((unsigned char *)notice->z_message, NULL, notice->z_message_len,
                               0, session_key);
     return checksum;
 #endif
@@ -896,11 +895,11 @@ static ZChecksum_t compute_rlm_checksum(ZNotice_t *notice,
     return 0;
 #else
     ZChecksum_t checksum;
-    char *cstart, *cend, *hstart = notice->z_packet, *hend = notice->z_message;
+    char *cstart, *cend, *hstart = notice->z_packet;
 
     cstart = notice->z_default_format + strlen(notice->z_default_format) + 1;
     cend = cstart + strlen(cstart) + 1;
-    checksum = des_quad_cksum(hstart, NULL, cstart - hstart, 0, session_key);
+    checksum = des_quad_cksum((unsigned char *)hstart, NULL, cstart - hstart, 0, session_key);
     return checksum;
 #endif
 }
index 1472e1e1a5b1f882eb1fbd27baa421d1b39aa336..30bb0f9e47a57d305029d4e0f6328204ac38abe6 100644 (file)
@@ -60,7 +60,6 @@ static RETSIGTYPE bye(int);
 static RETSIGTYPE dbug_on(int);
 static RETSIGTYPE dbug_off(int);
 static RETSIGTYPE sig_dump_db(int);
-static RETSIGTYPE sig_dump_strings(int);
 static RETSIGTYPE reset(int);
 static RETSIGTYPE reap(int);
 static void read_from_dump(char *dumpfile);
@@ -395,7 +394,6 @@ main(int argc,
 static int
 initialize(void)
 {
-    int zero = 0;
     if (do_net_setup())
        return(1);
 
@@ -586,12 +584,6 @@ dbug_off(int sig)
 
 int fork_for_dump = 0;
 
-static RETSIGTYPE
-sig_dump_strings(int sig)
-{
-    dump_strings_flag = 1;
-}
-
 static void dump_strings(void)
 {
     char filename[128];
index 0dea7956ad3958230992260027986d7fdfc136c2..714b00818d4020d2e3a05b021999cef4be043911 100644 (file)
@@ -78,7 +78,7 @@ realm_get_idx_by_addr(ZRealm *realm,
                      struct sockaddr_in *who)
 {
     struct sockaddr_in *addr;
-    int a, b;
+    int b;
 
     /* loop through the realms */
     for (addr = realm->addrs, b = 0; b < realm->count; b++, addr++)
@@ -232,7 +232,8 @@ realm_send_realms(void)
 {
     int cnt, retval;
     for (cnt = 0; cnt < nrealms; cnt++) {
-       if (retval = (subscr_send_realm_subs(&otherrealms[cnt])) != ZERR_NONE)
+       retval = subscr_send_realm_subs(&otherrealms[cnt]);
+       if (retval != ZERR_NONE)
            return(retval);
     }
     return ZERR_NONE;
@@ -330,8 +331,7 @@ rlm_nack_cancel(register ZNotice_t *notice,
                struct sockaddr_in *who)
 {
     register ZRealm *which = realm_which_realm(who);
-    register Unacked *nacked, *next;
-    ZPacket_t retval;
+    register Unacked *nacked;
   
 #if 1
     zdbug((LOG_DEBUG, "rlm_nack_cancel: %s:%08X,%08X",
@@ -355,7 +355,7 @@ rlm_nack_cancel(register ZNotice_t *notice,
         
                /* free the data */
                free(nacked->packet);
-               LIST_DELETE(nacked);
+               Unacked_delete(nacked);
                free(nacked);
                return;
            }
@@ -579,7 +579,6 @@ void
 realm_deathgram(Server *server)
 {
     ZRealm *realm;
-    char rlm_recipient[REALM_SZ + 1];
     int jj = 0;
 
     /* Get it out once, and assume foreign servers will share */
@@ -641,7 +640,6 @@ realm_wakeup(void)
 {
     int jj, found = 0;
     ZRealm *realm;
-    char rlm_recipient[REALM_SZ + 1];
     
     for (jj = 1; jj < nservers; jj++) {    /* skip limbo server */
        if (jj != me_server_idx && otherservers[jj].state == SERV_UP)
@@ -712,7 +710,6 @@ realm_ulocate_dispatch(ZNotice_t *notice,
                       ZRealm *realm)
 {
     register char *opcode = notice->z_opcode;
-    Code_t status;
   
     if (!auth) {
        syslog(LOG_WARNING, "unauth locate msg from %s (%s/%s/%s)",
@@ -829,8 +826,6 @@ realm_new_server(struct sockaddr_in *sin,
                 ZNotice_t *notice,
                 ZRealm *realm)
 {
-    struct hostent *hp;
-    char suggested_server[MAXHOSTNAMELEN];
     unsigned long addr;
     ZRealm *rlm;
     struct sockaddr_in sinaddr;
@@ -858,6 +853,7 @@ realm_new_server(struct sockaddr_in *sin,
     } else {
       zdbug((LOG_DEBUG, "rlm_new_srv: not switching servers (%s)", inet_ntoa((realm->addrs[realm->idx]).sin_addr)));
     }
+    return 0;
 }
 
 static Code_t
@@ -872,6 +868,8 @@ realm_set_server(struct sockaddr_in *sin,
        return ZSRV_NORLM;
     realm->idx = realm_get_idx_by_addr(realm, sin);
     zdbug((LOG_DEBUG, "rlm_pick_srv: switched servers (%s)", inet_ntoa((realm->addrs[realm->idx]).sin_addr)));
+
+    return 0;
 }
 
 void
@@ -965,7 +963,7 @@ realm_sendit(ZNotice_t *notice,
     /* set a timer to retransmit */
     nacked->timer = timer_set_rel(rexmit_times[0], rlm_rexmit, nacked);
     /* chain in */
-    LIST_INSERT(&rlm_nacklist, nacked);
+    Unacked_insert(&rlm_nacklist, nacked);
     return;
 }
 
@@ -991,7 +989,6 @@ rlm_rexmit(void *arg)
     Unacked *nackpacket = (Unacked *) arg;
     Code_t retval;
     register ZRealm *realm;
-    int new_srv_idx;
 
     zdbug((LOG_DEBUG,"rlm_rexmit"));
 
@@ -1007,7 +1004,7 @@ rlm_rexmit(void *arg)
     if (nackpacket->rexmits >= (NUM_REXMIT_TIMES * realm->count)) {
        /* give a server ack that the packet is lost/realm dead */
        packet_ctl_nack(nackpacket);
-       LIST_DELETE(nackpacket);
+       Unacked_delete(nackpacket);
        
        zdbug((LOG_DEBUG, "rlm_rexmit: %s appears dead", realm->name));
        realm->state = REALM_DEAD;
@@ -1088,12 +1085,11 @@ realm_sendit_auth(ZNotice_t *notice,
                  int ack_to_sender)
 {
     char *buffer, *ptr;
-    caddr_t pack;
-    int buffer_len, hdrlen, offset, fragsize, ret_len, message_len;
+    int buffer_len, hdrlen, offset, fragsize, message_len;
     int origoffset, origlen;
     Code_t retval;
     Unacked *nacked;
-    char buf[1024], multi[64];
+    char multi[64];
     ZNotice_t partnotice, newnotice;
 
     offset = 0;
@@ -1237,7 +1233,7 @@ realm_sendit_auth(ZNotice_t *notice,
            nacked->timer = timer_set_rel(rexmit_times[0], rlm_rexmit, nacked);
 
            /* chain in */
-           LIST_INSERT(&rlm_nacklist, nacked);
+           Unacked_insert(&rlm_nacklist, nacked);
 
            offset += fragsize;
            
@@ -1286,7 +1282,7 @@ realm_sendit_auth(ZNotice_t *notice,
        /* set a timer to retransmit */
        nacked->timer = timer_set_rel(rexmit_times[0], rlm_rexmit, nacked);
        /* chain in */
-       LIST_INSERT(&rlm_nacklist, nacked);
+       Unacked_insert(&rlm_nacklist, nacked);
     }
     return 0;
 }
@@ -1342,7 +1338,6 @@ ticket_retrieve(ZRealm *realm)
     int pid;
     krb5_ccache ccache;
     krb5_error_code result; 
-    krb5_auth_context authctx; 
     krb5_creds creds_in, *creds; 
     
     get_tgt();
index 086c1d44ff14210434fc4693778ea8bfc127f5e1..924d2cacf1b0a515c3ce54d3a2b62e5af92a46e2 100644 (file)
@@ -471,7 +471,7 @@ server_timo(void *arg)
        auth = 0;
        break;
       default:
-       syslog(LOG_ERR,"Bad server state, server 0x%x\n",which);
+       syslog(LOG_ERR,"Bad server state, server 0x%x\n", (int)which);
        abort();
     }
     /* now he's either TARDY, STARTING, or DEAD
@@ -880,9 +880,9 @@ send_stats(struct sockaddr_in *who)
                                           do it this way. */
     vers = get_version();
 
-    sprintf(buf, "%d pkts", npackets);
+    sprintf(buf, "%lu pkts", npackets);
     pkts = strsave(buf);
-    sprintf(buf, "%d seconds operational",NOW - uptime);
+    sprintf(buf, "%ld seconds operational",NOW - uptime);
     upt = strsave(buf);
 
 #ifdef OLD_COMPAT
@@ -1317,7 +1317,6 @@ send_msg_list(struct sockaddr_in *who,
     char *pack;
     int packlen;
     Code_t retval;
-    Unacked *nacked;
 
     memset (&notice, 0, sizeof(notice));
 
@@ -1438,7 +1437,7 @@ server_forw_reliable(Server *server,
     nacked->uid = notice->z_uid;
     nacked->timer = timer_set_rel(rexmit_times[0], srv_rexmit, nacked);
     hashval = SRV_NACKTAB_HASHVAL(nacked->dest.srv_idx, nacked->uid);
-    LIST_INSERT(&srv_nacktab[hashval], nacked);
+    Unacked_insert(&srv_nacktab[hashval], nacked);
 }
 
 /*
@@ -1490,7 +1489,7 @@ srv_nack_cancel(ZNotice_t *notice,
            && ZCompareUID(&nacked->uid, &notice->z_uid)) {
            timer_reset(nacked->timer);
            free(nacked->packet);
-           LIST_DELETE(nacked);
+           Unacked_delete(nacked);
            free(nacked);
            return;
        }
@@ -1520,7 +1519,7 @@ srv_rexmit(void *arg)
 #if 0
        zdbug((LOG_DEBUG, "cancelling send to dead server"));
 #endif
-       LIST_DELETE(packet);
+       Unacked_delete(packet);
        free(packet->packet);
        srv_nack_release(&otherservers[packet->dest.srv_idx]);
        free(packet);
@@ -1559,7 +1558,7 @@ srv_nack_release(Server *server)
            next = nacked->next;
            if (nacked->dest.srv_idx == server - otherservers) {
                timer_reset(nacked->timer);
-               LIST_DELETE(nacked);
+               Unacked_delete(nacked);
                free(nacked->packet);
                free(nacked);
            }
index 70aa1a8b54835eab8d81975b5ed4da3ddafe5437..c67bc8956e73a24cf7e545417f13ac930fb7cd63 100644 (file)
@@ -95,10 +95,8 @@ static char **subscr_marshal_subs(ZNotice_t *notice, int auth,
 static Destlist *subscr_copy_def_subs(char *person);
 static Code_t subscr_realm_sendit(Client *who, Destlist *subs,
                                  ZNotice_t *notice, ZRealm *realm);
-static void subscr_unsub_realms(Destlist *newsubs);
 static void subscr_unsub_sendit(Client *who, Destlist *subs, 
                                ZRealm *realm);
-static int cl_match (Destlist*, Client *);
 
 static int defaults_read = 0;          /* set to 1 if the default subs
                                           are in memory */
@@ -205,7 +203,7 @@ add_subscriptions(Client *who,
              }
          } else {
              /* If realm, let the REALM_ADD_SUBSCRIBE do insertion */
-             LIST_INSERT(&who->subs, subs);
+             Destlist_insert(&who->subs, subs);
          }
        }
     }
@@ -328,7 +326,6 @@ subscr_cancel(struct sockaddr_in *sin,
     Destlist *cancel_subs, *subs, *cancel_next, *client_subs, *client_next;
     Code_t retval;
     int found = 0;
-    int relation;
 
 #if 0
     zdbug((LOG_DEBUG,"subscr_cancel"));
@@ -349,7 +346,7 @@ subscr_cancel(struct sockaddr_in *sin,
        for (client_subs = who->subs; client_subs; client_subs = client_next) {
            client_next = client_subs->next;
            if (ZDest_eq(&client_subs->dest, &subs->dest)) {
-               LIST_DELETE(client_subs);
+               Destlist_delete(client_subs);
                retval = triplet_deregister(who, &client_subs->dest, NULL);
                if (retval == ZSRV_EMPTYCLASS &&
                    client_subs->dest.recip->string[0] == '@') {
@@ -387,7 +384,6 @@ subscr_realm_cancel(struct sockaddr_in *sin,
                    ZNotice_t *notice,
                    ZRealm *realm)
 {
-    Client *who;
     Destlist *cancel_subs, *subs, *client_subs, *next, *next2;
     Code_t retval;
     int found = 0;
@@ -407,7 +403,7 @@ subscr_realm_cancel(struct sockaddr_in *sin,
         for (client_subs = realm->subs; client_subs; client_subs = next2) {
             next2 = client_subs->next;
             if (ZDest_eq(&client_subs->dest, &subs->dest)) {
-                LIST_DELETE(client_subs);
+                Destlist_delete(client_subs);
                 retval = triplet_deregister(realm->client, &client_subs->dest, realm);
                free_subscription(client_subs);
                 found = 1;
@@ -829,7 +825,7 @@ subscr_send_subs(Client *client)
     Destlist *subs;
 #ifdef HAVE_KRB5
     char buf[512];
-    char *bufp;
+    unsigned char *bufp;
 #else
 #ifdef HAVE_KRB4
     char buf[512];
@@ -1020,7 +1016,7 @@ extract_subscriptions(ZNotice_t *notice)
            sub->dest.recip = make_string("", 0);
        else
            sub->dest.recip = make_string(recip, 0);
-       LIST_INSERT(&subs, sub);
+       Destlist_insert(&subs, sub);
     }
     return subs;
 }
@@ -1035,8 +1031,6 @@ void
 subscr_dump_subs(FILE *fp,
                 Destlist *subs)
 {
-    char *p;
-
     if (!subs)                 /* no subscriptions to dump */
        return;
 
@@ -1069,7 +1063,6 @@ subscr_realm_sendit(Client *who,
   ZNotice_t snotice;
   char *pack;
   int packlen;
-  int found = 0, i;
   char **text;
   Code_t retval;
   char addr[16];          /* xxx.xxx.xxx.xxx max */
@@ -1151,7 +1144,7 @@ subscr_add_raw(Client *client,
               ZRealm *realm,
               Destlist *newsubs)
 {
-  Destlist *subs, *subs2, *subs3, **head;
+  Destlist *subs, *subs2, **head;
   Code_t retval;
 
 #if 0
@@ -1193,12 +1186,12 @@ subscr_add_raw(Client *client,
                    sub->dest.classname->string, sub->dest.inst->string, 
                    sub->dest.recip->string, remrealm->name));
 #endif
-           LIST_INSERT(&remrealm->remsubs, sub);
+           Destlist_insert(&remrealm->remsubs, sub);
          }
        }
       }
     }
-    LIST_INSERT(head, subs);
+    Destlist_insert(head, subs);
   }
   return ZERR_NONE;
 }
@@ -1231,7 +1224,6 @@ subscr_unsub_sendit(Client *who,
   char **list;
   char *pack;
   int packlen;
-  int found = 0;
   Destlist *subsp, *subsn;
 
   for (subsp = realm->remsubs; subsp; subsp = subsn) {
@@ -1242,7 +1234,7 @@ subscr_unsub_sendit(Client *who,
              subsp->dest.classname->string, subsp->dest.inst->string, 
              subsp->dest.recip->string, realm->name));
 #endif
-      LIST_DELETE(subsp);
+      Destlist_delete(subsp);
       free_subscription(subsp);
       break;
     }
@@ -1356,9 +1348,7 @@ subscr_send_realm_subs(ZRealm *realm)
 Code_t
 subscr_realm_subs(ZRealm *realm)
 {
-  int i = 0;
   Destlist *subs, *next;
-  char buf[512];
   char *text[2 + NUM_FIELDS];
   unsigned short num = 0;
   Code_t retval;
@@ -1445,7 +1435,7 @@ subscr_check_foreign_subs(ZNotice_t *notice,
                          ZRealm *realm,
                          Destlist *newsubs)
 {
-    Destlist *subs, *subs2, *next;
+    Destlist *subs, *next;
     Acl *acl;
     char **text;
     int found = 0;
@@ -1541,7 +1531,7 @@ subscr_check_foreign_subs(ZNotice_t *notice,
                return retval;
            }
        }
-       LIST_INSERT(&realm->subs, subs);
+       Destlist_insert(&realm->subs, subs);
     }
     /* don't send confirmation if we're not the initial server contacted */
     if (!(server_which_server(who) || found == 0)) {
@@ -1579,7 +1569,6 @@ Code_t subscr_foreign_user(ZNotice_t *notice,
                           ZRealm *realm)
 {
   Destlist *newsubs, *temp;
-  Acl *acl;
   Code_t status;
   Client *client;
   ZNotice_t snotice;
@@ -1595,7 +1584,7 @@ Code_t subscr_foreign_user(ZNotice_t *notice,
   
   newwho.sin_addr.s_addr = inet_addr(cp);
   if (newwho.sin_addr.s_addr == -1) {
-    syslog(LOG_ERR, "malformed addr from %s, notice->z_sender");
+    syslog(LOG_ERR, "malformed addr from %s", notice->z_sender);
     return(ZERR_NONE);
   }
 
index 11d61fed1b9f926679b9dfb7428e0d70d2d202d5..fe4b0647a27bf7be3b91835917e86add3c0088d5 100644 (file)
@@ -210,7 +210,6 @@ timer_process(void)
     Timer *t;
     timer_proc func;
     void *arg;
-    int valid = 0;
 
     if (num_timers == 0 || heap[0]->abstime > NOW)
        return;
index 85835539c1aa31a3ea0f8c6816987d8bbb97973b..57683764507dba9aaa5c36da55a8b769e0148a41 100644 (file)
@@ -102,8 +102,6 @@ static void login_sendit __P((ZNotice_t *notice, int auth,
 static char **ulogin_marshal_locs __P((ZNotice_t *notice, int *found,
                                       int auth));
 
-static int ul_equiv __P((Location *l1, Location *l2));
-
 static void free_loc __P((Location *loc));
 static void ulogin_locate_forward __P((ZNotice_t *notice,
                                       struct sockaddr_in *who, ZRealm *realm));
@@ -666,16 +664,6 @@ ulogin_find_user(char *user)
     return &locations[i];
 }
 
-static int
-ul_equiv(Location *l1, Location *l2)
-{
-    if (l1->machine != l2->machine)
-       return 0;
-    if (l1->tty != l2->tty)
-       return 0;
-    return 1;
-}
-
 /*
  * remove the user specified in notice from the internal table
  */
index 61b1c2d4fb8cc8b8d23fa04415986b7d39228990..e78ef5a1ea7d61b3771088cf223fe611491f874b 100644 (file)
@@ -54,19 +54,6 @@ Code_t ZFormatAuthenticNotice(ZNotice_t*, char*, int, int*, C_Block);
 #define KRB_INT32 ZEPHYR_INT32
 #endif
 
-/* These macros are for insertion into and deletion from a singly-linked list
- * with back pointers to the previous element's next pointer.  In order to
- * make these macros act like expressions, they use the comma operator for
- * sequenced evaluations of assignment, and "a && b" for "evaluate assignment
- * b if expression a is true". */
-#define LIST_INSERT(head, elem) \
-       ((elem)->next = *(head), \
-        (*head) && ((*(head))->prev_p = &(elem)->next), \
-        (*head) = (elem), (elem)->prev_p = (head))
-#define LIST_DELETE(elem) \
-       (*(elem)->prev_p = (elem)->next, \
-        (elem)->next && ((elem)->next->prev_p = (elem)->prev_p))
-
 /* Current time as cached by main(); use instead of time(). */
 #define NOW t_local.tv_sec
 
@@ -217,7 +204,39 @@ struct _Statistic {
 };
 
 /* Function declarations */
+
+/* These macros instantiate inline functions that do the work of the formder
+   LIST_INSERT and LIST_DELETE functions, which unfortunately triggered gcc's
+   pedanticism.  The comment before the *former* macros was: */
+/* These macros are for insertion into and deletion from a singly-linked list
+ * with back pointers to the previous element's next pointer.  In order to
+ * make these macros act like expressions, they use the comma operator for
+ * sequenced evaluations of assignment, and "a && b" for "evaluate assignment
+ * b if expression a is true". */
+
+#define MAKE_LIST_INSERT(type) inline static void type##_insert(type **head, type *elem) \
+    {\
+       (elem)->next = *(head);                                 \
+       if(*head) (*(head))->prev_p = &(elem)->next;            \
+       (*head) = (elem);                                       \
+       (elem)->prev_p = (head);                                \
+    }
        
+#define MAKE_LIST_DELETE(type) inline static void type##_delete(type *elem) \
+    {\
+       *(elem)->prev_p = (elem)->next;                         \
+       if((elem)->next) (elem)->next->prev_p = (elem)->prev_p; \
+    }
+
+MAKE_LIST_INSERT(Destlist);
+MAKE_LIST_DELETE(Destlist);
+MAKE_LIST_INSERT(Client);      
+MAKE_LIST_DELETE(Client);      
+MAKE_LIST_INSERT(Triplet);     
+MAKE_LIST_DELETE(Triplet);     
+MAKE_LIST_INSERT(Unacked);
+MAKE_LIST_DELETE(Unacked);
+
 /* found in bdump.c */
 void bdump_get(ZNotice_t *notice, int auth, struct sockaddr_in *who,
                    Server *server);
@@ -277,23 +296,14 @@ void hostm_shutdown(void);
 /* found in kstuff.c */
 #ifdef HAVE_KRB4
 int GetKerberosData (int, struct in_addr, AUTH_DAT *, char *, char *);
+Code_t ReadKerberosData(int, int *, char **, int *);
 Code_t SendKerberosData (int, KTEXT, char *, char *);
+Code_t SendKrb5Data(int, krb5_data *);
+Code_t GetKrb5Data(int, krb5_data *);
 void sweep_ticket_hash_table(void *);
+Code_t ZCheckRealmAuthentication(ZNotice_t *, struct sockaddr_in *, char *);
 #endif
-
-/* found in kopt.c */
-#ifdef HAVE_KRB4
-#ifndef NOENCRYPTION
-Sched *check_key_sched_cache(des_cblock key);
-void add_to_key_sched_cache(des_cblock key, Sched *sched);
-/*int krb_set_key(void *key, int cvt);*/
-/* int krb_rd_req(KTEXT authent, char *service, char *instance,
-                   unsigned KRB_INT32 from_addr, AUTH_DAT *ad, char *fn); */
-int krb_find_ticket(KTEXT authent, KTEXT ticket);
-int krb_get_lrealm(char *r, int n);
-#endif
-#endif
-
+    
 /* found in server.c */
 void server_timo(void *which);
 void server_dump_servers(FILE *fp);
@@ -324,6 +334,9 @@ void subscr_sendlist(ZNotice_t *notice, int auth,
 void subscr_dump_subs(FILE *fp, Destlist *subs);
 void subscr_reset(void);
 Code_t subscr_def_subs(Client *who);
+Code_t subscr_realm(ZRealm *, ZNotice_t *);
+Code_t subscr_send_realm_subs(ZRealm *);
+Code_t subscr_realm_cancel(struct sockaddr_in *, ZNotice_t *, ZRealm *);
 
 /* found in uloc.c */
 void uloc_hflush(struct in_addr *addr);
@@ -334,6 +347,8 @@ Code_t ulogin_dispatch(ZNotice_t *notice, int auth,
 Code_t ulocate_dispatch(ZNotice_t *notice, int auth,
                             struct sockaddr_in *who, Server *server);
 Code_t uloc_send_locations(void);
+void ulogin_relay_locate(ZNotice_t *, struct sockaddr_in *);
+void ulogin_realm_locate(ZNotice_t *, struct sockaddr_in *, ZRealm *);
 
 /* found in realm.c */
 int realm_sender_in_realm(char *realm, char *sender);
@@ -350,10 +365,18 @@ Code_t realm_control_dispatch(ZNotice_t *, int, struct sockaddr_in *,
                                   Server *, ZRealm *);
 void realm_shutdown(void);
 void realm_deathgram(Server *);
+Code_t realm_send_realms(void);
+Code_t realm_dispatch(ZNotice_t *, int, struct sockaddr_in *, Server *);
+void realm_wakeup(void);
+void kill_realm_pids(void);
+void realm_dump_realms(FILE *);
 
 /* found in version.c */
 char *get_version(void);
 
+/* found in access.c */
+int access_check(char *, Acl *, Access);
+
 /* global identifiers */
 
 /* found in main.c */
index 27e7ca2343a0f58b72560a9a1f949b5fec3a67f7..b028f7cc754d92944cd936eab9df818a4fd3b53c 100644 (file)
@@ -14,7 +14,7 @@
 
 #ifndef lint
 #ifndef SABER
-static char rcsid_queue_c[] = "$Id$";
+static const char rcsid_queue_c[] = "$Id$";
 #endif /* SABER */
 #endif /* lint */
 
@@ -31,9 +31,10 @@ static Queue *hm_queue;
 static int retransmits_enabled = 0;
 
 static Queue *find_notice_in_queue(ZNotice_t *notice);
-static Code_t dump_queue(void);
 static void queue_timeout(void *arg);
 
+extern void new_server(char *);
+
 int rexmit_times[] = { 2, 2, 4, 4, 8, -1 };
 
 #ifdef DEBUG
@@ -82,7 +83,13 @@ add_notice_to_queue(ZNotice_t *notice,
            free(entry->packet);
        } else {
            entry->reply = *repl;
-           LIST_INSERT(&hm_queue, entry);
+           /*LIST_INSERT(&hm_queue, entry);*/
+
+           (entry)->next = *(&hm_queue);
+           if (*&hm_queue) ((*(&hm_queue))->prev_p = &(entry)->next);
+           (*&hm_queue) = (entry);
+           (entry)->prev_p = (&hm_queue);
+               
        }
        entry->timer = (retransmits_enabled) ?
            timer_set_rel(rexmit_times[0], queue_timeout, entry) : NULL;
@@ -107,7 +114,9 @@ remove_notice_from_queue(ZNotice_t *notice,
     if (entry->timer)
        timer_reset(entry->timer);
     free(entry->packet);
-    LIST_DELETE(entry);
+    /*LIST_DELETE(entry);*/
+    *(entry)->prev_p = (entry)->next;
+    if((entry)->next) ((entry)->next->prev_p = (entry)->prev_p);
 #ifdef DEBUG
     dump_queue();
 #endif /* DEBUG */
index 82c02aa7fba0ef0bdb33e75fef3cfaaad2d04fe4..4fb764eb0817fbef10d2b37921414d9974f708de 100644 (file)
@@ -211,7 +211,6 @@ timer_process(void)
     Timer *t;
     timer_proc func;
     void *arg;
-    int valid = 0;
 
     if (num_timers == 0 || heap[0]->abstime > time(NULL))
        return;
index f6f3fc172a3883ac2ac5cf476ab5f1814875a7c4..8e1303d08481c9550485c9c876f79e48fbe145e1 100644 (file)
@@ -49,6 +49,11 @@ static void init_hm(void);
 static void detach(void);
 static void send_stats(ZNotice_t *, struct sockaddr_in *);
 static char *strsave(const char *);
+
+extern void send_flush_notice(char *);
+extern void server_manager(ZNotice_t *);
+extern void send_boot_notice(char *);
+extern void find_next_server(char *);
 extern int optind;
 
 static RETSIGTYPE
@@ -70,7 +75,7 @@ main(int argc,
     ZNotice_t notice;
     ZPacket_t packet;
     Code_t ret;
-    int opt, pak_len, i, j = 0, fd, count;
+    int opt, pak_len, fd, count;
     fd_set readers;
     struct timeval tv;
 
@@ -465,8 +470,9 @@ detach(void)
      /* detach from terminal and fork. */
      register int i, x = ZGetFD();
      register long size;
-  
-     if (i = fork()) {
+
+     i = fork();
+     if (i) {
          if (i < 0)
               perror("fork");
          exit(0);
index 3d6f1532daedf57147a1ed76cf473b32e5c1ad8a..c93009855426cf19d1b0c95c912bd1749a70013d 100644 (file)
@@ -16,6 +16,8 @@
 #include <zephyr/mit-copyright.h>
 #include <internal.h>
 #include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
 #include <sys/time.h>
 #include "timer.h"
 
index 03514c66ed4f0e3c188116a3bc213a4f10d66a0d..0c5b68efd505a0a26dd8c1d8af1d469e9fa46910 100644 (file)
 
 #ifndef lint
 #ifndef SABER
-static char rcsid_hm_client_c[] = "$Id$";
+static const char rcsid_hm_client_c[] = "$Id$";
 #endif /* SABER */
 #endif /* lint */
 
 extern int no_server, nclt, deactivated, noflushflag;
 extern struct sockaddr_in cli_sin, serv_sin, from;
 
+extern void send_flush_notice(char *);
+extern void new_server(char *sugg_serv);
+
 void transmission_tower(ZNotice_t *notice,
                        char *packet,
                        int pak_len)
index 47b2d5933968c3f1c8a629e5e7606ddbe8775efe..9d8157fa810a30569de3b62e3bc03ab1dbca94a9 100644 (file)
@@ -14,7 +14,7 @@
 
 #ifndef lint
 #ifndef SABER
-static char rcsid_hm_server_c[] = "$Id$";
+static const char rcsid_hm_server_c[] = "$Id$";
 #endif /* SABER */
 #endif /* lint */
 
index 2577966595fd25520f669c07fde76a9e3f84dc20..e969eb742b2354e28d4d83f91f1fa875a0a3bc99 100644 (file)
@@ -38,6 +38,7 @@ static const char rcsid_X_driver_c[] = "$Id$";
 #include "X_gram.h"
 #include "xselect.h"
 #include "unsigned_long_dictionary.h"
+#include "zephyr.h"
 
 char *app_instance;
 
@@ -294,7 +295,8 @@ open_display_and_load_resources(int *pargc,
     /*
      * Get XENVIRONMENT resources, if they exist, and merge
      */
-    if (filename = getenv("XENVIRONMENT"))
+    filename = getenv("XENVIRONMENT");
+    if (filename)
     {
        temp_db3 = XrmGetFileDatabase(filename);
        XrmMergeDatabases(temp_db3, &temp_db1);
@@ -354,9 +356,11 @@ X_driver_init(char *drivername,
     /*
      * For now, set some useful variables using resources:
      */
-    if (sync=get_bool_resource("synchronous", "Synchronous", 0))
-      XSynchronize(dpy,sync);
-    if (temp = get_string_resource("geometry", "Geometry"))
+    sync = get_bool_resource("synchronous", "Synchronous", 0);
+    if (sync)
+      XSynchronize(dpy, sync);
+    temp = get_string_resource("geometry", "Geometry");
+    if (temp)
       var_set_variable("default_X_geometry", temp);
 
     temp=strrchr(argv[0],'/');
index 95e21d510cc1ab2bfc1cf78e56fd0527f19683f9..0d8e2b79ee84b8bbdabe3e76d97b6ec3a0e1ac10 100644 (file)
@@ -231,9 +231,9 @@ complete_get_fontst(Display *dpy,
    char *family,*fontname;
    XFontStruct *fontst;
 
-   if (family=get_family(style,substyle))
-     if (fontname=get_fontname(family,size,face))
-       if (fontst=get_fontst(dpy,fontname))
+   if ((family=get_family(style,substyle)))
+     if ((fontname=get_fontname(family,size,face)))
+       if ((fontst=get_fontst(dpy,fontname)))
         return(fontst);
    /* If any part fails, */
    return(NULL);
@@ -259,16 +259,16 @@ get_font(Display *dpy,
 
    if (size == SPECIAL_SIZE) {
       /* attempt to process @font explicitly */
-      if (fontst=get_fontst(dpy,substyle))
+      if ((fontst = get_fontst(dpy, substyle)))
        return(fontst);
    } else {
-      if (family=get_family(style,substyle)) {
-        if (fontname=get_fontname(family,size,face))
-          if (fontst=get_fontst(dpy,fontname))
+      if ((family = get_family(style, substyle))) {
+        if ((fontname = get_fontname(family, size,face)))
+          if ((fontst = get_fontst(dpy, fontname)))
             return(fontst);
       } else {
-        if (fontname=get_fontname(substyle,size,face))
-          if (fontst=get_fontst(dpy,fontname))
+        if ((fontname = get_fontname(substyle, size, face)))
+          if ((fontst = get_fontst(dpy, fontname)))
             return(fontst);
       }
 
@@ -276,17 +276,17 @@ get_font(Display *dpy,
       of substyle being the fontfamily didn't happen, either. */
 
       fontst=NULL;
-      if (!(fontst=complete_get_fontst(dpy,style,"text",size,face)))
-       if (!(fontst=complete_get_fontst(dpy,"default",substyle,size,face)))
-         if (!(fontst=complete_get_fontst(dpy,"default","text",size,face)))
-           if (fontname=get_fontname("default",size,face))
-             fontst=get_fontst(dpy,fontname);
+      if (!(fontst = complete_get_fontst(dpy,style,"text",size,face)))
+       if (!(fontst = complete_get_fontst(dpy,"default",substyle,size,face)))
+         if (!(fontst = complete_get_fontst(dpy,"default","text",size,face)))
+           if ((fontname = get_fontname("default",size,face)))
+             fontst = get_fontst(dpy,fontname);
       if (fontst) return(fontst);
    }
 
    /* If all else fails, try fixed */
 
-   if (fontst=get_fontst(dpy,"fixed")) return(fontst);
+   if ((fontst=get_fontst(dpy,"fixed"))) return(fontst);
 
    /* No fonts available.  Die. */
 
index 96e8fb1c508f1c1ab59a4d5063c127773e70e57d..6ce4297b748f34c467b965d5e98aaa5bdbdf0935 100644 (file)
@@ -127,15 +127,18 @@ x_gram_init(Display *dpy)
        default_fgcolor = default_bgcolor;
        default_bgcolor = tc;
     }
-    if (temp = get_string_resource("foreground","Foreground"))
-      default_fgcolor = x_string_to_color(temp,default_fgcolor);
-    if (temp = get_string_resource("background","Background"))
-      default_bgcolor = x_string_to_color(temp,default_bgcolor);
+    temp = get_string_resource("foreground", "Foreground");
+    if (temp)
+      default_fgcolor = x_string_to_color(temp, default_fgcolor);
+    temp = get_string_resource("background", "Background");
+    if (temp)
+      default_bgcolor = x_string_to_color(temp, default_bgcolor);
     default_bordercolor = default_fgcolor;
-    if (temp = get_string_resource("borderColor","BorderColor"))
-      default_bordercolor = x_string_to_color(temp,default_bordercolor);
+    temp = get_string_resource("borderColor", "BorderColor");
+    if (temp)
+      default_bordercolor = x_string_to_color(temp, default_bordercolor);
 
-    temp = get_string_resource("minTimeToLive","MinTimeToLive");
+    temp = get_string_resource("minTimeToLive", "MinTimeToLive");
     if (temp && atoi(temp)>=0)
        ttl = atoi(temp);
 
@@ -302,15 +305,15 @@ x_gram_create(Display *dpy,
       xpos = WidthOfScreen(DefaultScreenOfDisplay(dpy)) - xpos - xsize
        - 2*border_width;
     else if (xalign == 0)
-      xpos = (WidthOfScreen(DefaultScreenOfDisplay(dpy)) - xsize
-             - 2*border_width)>>1 + xpos;
+      xpos = ((WidthOfScreen(DefaultScreenOfDisplay(dpy)) - xsize
+              - 2*border_width)>>1) + xpos;
 
     if (yalign<0)
       ypos = HeightOfScreen(DefaultScreenOfDisplay(dpy)) - ypos - ysize
        - 2*border_width;
     else if (yalign == 0)
-      ypos = (HeightOfScreen(DefaultScreenOfDisplay(dpy)) - ysize
-             - 2*border_width)>>1 + ypos;
+      ypos = ((HeightOfScreen(DefaultScreenOfDisplay(dpy)) - ysize
+              - 2*border_width)>>1) + ypos;
 
     /*
      * Create the window:
index 5d3f5d02aefe1ac96ccb54fc29d0d6838e93b747..ed1adf725aee3e200c92fd1b23d127c015e306c3 100644 (file)
@@ -82,5 +82,6 @@ extern void x_gram_expose(Display *, Window, x_gram *, XExposeEvent *);
 extern void xshow(Display *, desctype *, int, int);
 extern void xcut(Display *, XEvent *, XContext);
 extern void x_get_input(Display *);
+extern void xshowinit(void);
 
 #endif
index a11aa86effc992ce3529e7f59a5c72d43971de6f..2f3c433d4ca113c9febd9b217ee9681757b6210d 100644 (file)
@@ -37,7 +37,7 @@ string_to_character_class(string str)
     (void) memset(cache, 0, sizeof(cache));
 
     for (i=0; i<strlen(str); i++)
-      cache[str[i]] = 1;
+       cache[(int)str[i]] = 1;
 
     return(cache);
 }
index b3ba8fadfa10a06efe5b2502db8ced97d9807eed..b448e5cfa787d910e37a3ef528eb514d3025e1d1 100644 (file)
@@ -43,7 +43,8 @@ char *get_home_directory(void)
     char *result;
     struct passwd *passwd_entry;
 
-    if (result = getenv("HOME"))
+    result = getenv("HOME");
+    if (result)
       return(result);
 
     if (!(passwd_entry = getpwuid(getuid())))
@@ -80,7 +81,8 @@ FILE *locate_file(char *override_filename,
     }
 
     if (home_dir_filename) {
-       if (filename = get_home_directory()) {
+       filename = get_home_directory();
+       if (filename) {
            filename = string_Concat(filename, "/");
            filename = string_Concat2(filename, home_dir_filename);
            result = fopen(filename, "r");
index 923268e5d6d0a95662b6606840716008c0a511c0..f5d3c876f617aecba84bda7419e6f596709f87a0 100644 (file)
@@ -176,7 +176,7 @@ static int
 not_contains(string str,
             const character_class set)
 {
-   while (*str && ! set[*str]) str++;
+   while (*str && ! set[(int)*str]) str++;
    return (! *str);
 }
 
@@ -223,6 +223,7 @@ otherside(char opener)
 #ifdef DEBUG
    abort();
 #endif
+   return 0;
 }
 
 /* the char * that str points to is free'd by this function.
@@ -328,7 +329,7 @@ protect(string str)
         temp[templen-2] = *str++;
         char_stack_pop(chs);
         temp[templen-1] = '\0';
-      } else if (len = pure_text_length(str,tos)) {
+      } else if ((len = pure_text_length(str,tos))) {
         if (tos) {
            /* if the block is text in an environment, just copy it */
 
@@ -509,8 +510,8 @@ disp_get_cmds(char *str,
         terminator = char_stack_top(terminators);
         char_stack_pop(terminators);
         curstr++;
-      } else if (len=text_length(curstr,terminator)) { /* if there is a text
-                                                         block here */
+      } else if ((len=text_length(curstr, terminator))) { /* if there is a text
+                                                            block here */
         here->code=DT_STR;
         here->str=curstr;
         here->len=len;
index 7e3208609d84d6418b7e7787d77e37af70a984da..e821eb9eb5a224249c51def7354662be1f878be6 100644 (file)
@@ -470,7 +470,8 @@ handle_show(void)
     if (c!='\n')
       unput(c);
 
-    if (yylval.text = eat_til_endshow(start_line_no))
+    yylval.text = eat_til_endshow(start_line_no);
+    if (yylval.text)
       return(SHOW);
     else
       return(ERROR);
@@ -656,7 +657,8 @@ int yylex(void)
             * Handle constant strings:
             */
          case '"':
-           if (yylval.text = eat_string(yylineno))
+           yylval.text = eat_string(yylineno);
+           if (yylval.text)
              return(STRING);
            else
              return(ERROR);
index 3568443a9784ca4df30214eed462e609a008c635..8584eca7b172f74c92ed4566acb7f8e6f51acb87 100644 (file)
@@ -114,6 +114,7 @@ fake_startup_packet(void)
     ZNotice_t notice;
     struct timezone tz;
     char msgbuf[BUFSIZ];
+    extern void Z_gettimeofday(struct _ZTimeval *, struct timezone *);
 
     var_set_variable("version", zwgc_version_string);
 
@@ -371,7 +372,8 @@ process_notice(ZNotice_t *notice,
 
     dprintf("Got a message\n");
 
-    if (control_opcode = decode_notice(notice, hostname)) {
+    control_opcode = decode_notice(notice, hostname);
+    if (control_opcode) {
 #ifdef DEBUG
        printf("got control opcode <%s>.\n", control_opcode);
 #endif
@@ -548,6 +550,7 @@ detach(void)
    * of finding the session leader; otherwise use the process group of
    * the parent process, which is a good guess. */
 #if defined(HAVE_GETSID)
+
   setpgid(0, getsid(0));
 #elif defined(HAVE_GETPGID)
   setpgid(0, getpgid(getppid()));
@@ -556,7 +559,8 @@ detach(void)
 #endif
 
   /* fork off and let parent exit... */
-  if (i = fork()) {
+  i = fork();
+  if (i) {
       if (i < 0) {
          perror("zwgc: cannot fork, aborting:");
          exit(1);
index 55d6274f7feb057c9a5a140824c05810f6ce2995..3d73a696477bb50cf74e847bc1fa0acc97000b34 100644 (file)
@@ -105,7 +105,8 @@ port_close_input(port *p)
     if (!close_input_proc)
       return;
 
-    if (error = close_input_proc(p))
+    error = close_input_proc(p);
+    if (error)
       var_set_variable("error", error);
 }
 
@@ -123,7 +124,8 @@ port_close_output(port *p)
     if (!close_output_proc)
       return;
 
-    if (error = close_output_proc(p))
+    error = close_output_proc(p);
+    if (error)
       var_set_variable("error", error);
 }
 
index f679f4e4d5f81d7246b29801b1da99ce8cda2cee..1c6d1ce93f70be2e969b52c40da7c23e32f5ce10 100644 (file)
@@ -208,21 +208,25 @@ void init_standard_ports(int *pargc,
             current++; *pargc -= 2;
             if (!*current)
               usage();
-            if (p = get_standard_port_info((string) *current))
+           p = get_standard_port_info((string) *current);
+            if (p)
                p->port_setup_status = DISABLED;
         } else if (string_Eq((string) *current, "-default")) {
             current++; *pargc -= 2;
             if (!*current)
               usage();
             default_port = (string) *current;
-            if (p = get_standard_port_info((string) *current))
+           p = get_standard_port_info((string) *current);
+            if (p)
                p->port_setup_status = DEFAULT_OK;
         } else if (string_Eq((string) *current, "-ttymode")) {
            default_port = (string) "tty";
            (*pargc)--;
-            if (p = get_standard_port_info(default_port)) {
+           p = get_standard_port_info(default_port);
+            if (p) {
                p->port_setup_status = DEFAULT_OK;
-               if (p = get_standard_port_info ((string) "X"))
+               p = get_standard_port_info ((string) "X");
+               if (p)
                    p->port_setup_status = DISABLED;
            }
        } else
index daee49ca29c4cc8f37bc91da2de74af3aaa6c8ee..5dfd89d366a27c4a8cd88cf1f655edb09f186f27 100644 (file)
@@ -12,7 +12,7 @@
  */
 
 #if (!defined(lint) && !defined(SABER))
-static char rcsid_string_dictionary_aux_c[] = "$Id$";
+static const char rcsid_string_dictionary_aux_c[] = "$Id$";
 #endif
 
 /*
index cfe932e151426e54dcad0db1576532c7a36b6e72..5123d5f7b8991040e8ad1144703d322b19df4e48 100644 (file)
@@ -12,7 +12,7 @@
  */
 
 #if (!defined(lint) && !defined(SABER))
-static char rcsid_subscriptions_c[] = "$Id$";
+static const char rcsid_subscriptions_c[] = "$Id$";
 #endif
 
 /****************************************************************************/
@@ -271,8 +271,9 @@ load_subscriptions_from_file(FILE *file)
            /* Parse line */
            /* <<<>>>
             * The below does NOT work is the recipient field  is "":
-            */ 
-           if (temp = strchr(line, '#'))
+            */
+           temp = strchr(line, '#');
+           if (temp)
              *temp = '\0';
            for (temp=line; *temp && *temp==' '; temp++) ;
            if (!*temp || *temp=='\n')
index d50614ce7fce97c47a76595bff4e3029de8e28a2..26accc1772192da6a54804a2df1f020e263ff35f 100644 (file)
@@ -12,7 +12,7 @@
  */
 
 #if (!defined(lint) && !defined(SABER))
-static char rcsid_substitute_c[] = "$Id$";
+static const char rcsid_substitute_c[] = "$Id$";
 #endif
 
 #include <zephyr/mit-copyright.h>
index 34f0d4cb230f6abe31e79401eaf9e0388279f4eb..16d9047a7a02a046e0399260d38d1fc94cf1a03b 100644 (file)
@@ -47,7 +47,7 @@ lbreak(string *text_ptr,
     string result, whats_left;
     char *p = *text_ptr;
 
-    while (*p && !set[*p]) p++;
+    while (*p && !set[(int)*p]) p++;
 
     result = string_CreateFromData(*text_ptr, p - *text_ptr);
     whats_left = string_Copy(p);
@@ -64,7 +64,7 @@ lspan(string *text_ptr,
     string result, whats_left;
     char *p = *text_ptr;
 
-    while (*p && set[*p]) p++;
+    while (*p && set[(int)*p]) p++;
 
     result = string_CreateFromData(*text_ptr, p - *text_ptr);
     whats_left = string_Copy(p);
@@ -100,7 +100,7 @@ rbreak(string *text_ptr,
     string text = *text_ptr;
     char *p = text + strlen(text);
 
-    while (text<p && !set[p[-1]]) p--;
+    while (text<p && !set[(int)p[-1]]) p--;
 
     result = string_Copy(p);
     whats_left = string_CreateFromData(text, p - text);
@@ -118,7 +118,7 @@ rspan(string *text_ptr,
     string text = *text_ptr;
     char *p = text + strlen(text);
 
-    while (text<p && set[p[-1]]) p--;
+    while (text<p && set[(int)p[-1]]) p--;
 
     result = string_Copy(p);
     whats_left = string_CreateFromData(text, p - text);
index e1cfe9877c741c55cd19660dbb9237bd2dd72f6a..97905e35ac838573451e3fd0a7e388fe3f77081d 100644 (file)
@@ -26,6 +26,10 @@ static const char rcsid_tty_filter_c[] = "$Id$";
 /****************************************************************************/
 #ifdef HAVE_TERMCAP_H
 #include <termcap.h>
+#else
+#ifdef HAVE_TERM_H
+#include <term.h>
+#endif
 #endif
 
 #include "new_memory.h"
@@ -138,59 +142,65 @@ tty_filter_init(char *drivername,
 
        tmp = tgetstr("pc", &p);
        PC = (tmp) ? *tmp : 0;
-       if (tmp = tgetstr("md",&p)) {   /* bold ? */
+       tmp = tgetstr("md", &p);
+       if (tmp) {      /* bold ? */
            EXPAND("B.bold");
            tmp = tgetstr("me",&p);
            EXPAND("E.bold");
        }
-       if (tmp = tgetstr("mr",&p)) {   /* reverse video? */
+       tmp = tgetstr("mr", &p);
+       if (tmp) {      /* reverse video? */
            EXPAND("B.rw");
-           tmp = tgetstr("me",&p);
+           tmp = tgetstr("me", &p);
            EXPAND("E.rw");
        }
-       if (tmp = tgetstr("bl",&p)) {   /* Bell ? */
+       tmp = tgetstr("bl", &p);
+       if (tmp) {      /* Bell ? */
            EXPAND("B.bell");
            TD_SET("E.bell", NULL);
        }
-       if (tmp = tgetstr("mb",&p)) {   /* Blink ? */
+       tmp = tgetstr("mb", &p);
+       if (tmp) {      /* Blink ? */
            EXPAND("B.blink");
-           tmp = tgetstr("me",&p);
+           tmp = tgetstr("me", &p);
            EXPAND("E.blink");
        }
-       if (tmp = tgetstr("us",&p))     { /* Underline ? */
+       tmp = tgetstr("us", &p);
+       if (tmp) {      /* Underline ? */
            EXPAND("B.u");
-           tmp = tgetstr("ue",&p);
+           tmp = tgetstr("ue", &p);
            EXPAND("E.u");
        }
-       if (tmp = tgetstr("so",&p))     { /* Standout ? */
+       tmp = tgetstr("so", &p);
+       if (tmp) {      /* Standout ? */
            EXPAND("B.so");
-           tmp = tgetstr("se",&p);
+           tmp = tgetstr("se", &p);
            EXPAND("E.so");
        }
     }    
     /* Step 2: alias others to the nearest substitute */
     
     /* Bold = so, else rv, else ul */
-    if (NULL == string_dictionary_Lookup(termcap_dict,"B.bold")) {
-       if(b = string_dictionary_Lookup(termcap_dict,"B.so")) {
-           TD_SET("B.bold",b->value);
+    if (NULL == string_dictionary_Lookup(termcap_dict, "B.bold")) {
+       if((b = string_dictionary_Lookup(termcap_dict, "B.so"))) {
+           TD_SET("B.bold", b->value);
            TD_SET("E.bold",
-                  string_dictionary_Lookup(termcap_dict,"E.so")->value);
-       } else if (b = string_dictionary_Lookup(termcap_dict,"B.rv")) {
-           TD_SET("B.bold",b->value);
+                  string_dictionary_Lookup(termcap_dict, "E.so")->value);
+       } else if ((b = string_dictionary_Lookup(termcap_dict, "B.rv"))) {
+           TD_SET("B.bold", b->value);
            TD_SET("E.bold",
-                  string_dictionary_Lookup(termcap_dict,"E.rv")->value);
-       } else if (b = string_dictionary_Lookup(termcap_dict,"B.u")) {
-           TD_SET("B.bold",b->value);
+                  string_dictionary_Lookup(termcap_dict, "E.rv")->value);
+       } else if ((b = string_dictionary_Lookup(termcap_dict,"B.u"))) {
+           TD_SET("B.bold", b->value);
            TD_SET("E.bold",
-                  string_dictionary_Lookup(termcap_dict,"E.u")->value);
+                  string_dictionary_Lookup(termcap_dict, "E.u")->value);
        }
     }
     
     /* Bell = ^G */
-    if (NULL == string_dictionary_Lookup(termcap_dict,"B.bell")) {
-       TD_SET("B.bell","\007");
-       TD_SET("E.bell",NULL);
+    if (NULL == string_dictionary_Lookup(termcap_dict, "B.bell")) {
+       TD_SET("B.bell", "\007");
+       TD_SET("E.bell", NULL);
     }
     
     /* Underline -> nothing */
@@ -486,10 +496,12 @@ tty_filter(string text,
            item = string_Copy("");
            
            if (info->bold_p && use_fonts) {
-               if (temp = string_dictionary_Fetch(termcap_dict, "B.bold"))
+               temp = string_dictionary_Fetch(termcap_dict, "B.bold");
+               if (temp)
                  item = string_Concat2(item, temp);
            } else if (info->italic_p && use_fonts) {
-               if (temp = string_dictionary_Fetch(termcap_dict, "B.u"))
+               temp = string_dictionary_Fetch(termcap_dict, "B.u");
+               if (temp)
                  item = string_Concat2(item, temp);
            }
            temp = string_CreateFromData(info->str, info->len);
@@ -497,10 +509,12 @@ tty_filter(string text,
            free(temp);
 
            if (info->bold_p && use_fonts) {
-               if (temp = string_dictionary_Fetch(termcap_dict, "E.bold"))
+               temp = string_dictionary_Fetch(termcap_dict, "E.bold");
+               if (temp)
                  item = string_Concat2(item, temp);
            } else if (info->italic_p && use_fonts) {
-               if (temp = string_dictionary_Fetch(termcap_dict, "E.u"))
+               temp = string_dictionary_Fetch(termcap_dict, "E.u");
+               if (temp)
                  item = string_Concat2(item, temp);
            }
 
index a444b440a2e9f6d1f9e3d3ae2e78070a68563988..3368c1fda41bbc6ad77a4edddccf189e67d743db 100644 (file)
@@ -113,7 +113,8 @@ var_get_variable(string name)
     static string last_get_field_call_result = NULL;
 
     if (is_number_variable(name)) {
-       if (result = string_dictionary_Fetch(number_variable_dict, name))
+       result = string_dictionary_Fetch(number_variable_dict, name);
+       if (result)
          return(result);
 
        /*
index b6019a96191c68d9eafbea8c59bbdf4dcefa1a7e..4fad2a71fa74bc32a992afa417033c3f3d25718a 100644 (file)
@@ -37,6 +37,7 @@ static const char rcsid_xcut_c[] = "$Id$";
 #include "xmark.h"
 #include "error.h"
 #include "xrevstack.h"
+#include "X_driver.h"
 
 /*
  *
index 7285834fa1bee065652d92897434e68d2f27a870..6a6a7a077ce28e09a21b0ff1c2c3c33088a9aec4 100644 (file)
@@ -12,7 +12,7 @@
  */
 
 #if (!defined(lint) && !defined(SABER))
-static char rcsid_xmark_c[] = "$Id$";
+static const char rcsid_xmark_c[] = "$Id$";
 #endif
 
 #include <zephyr/mit-copyright.h>
index 0976821611c6128ce457f4558d75f52d9f342766..20d1fe9435dea51967f33e8941a937fe336c5d67 100644 (file)
@@ -15,7 +15,7 @@
 #define _XREVSTACK_H_
 
 #if (!defined(lint) && !defined(SABER))
-static char rcsid_xrevstack_h[] = "$Id$";
+static const char rcsid_xrevstack_h[] = "$Id$";
 #endif
 
 #include <zephyr/mit-copyright.h>
index 2579dc4af34c353eb788d7e551e4cd2a6f06f0cf..2192182cf5580447a83c87a269a8a1f57c81b467 100644 (file)
@@ -118,7 +118,8 @@ xselSetProperties(Display *dpy,
    } else if (target==XA_STRING) {
       char *selected;
 
-      if (selected = getSelectedText()) {
+      selected = getSelectedText();
+      if (selected) {
         ChangeProp(XA_STRING,8,selected,string_Length(selected));
       } else {
         /* This should only happen if the pasting client is out of
@@ -179,8 +180,8 @@ xselProcessSelection(Display *dpy,
 #endif
 
    if ((ownership_start == CurrentTime) ||
-       ((selreq->time != CurrentTime) &&
-       (selreq->time < ownership_start) ||
+       (((selreq->time != CurrentTime) &&
+        (selreq->time < ownership_start)) ||
        ((ownership_end != CurrentTime) &&
         (ownership_end > ownership_start) &&
         (selreq->time > ownership_end))))
index 68c64eb7eb21d3c7a59ebb13f6203dd029fdd057..666701336082d94d94c8db976ea12b32e71c5375 100644 (file)
@@ -38,7 +38,6 @@ static const char rcsid_xshow_c[] = "$Id$";
 #define max(a,b)   ((a)>(b)?(a):(b))
 
 XContext desc_context;
-static pointer_dictionary colorname_dict = NULL;
 
 extern int internal_border_width;
 extern unsigned long default_bgcolor;
index e1497d455ca4dcb3f230c10bd01849c3a059b007..f672d849ae5ef51930fee40583104385eb9ef5f2 100644 (file)
@@ -64,7 +64,8 @@ get_zwgc_port_number_filename(void)
     static char buffer[40];
     char *temp;
 
-    if (temp = getenv("WGFILE"))
+    temp = getenv("WGFILE");
+    if (temp)
       return(temp);
     else {
        sprintf(buffer, "/tmp/wg.%d", getuid());
@@ -170,7 +171,8 @@ void zephyr_init(void (*notice_handler)(ZNotice_t *))
      * not one of the allowed ones, print an error and treat it as
      * EXPOSE_NONE.
      */
-    if (temp = ZGetVariable("exposure")) {
+    temp = ZGetVariable("exposure");
+    if (temp) {
        if (!(exposure = ZParseExposureLevel(temp))) {
            ERROR2("invalid exposure level %s, using exposure level none instead.\n", temp);
            exposure = EXPOSE_NONE;
index e821bfd9b3ebb2d4bf0de2c6f44cb13b529bf11e..1e714a3d4f05646fa12acdae3f3bcfcfdcc9618b 100644 (file)
@@ -17,6 +17,8 @@
 #ifndef zephyr_MODULE
 #define zephyr_MODULE
 
+#include <zephyr/zephyr.h>
+
 extern void zephyr_init(void(*)(ZNotice_t *));
 extern void finalize_zephyr(void);
 extern void write_wgfile(void);