]> andersk Git - moira.git/commitdiff
POSIX, ANSI, sanity fixes
authordanw <danw>
Wed, 29 Jan 1997 23:24:06 +0000 (23:24 +0000)
committerdanw <danw>
Wed, 29 Jan 1997 23:24:06 +0000 (23:24 +0000)
s/#endif lint/#endif/ for irix cc
#include <crypt.h> in idno.c for OSes that don't have crypt in stdlib
64-bit OS fixes in mr_param.c
fill in missing return values in sq.c

19 files changed:
lib/Imakefile
lib/critical.c
lib/fixhost.c
lib/fixname.c
lib/hash.c
lib/idno.c
lib/mr_access.c
lib/mr_auth.c
lib/mr_call.c
lib/mr_connect.c
lib/mr_data.c
lib/mr_init.c
lib/mr_ops.c
lib/mr_param.c
lib/mr_private.h
lib/mr_query.c
lib/nfsparttype.c
lib/sq.c
lib/strs.c

index f87cd370317254348c450b42fd0ec69c3c26b2fa..a14df5584e66dba3d9e0218b554021a0e4ccfb94 100644 (file)
@@ -36,7 +36,7 @@ comp_et_depend(gdss_et)
 depend:: ${CODE}
 
 library_obj_rule()
-install_library_target(moira,$(OBJECTS),$(SRCS),${MR_LINTLIB})
+install_library_target(moira,$(OBJECTS),$(SRCS))
 
 install::
        -mkdir ${DESTDIR}${INCLDIR}
index 7d5df7f1f18b0448a0502cc467ebe64aef00adcb..27913d2eccf5ee256f3e1333a5bc73a1448d10fb 100644 (file)
@@ -19,7 +19,8 @@
 #include <syslog.h>
 #endif
 #include <string.h>
-
+#include <time.h>
+#include <com_err.h>
 
 /* mode to create the file with */
 #define LOGFILEMODE    0644
@@ -33,7 +34,7 @@ extern char *whoami;
  * whoami to be defined and contain the name of the calling program.
  * It's a kludge that it takes a max of 8 arguments in a way that
  * isn't necessarily portable, but varargs doesn't work here and we
- * don't have vsprintf().
+ * don't necessarily have vsprintf().
  */
 
 void critical_alert(instance, msg, arg1, arg2, arg3, arg4,
@@ -53,7 +54,7 @@ void critical_alert(instance, msg, arg1, arg2, arg3, arg4,
     /* Log message to critical file */
     if ((crit = fopen(CRITERRLOG, "a")) != (FILE *)NULL) 
     {
-       long t, time();
+       time_t t;
        char  *time_s;
 
        time(&t);
index 54bc7205408ddb6629730c313a8426597cf8fc87..d712d6eb7cb6043fd7fbff03b44f2a92875d7c1e 100644 (file)
@@ -10,7 +10,7 @@
 
 #ifndef lint
 static char *rcsid_fixhost_c = "$Header$";
-#endif lint
+#endif
 
 #include <mit-copyright.h>
 #include <sys/types.h>
@@ -18,6 +18,7 @@ static char *rcsid_fixhost_c = "$Header$";
 #include <netinet/in.h>
 #include <netdb.h>
 #include <stdio.h>
+#include <stdlib.h>
 #ifdef POSIX
 #include <sys/utsname.h>
 #endif
@@ -25,9 +26,6 @@ static char *rcsid_fixhost_c = "$Header$";
 #include <ctype.h>
 #include <moira.h>
 
-extern char *malloc();
-extern char *realloc();
-
 /*
  * Canonicalize hostname:
  *  if it is in double-quotes, then strip the quotes and return the name.
index ae133a412cdc30ba02ddc878fbb148520deffe19..dd300bf7e12615f9ec86966653d3e54dab0d6c47 100644 (file)
@@ -10,7 +10,7 @@
 
 #ifndef lint
 static char *rcsid_fixname_c = "$Header$";
-#endif lint
+#endif
 
 #include <mit-copyright.h>
 #include <string.h>
@@ -48,7 +48,7 @@ void FixName(ilnm, ifnm, last, first, middle)
 #ifdef notdef
                /* okay, finish up first name */
        AppendJrOrIII(ifnm, &ends_jr, &ends_ii, &ends_iii, &ends_iv, &ends_v);
-#endif notdef
+#endif
        strncpy(first, ifnm, FIRST_LEN);
 }
 
index e34e289f0ece9464103987abf83d19fe7570427d..665925d4077759ed2b0db156b14c7714b8c6724f 100644 (file)
 #include <ctype.h>
 #include <moira.h>
 #include <string.h>
+#include <stdlib.h>
 
-extern char *malloc();
-
+#ifndef NULL
 #define NULL 0
+#endif
 #define hash_func(h, key) (key >= 0 ? (key % h->size) : (-key % h->size))
 
 /* Create a hash table.  The size is just a hint, not a maximum. */
index be166df2ba7279e9fb416117ab6ed351eae6a33b..e98222a62b4d1a2e39d4abe36c7d9fc752b1d19d 100644 (file)
 #include <mit-copyright.h>
 #include <string.h>
 #include <ctype.h>
-
+#ifdef POSIX
+#include <unistd.h>
+#endif
+#ifdef USE_CRYPT_H
+#include <crypt.h>
+#endif
 
 /*     Function Name: RemoveHyphens
  *     Description: Removes all hyphens from the string passed to it.
@@ -42,7 +47,6 @@ EncryptID(sbuf, idnumber, first, last)
 char *sbuf, *idnumber, *first, *last;
 {
     char salt[3];
-    extern char *crypt();
 
     RemoveHyphens(idnumber);
     salt[0] = tolower(last[0]);
index f386d80639b0f5882058467662c4ad17c538aa38..c8633f1d67f1ee0a9f1722d6edc843cfca707f37 100644 (file)
 
 #ifndef lint
 static char *rcsid_sms_access_c = "$Header$";
-#endif lint
+#endif
 
 #include <mit-copyright.h>
 #include "mr_private.h"
 #include <string.h>
-
+#include <stdlib.h>
 
 /*
  * Check access to a named query.
index d6db8ca0cbf146197b1074fb636fc984e01cf369..25277cee3481e160ae763a910c17c3415bbfd520 100644 (file)
@@ -13,7 +13,7 @@
 
 #ifndef lint
 static char *rcsid_sms_auth_c = "$Header$";
-#endif lint
+#endif
 
 #include <mit-copyright.h>
 #include "mr_private.h"
index 86ca32c980207809b064c8458c6abede49ce8cc3..9048dc8a4cecbfa20f741eadc98e2085f5fb3b75 100644 (file)
@@ -10,7 +10,7 @@
 
 #ifndef lint
 static char *rcsid_sms_call_c = "$Header$";
-#endif lint
+#endif
 
 #include <mit-copyright.h>
 #include "mr_private.h"
index 39ebcd45ffc1c3808e8f06005a55af03341bb15c..b619e2d7196a81351a2bedd9df150b4b74ad488f 100644 (file)
 
 #ifndef lint
 static char *rcsid_sms_connect_c = "$Header$";
-#endif lint
+#endif
 
 #include <mit-copyright.h>
 #include "mr_private.h"
 #include <moira_site.h>
 #include <string.h>
+#include <stdlib.h>
+#include <hesiod.h>
 
 static char *mr_server_host = 0;
 
@@ -33,7 +35,6 @@ char *server;
 {
     extern int errno;
     char *p, **pp, sbuf[256];
-    extern char *getenv(), **hes_resolve();
        
     if (!mr_inited) mr_init();
     if (_mr_conn) return MR_ALREADY_CONNECTED;
@@ -47,7 +48,7 @@ char *server;
        pp = hes_resolve("moira", "sloc");
        if (pp) server = *pp;
     }
-#endif HESIOD
+#endif
 
     if (!server || (strlen(server) == 0)) {
        server = MOIRA_SERVER;
index 8e7f4ffa1333f75064ee12dadc01452ebc4a1d12..d9864fb9128ddab95dbe0a08b511628cb154c663 100644 (file)
@@ -11,7 +11,7 @@
 
 #ifndef lint
 static char *rcsid_sms_data_c = "$Header$";
-#endif lint
+#endif
 
 #include <mit-copyright.h>
 #include "mr_private.h"
index 880e88c1a7359f1788a4c359e8b00008db92ecf6..7a8055a0ae47eb7c48769e9fbcbd75b9a0a91114 100644 (file)
@@ -10,7 +10,7 @@
 
 #ifndef lint
 static char *rcsid_sms_init_c = "$Header$";
-#endif lint
+#endif
 
 #include <mit-copyright.h>
 #include "mr_private.h"
index 25ea85970abd7c7d1f292c2695ad8dabf9d367b7..7e91f1312765d5b2d003c2405814c8e815860e8e 100644 (file)
@@ -15,7 +15,7 @@
 
 #ifndef lint
 static char *rcsid_sms_do_update_c = "$Header$";
-#endif lint
+#endif
 
 #include <mit-copyright.h>
 #include <string.h>
index 0db231f784ceba44e967a52bab2a3d4a11520f37..c3f074d788193f08854ffb20b1d934cdc31705c6 100644 (file)
 
 #ifndef lint
 static char *rcsid_sms_param_c = "$Header$";
-#endif lint
+#endif
 
 #include <mit-copyright.h>
 #include <sys/types.h>
 #include <netinet/in.h>
 #include "mr_private.h"
 #include <string.h>
+#include <stdlib.h>
 
 /*
  * GDB operations to send and recieve RPC requests and replies.
@@ -69,10 +70,10 @@ mr_start_send(op, hcon, arg)
      * At least for now, each argument is a string, which is
      * sent as a count of bytes followed by the bytes
      * (including the trailing '\0'), padded
-     * to a longword boundary.
+     * to a 32-bit boundary.
      */
 
-    mr_size = 4 * sizeof(long);
+    mr_size = 4 * sizeof(int32);
 
     argl = (int *)malloc((unsigned)(sizeof(int) * arg->mr_argc));
 
@@ -85,9 +86,9 @@ mr_start_send(op, hcon, arg)
            argl[i] = len = arg->mr_argl[i];
        else
            argl[i] = len = strlen(arg->mr_argv[i]) + 1;
-       mr_size += sizeof(long) + len;
-       /* Round up to next longword boundary.. */
-       mr_size = sizeof(long) * howmany(mr_size, sizeof(long));
+       mr_size += sizeof(int32) + len;
+       /* Round up to next 32-bit boundary.. */
+       mr_size = sizeof(int32) * howmany(mr_size, sizeof(int32));
     }
        
     arg->mr_flattened = buf = malloc(mr_size);
@@ -96,30 +97,24 @@ mr_start_send(op, hcon, arg)
        
     arg->mr_size = mr_size;
        
-    /*
-     * This is gross.  Any better suggestions, anyone?
-     * It should work on the RT's, since malloc is guaranteed to
-     * return a pointer which is aligned correctly for any data.
-     */
-
-    ((long *)buf)[0] = htonl(mr_size);
-    ((long *)buf)[1] = htonl(arg->mr_version_no);
-    ((long *)buf)[2] = htonl(arg->mr_procno);
-    ((long *)buf)[3] = htonl(arg->mr_argc);
+    ((int32 *)buf)[0] = htonl(mr_size);
+    ((int32 *)buf)[1] = htonl(arg->mr_version_no);
+    ((int32 *)buf)[2] = htonl(arg->mr_procno);
+    ((int32 *)buf)[3] = htonl(arg->mr_argc);
 
     /*
      * bp is a pointer into the point in the buffer to put
      * the next argument.
      */
        
-    bp = (char *)(((long *)buf) + 4);
+    bp = (char *)(((int32 *)buf) + 4);
        
     for (i = 0; i<arg->mr_argc; ++i) {
        len = argl[i];
-       *((long *)bp) = htonl(len);
-       bp += sizeof(long);
+       *((int32 *)bp) = htonl(len);
+       bp += sizeof(int32);
        memcpy(bp, arg->mr_argv[i], len);
-       bp += sizeof(long) * howmany(len, sizeof(long));
+       bp += sizeof(int32) * howmany(len, sizeof(int32));
     }
     op->fcn.cont = mr_cont_send;
     arg->mr_size = mr_size;
@@ -148,7 +143,7 @@ mr_cont_recv(op, hcon, argp)
        case S_RECV_START:
            arg->mr_state = S_RECV_DATA;
            if (gdb_receive_data(hcon, (caddr_t)&arg->mr_size,
-                                sizeof(long)) == OP_COMPLETE)
+                                sizeof(int32)) == OP_COMPLETE)
                continue;
            done = TRUE;
            break;
@@ -161,11 +156,11 @@ mr_cont_recv(op, hcon, argp)
            }
            arg->mr_flattened = malloc(arg->mr_size);
            arg->mr_state = S_DECODE_DATA;
-           memcpy(arg->mr_flattened, (caddr_t)&arg->mr_size, sizeof(long));
+           memcpy(arg->mr_flattened, (caddr_t)&arg->mr_size, sizeof(int32));
                        
            if (gdb_receive_data(hcon,
-                                arg->mr_flattened + sizeof(long),
-                                arg->mr_size - sizeof(long))
+                                arg->mr_flattened + sizeof(int32),
+                                arg->mr_size - sizeof(int32))
                == OP_COMPLETE)
                continue;
            done = TRUE;
@@ -187,7 +182,7 @@ mr_cont_recv(op, hcon, argp)
                        
            for (i = 0; i<arg->mr_argc; ++i) {
                u_short nlen = ntohl(* (int *) cp);
-               cp += sizeof (long);
+               cp += sizeof (int32);
                if (cp + nlen > arg->mr_flattened + arg->mr_size) {
                    free(arg->mr_flattened);
                    arg->mr_flattened = NULL;
@@ -196,7 +191,7 @@ mr_cont_recv(op, hcon, argp)
                arg->mr_argv[i] = (char *)malloc(nlen);
                memcpy(arg->mr_argv[i], cp, nlen);
                arg->mr_argl[i]=nlen;
-               cp += sizeof(long) * howmany(nlen, sizeof(long));
+               cp += sizeof(int32) * howmany(nlen, sizeof(int32));
            }
            free(arg->mr_flattened);
            arg->mr_flattened = NULL;
index 720c3cdce78d5eb5fa1ac3c5aaa6037837f034c4..d769f397439a80700bae540d82a75bdc852e0eb3 100644 (file)
@@ -27,16 +27,3 @@ extern int sending_version_no;
 #define EVER (;;)
        
 #define CHECK_CONNECTED {if (!_mr_conn) return MR_NOT_CONNECTED;}
-
-/*
- * There should be an include file for these..
- */
-       
-extern char *malloc();
-#ifndef htonl
-extern u_long htonl(), ntohl();
-extern u_short htons(), ntohs();
-#endif /* htonl */
-
-
-
index 0058754bc23c9bfe54bf2d29581f5e27c0334e3c..16eca18e09781cf5db9851a93db4e304ff479ba3 100644 (file)
 
 #ifndef lint
 static char *rcsid_sms_query_c = "$Header$";
-#endif lint
+#endif
 
 #include <mit-copyright.h>
 #include "mr_private.h"
 #include <string.h>
+#include <stdlib.h>
 
 /*
  * This routine is the primary external interface to the mr library.
@@ -23,7 +24,7 @@ static char *rcsid_sms_query_c = "$Header$";
  * It builds a new argument vector with the query handle prepended,
  * and calls mr_query_internal.
  */
-int level = 0;
+static int level = 0;
 
 int mr_query(name, argc, argv, callproc, callarg)
     char *name;                /* Query name */
index c7e47cf5b37b9db992f1667d33427edd400915fa..e00a72ac121853b47dbc2a03ce244db4cab6b9d9 100644 (file)
 
 #ifndef lint
 static char *rcsid_nfsparttype_c = "$Header$";
-#endif lint
+#endif
 
 #include <mit-copyright.h>
 #include <moira.h>
 #include <stdio.h>
 #include <string.h>
 #include <ctype.h>
+#include <stdlib.h>
 
 extern char *strsave();
 extern char *strtrim();
index a9e98856066537b74a3b2f6575ac8705b560132a..eac915623813501a73760ae1c7c3950864be4185 100644 (file)
--- a/lib/sq.c
+++ b/lib/sq.c
@@ -10,8 +10,7 @@
 #include <mit-copyright.h>
 #include <moira.h>
 #include <string.h>
-
-extern char *malloc();
+#include <stdlib.h>
 
 struct save_queue *
 sq_create()
@@ -77,7 +76,7 @@ sq_save_unique_data(sq, data)
     register struct save_queue *q;
 
     for (q = sq->q_next; q != sq; q = q->q_next)
-       if (q->q_data == data) return;
+       if (q->q_data == data) return 1;
 
     return sq_save_data(sq, data);
 }
@@ -90,7 +89,7 @@ sq_save_unique_string(sq, data)
     register struct save_queue *q;
 
     for (q = sq->q_next; q != sq; q = q->q_next)
-       if (!strcmp(q->q_data, data)) return;
+       if (!strcmp(q->q_data, data)) return 1;
 
     return sq_save_data(sq, data);
 }
index 62385dd16fd6ea690f1b1db2f146ce50879b409b..055e19a52d6e70abb35cfffca1155f38f5e4110e 100644 (file)
 
 #ifndef lint
 static char *rcsid_strs_c = "$Header$";
-#endif lint
+#endif
 
 #include <mit-copyright.h>
 #include <sys/types.h>
+#include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
 
-extern char *malloc(), *realloc();
-
 /*
  * Random string functions which should be in the C library..
  */
@@ -36,7 +35,6 @@ strsave(s)
     register char *p;
     /* Kludge for sloppy string semantics */
     if (!s) {
-           printf("NULL != \"\" !!!!\r\n");
            p = malloc(1);
            *p = '\0';
            return p;
This page took 0.30111 seconds and 5 git commands to generate.