]> andersk Git - moira.git/commitdiff
posixify source
authormar <mar>
Fri, 22 Oct 1993 14:01:20 +0000 (14:01 +0000)
committermar <mar>
Fri, 22 Oct 1993 14:01:20 +0000 (14:01 +0000)
17 files changed:
gdb/gdb.c
gdb/gdb_conn.c
gdb/gdb_stype.c
gdb/gdb_trans2.c
lib/critical.c
lib/fixhost.c
lib/hash.c
lib/idno.c
lib/mr_access.c
lib/mr_auth.c
lib/mr_connect.c
lib/mr_param.c
lib/mr_query.c
lib/nfsparttype.c
lib/sq.c
lib/strs.c
update/auth_001.c

index e38f7e9464bb25ea471e61e92a869da419b30205..b1bebbbf1cf61a32b441545d965a199b1e46205b 100644 (file)
--- a/gdb/gdb.c
+++ b/gdb/gdb.c
@@ -34,6 +34,9 @@ static char *rcsid_gdb_c = "$Header$";
 #include "gdb.h"
 #include "gdb_lib.h"
 #include <errno.h>
+#ifdef POSIX
+#include <sys/utsname.h>
+#endif
 
 extern int sys_nerr;
 extern char *sys_errlist[];
@@ -69,6 +72,14 @@ gdb_init()
 
        struct passwd *pw_struct;               /* passwd entry comes back */
                                                /* here */
+#ifdef POSIX
+       struct utsname nameposix;
+       struct sigaction act;
+
+       sigemptyset(&act.sa_mask);
+       act.sa_flags = 0;
+#endif
+
        /*
         * So we know we've been initialized, and we do it only once
         */
@@ -110,13 +121,23 @@ gdb_init()
         * closed at the other end.  gdb_move_data handles this condition
         * synchronously.
         */
+#ifdef POSIX
+       act.sa_handler = (void(*)()) SIG_IGN;
+       (void) sigaction(SIGPIPE, &act, NULL);
+#else
        (void) signal(SIGPIPE, SIG_IGN);
+#endif
 
        /*
         * Make a note of the local host and user name
         */
+#ifdef POSIX
+       (void) uname(&nameposix);
+       strncpy(hostname, nameposix.nodename, sizeof(hostname) - 1);
+#else
        if (gethostname(hostname, sizeof(hostname)-1)!=0)
                (void) strcpy(hostname, "????");
+#endif
        gdb_host = db_alloc(strlen(hostname)+1);
        (void) strcpy(gdb_host, hostname);
 
index 81aaa319300282e09307bafed29d4d6e022796b4..bb263b854f0533dd9b09152dcca6fb28e548dac4 100644 (file)
@@ -27,7 +27,7 @@ static char *rcsid_gdb_conn_c = "$Header$";
 
 #include <mit-copyright.h>
 #include <stdio.h>
-#include <strings.h>
+#include <string.h>
 #include "gdb.h"
 #include <sys/types.h>
 #include <sys/uio.h>
@@ -47,22 +47,22 @@ extern u_short htons();                     /* ?? All versions?  */
 
 CONNECTION gdb_allocate_connection();
 
-/************************************************************************/
-/*     
-/*                     start_peer_connection (start_peer_connection)
-/*     
-/*     Starts a connection to another process which itself will be 
-/*     issuing a start_peer_connection to us.  Current implementation
-/*     builds at most one stream, with the risk of a hang if 
-/*     the attempts to connect cross in the night.  This is a bug,
-/*     but this level of support is acceptable for casual debugging
-/*     of applications, and perhaps for some production use in
-/*     controlled settings.  I think the only other way to do it 
-/*     is to risk building two streams in parallel, possibly tearing
-/*     one down when the duplication is discovered.  Seems complicated
-/*     and messy.
-/*     
-/************************************************************************/
+/************************************************************************
+ *     
+ *                     start_peer_connection (start_peer_connection)
+ *     
+ *     Starts a connection to another process which itself will be 
+ *     issuing a start_peer_connection to us.  Current implementation
+ *     builds at most one stream, with the risk of a hang if 
+ *     the attempts to connect cross in the night.  This is a bug,
+ *     but this level of support is acceptable for casual debugging
+ *     of applications, and perhaps for some production use in
+ *     controlled settings.  I think the only other way to do it 
+ *     is to risk building two streams in parallel, possibly tearing
+ *     one down when the duplication is discovered.  Seems complicated
+ *     and messy.
+ *     
+ ************************************************************************/
 
 CONNECTION
 start_peer_connection(id)
@@ -123,7 +123,8 @@ char *id;                                   /* null terminated string */
        } else
                return NULL;
 }
-\f
+
+
 /************************************************************************/
 /*     
 /*                             g_make_con
@@ -154,7 +155,8 @@ g_make_con()
 
 }
 
-\f/************************************************************************/
+
+/************************************************************************/
 /*     
 /*                             g_null_con
 /*     
@@ -209,7 +211,7 @@ CONNECTION con;
 
 }
 
-\f
+
 /************************************************************************/
 /*     
 /*                     gdb_allocate_connection
@@ -250,7 +252,8 @@ gdb_allocate_connection()
        return &gdb_cons[i];                    /* return new highest con */
                                                /* ever used*/       
 }
-\f
+
+
 /************************************************************************/
 /*     
 /*                     g_try_connecting
@@ -292,7 +295,7 @@ char *id;
        /*      
        /*----------------------------------------------------------*/
 
-       bzero((char *)&target, sizeof(target));
+       memset((char *)&target, 0, sizeof(target));
        g_parse_target(id, &peer_host, &target.sin_port);
        if (peer_host == NULL) {
                fprintf(gdb_log,"gdb: g_try_connecting...  '%s' is not a valid host:server\n",
@@ -322,7 +325,7 @@ char *id;
        /*----------------------------------------------------------*/
 
 
-       bcopy(peer_host->h_addr, (char *)&target.sin_addr, peer_host->h_length);
+       memcpy((char *)&target.sin_addr,peer_host->h_addr,peer_host->h_length);
        target.sin_family = peer_host->h_addrtype;
 
        /*----------------------------------------------------------*/
@@ -364,7 +367,8 @@ char *id;
        return TRUE;
 
 }
-\f
+
+
 /************************************************************************/
 /*     
 /*                     g_parse_target
@@ -468,7 +472,8 @@ u_short *port;
                *port = serv->s_port;
        }
 }
-\f
+
+
 /************************************************************************/
 /*     
 /*                     g_try_accepting
@@ -535,7 +540,7 @@ char *id;
        /*      
        /*----------------------------------------------------------*/
 
-       bzero((char *)&self, sizeof(self));
+       memset((char *)&self, 0, sizeof(self));
        g_parse_target(id, &peer_host, &self.sin_port);
        if (peer_host == NULL) {
                GDB_GIVEUP("gdb_try_accepting: bad port not caught by try connecting")
@@ -598,7 +603,8 @@ char *id;
        con->out.fd = peer;
        con->status = CON_STARTING;
 }
-\f
+
+
 /************************************************************************/
 /*     
 /*                     g_ver_oprotocol
@@ -652,6 +658,7 @@ CONNECTION con;
 #endif !VERIFY_PROTOCOL
 }
 
+
 /************************************************************************/
 /*     
 /*                     g_ver_iprotocol
@@ -705,7 +712,7 @@ CONNECTION con;
 #endif
 }
 
-\f
+
 /************************************************************************/
 /*     
 /*                     sever_connection (sever_connection)
@@ -735,6 +742,7 @@ CONNECTION con;
        return NULL;
 }
 
+
 /************************************************************************/
 /*     
 /*                     g_stop_with_errno
@@ -745,7 +753,6 @@ CONNECTION con;
 /*     
 /************************************************************************/
 
-
 int
 g_stop_with_errno(con)
 CONNECTION con;
@@ -755,6 +762,7 @@ CONNECTION con;
        
 }
 
+
 /************************************************************************/
 /*     
 /*                     g_stop_connection
@@ -805,7 +813,7 @@ CONNECTION con;
        return;
 }
 
-\f
+
 /************************************************************************/
 /*     
 /*                     gdb_de_allocate_connection
@@ -833,7 +841,8 @@ CONNECTION con;
 
        gdb_mcons = i + 1;
 }
-\f
+
+
 /************************************************************************/
 /*     
 /*                     g_cleanup_half_conection
@@ -866,7 +875,8 @@ HALF_CONNECTION hcon;
                current = next;
        }
 }
-\f
+
+
 /************************************************************************/
 /*     
 /*                 create_listening_connection (create_listening_connection)
@@ -957,7 +967,7 @@ char *id;
        /*      
        /*----------------------------------------------------------*/
 
-       bzero((char *)&self, sizeof(self));
+       memset((char *)&self, 0, sizeof(self));
        /*
         * Determine our port number
         */
@@ -1009,7 +1019,8 @@ char *id;
                gdb_mfd = con->in.fd + 1;
        return con;
 }
-\f
+
+
 /************************************************************************/
 /*     
 /*                     g_allocate_connection_buffers
index ba7da0fca437a4ee8286614fe9be1a896ac9e8f6..557350f87587d344de6b7bf57895a7fe9753ae60 100644 (file)
@@ -8,72 +8,54 @@ static char *rcsid_gdb_stype_c = "$Header$";
 #endif lint
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-/************************************************************************/
-/*     
-/*                        gdb_stype.c
-/*     
-/*           GDB - System Data Type Definitions
-/*     
-/*     Author: Noah Mendelsohn
-/*     Copyright: 1986 MIT Project Athena 
-/*             For copying and distribution information, please see
-/*             the file <mit-copyright.h>.
-/*     
-/*     This file initializes the definitions for all system defined
-/*     data types, and it includes the type specific semantic routines
-/*     for each of the system defined types.
-/*     
-/*     The initialization routine which adds these type definitions 
-/*     to the type definition table is at the end of this source file.
-/*     
-/************************************************************************/
-/*     
-/*     This file is organized into one section for each system
-/*     defined type followed at the end by a final section which
-/*     initializes the type tables.  Each of the type specific
-/*     sections does #defines for each type specific parameter.  The
-/*     gdb_i_stype initialization routine at the end of this source
-/*     file uses these defines to initialize the appropriate entry in
-/*     the type definition tables.
-/*     
-/*     NOTE: some of the type definitions in this file may be machine
-/*     dependent.
-/*     
-/************************************************************************/
+/************************************************************************
+ *     
+ *                        gdb_stype.c
+ *     
+ *           GDB - System Data Type Definitions
+ *     
+ *     Author: Noah Mendelsohn
+ *     Copyright: 1986 MIT Project Athena 
+ *             For copying and distribution information, please see
+ *             the file <mit-copyright.h>.
+ *     
+ *     This file initializes the definitions for all system defined
+ *     data types, and it includes the type specific semantic routines
+ *     for each of the system defined types.
+ *     
+ *     The initialization routine which adds these type definitions 
+ *     to the type definition table is at the end of this source file.
+ *     
+ ************************************************************************
+ *     
+ *     This file is organized into one section for each system
+ *     defined type followed at the end by a final section which
+ *     initializes the type tables.  Each of the type specific
+ *     sections does #defines for each type specific parameter.  The
+ *     gdb_i_stype initialization routine at the end of this source
+ *     file uses these defines to initialize the appropriate entry in
+ *     the type definition tables.
+ *     
+ *     NOTE: some of the type definitions in this file may be machine
+ *     dependent.
+ *     
+ ************************************************************************/
 
 #include <mit-copyright.h>
 #include <stdio.h>
-#include <strings.h>
+#include <string.h>
 #include "gdb.h"
 #ifdef vax                     /* XXX */
        extern u_long ntohl(), htonl();
 #endif vax
 #include <netinet/in.h>                                /* for htonl routine */
-\f
-/************************************************************************/
-/*     
-/*                          INTEGER_T
-/*     
-/************************************************************************/
+
+
+/************************************************************************
+ *     
+ *                          INTEGER_T
+ *     
+ ************************************************************************/
 
 #define IN_LEN                 (sizeof(int))
 #define IN_ALI                 IN_LEN
@@ -216,7 +198,8 @@ char *dp;                                   /* pointer to the data */
 {
        fprintf(gdb_log, "INTEGER_T\t%s=%d\n",name,(*(int *)dp));
 }
-\f
+
+
 /************************************************************************/
 /*     
 /*                          STRING_T
@@ -304,7 +287,7 @@ char *outp;                                 /* place to put the output */
         * Now, copy the data itself after the encoded integer length
         */
        if (len > 0)
-               bcopy(STRING_DATA(*stp), nextp, len);
+               memcpy(nextp, STRING_DATA(*stp), len);
                                                /* copy the data without */
                                                /* changing representation*/
        return (int)(nextp+len);
@@ -361,7 +344,7 @@ char *outp;                                 /* place to put the output */
        /*
         * Now, copy the data itself 
         */
-       bcopy(nextp, STRING_DATA(*stp), len);   /* copy the data without */
+       memcpy(STRING_DATA(*stp), nextp, len);  /* copy the data without */
                                                /* changing representation*/
        return (int)(nextp+len);
 }
@@ -402,7 +385,8 @@ char *dp;                                   /* pointer to the data */
 
        fprintf(gdb_log,"\"\n");
 }
-\f
+
+
 /************************************************************************/
 /*     
 /*                          REAL_T
@@ -532,7 +516,8 @@ char *dp;                                   /* pointer to the data */
 {
        fprintf(gdb_log, "REAL_T\t\t%s=%le\n",name,*((double *)dp) );
 }
-\f
+
+
 /************************************************************************/
 /*     
 /*                          DATE_T
@@ -668,11 +653,12 @@ char *dp;                                 /* pointer to the data */
 {
        char buf[DT_EXTERNSIZE+1];
 
-       bcopy(dp, buf, DT_EXTERNSIZE);          /* copy date to buffer */
+       memcpy(buf, dp, DT_EXTERNSIZE);         /* copy date to buffer */
        buf[DT_EXTERNSIZE] = '\0';              /* null terminate it */
        fprintf(gdb_log, "DATE_T\t\t%s=%s\n",name,buf);
 }
-\f
+
+
 /************************************************************************/
 /*     
 /*                          TUPLE_DESCRIPTOR_T
@@ -799,8 +785,8 @@ char *outp;                                 /* place to put the output */
        /*
         * Finally, copy all the null terminated strings.
         */
-       bcopy(((char *)(tdp))+gdb_descriptor_length(tdp->field_count), 
-             nextp, tdp->str_len);             /* copy the string data all */
+       memcpy(nextp,((char *)(tdp))+gdb_descriptor_length(tdp->field_count), 
+              tdp->str_len);           /* copy the string data all */
                                                /* at once */
        return (int)(nextp+tdp->str_len);
 }
@@ -947,7 +933,8 @@ char *dp;                                   /* pointer to the data */
        }
        fprintf(gdb_log,"\n");
 }
-\f
+
+
 /************************************************************************/
 /*     
 /*                          TUPLE_T
@@ -1201,7 +1188,8 @@ char *dp;                                 /* pointer to the data */
        
        fprintf(gdb_log,"END_OF_TUPLE\n");
 }
-\f
+
+
 /************************************************************************/
 /*     
 /*                          TUPLE_DATA_T
@@ -1474,7 +1462,8 @@ char *dp;                                 /* pointer to the data */
        
        fprintf(gdb_log,"END_OF_TUPLE\n");
 }
-\f
+
+
 /************************************************************************/
 /*     
 /*                          RELATION_T
@@ -1766,7 +1755,8 @@ char *dp;                                 /* pointer to the data */
        
        fprintf(gdb_log,"END_OF_RELATION\n");
 }
-\f
+
+
 /************************************************************************/
 /*     
 /*        DECLARE AND INITIALIZE THE SYSTEM TYPE DEFINITION 
index 24452914040730dd797b1944581d32ea51b31f0f..bce2c6dee75c08164119210f80108d5b792e27bc 100644 (file)
@@ -8,45 +8,26 @@ static char *rcsid_gdb_trans2_c = "$Header$";
 #endif lint
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-/************************************************************************/
-/*     
-/*                        gdb_trans2.c
-/*     
-/*           GDB - Data Transport Services Routines (Part 2)
-/*     
-/*     Author: Noah Mendelsohn
-/*     Copyright: 1986 MIT Project Athena 
-/*             For copying and distribution information, please see
-/*             the file <mit-copyright.h>.
-/*     
-/*     
-/*     These routines implement layer 6 of the Client Library
-/*     Specification of the GDB system, as well as the facilities
-/*     outlined in the GDB Protocol Specification.  Part 2 of 2.
-/*
-/*     Some of the routines specified are actually implemented as
-/*     macros defined in gdb.h.
-/*     
-/************************************************************************/
+/************************************************************************
+ *     
+ *                        gdb_trans2.c
+ *     
+ *           GDB - Data Transport Services Routines (Part 2)
+ *     
+ *     Author: Noah Mendelsohn
+ *     Copyright: 1986 MIT Project Athena 
+ *             For copying and distribution information, please see
+ *             the file <mit-copyright.h>.
+ *     
+ *     
+ *     These routines implement layer 6 of the Client Library
+ *     Specification of the GDB system, as well as the facilities
+ *     outlined in the GDB Protocol Specification.  Part 2 of 2.
+ *
+ *     Some of the routines specified are actually implemented as
+ *     macros defined in gdb.h.
+ *     
+ ************************************************************************/
 
 #include <mit-copyright.h>
 #include <sys/types.h>
@@ -55,6 +36,7 @@ static char *rcsid_gdb_trans2_c = "$Header$";
 #include "gdb.h"
 #include <sys/uio.h>
 #include <sys/socket.h>
+#include <string.h>
 extern int errno;                              /* Unix error slot */
 
 /*
@@ -863,7 +845,7 @@ register HALF_CONNECTION hc;
         * Copy the data, update both stream and data buffer pointers
         */
 
-       bcopy(hc->stream_buffer_next, hc->next_byte, count);
+       memcpy(hc->next_byte, hc->stream_buffer_next, count);
 
        hc->stream_buffer_next += count;
        hc->stream_buffer_remaining -= count;
index c0af33bf1f294564c6e836c7e1887b2226ecf4ee..7d5df7f1f18b0448a0502cc467ebe64aef00adcb 100644 (file)
@@ -18,6 +18,7 @@
 #ifdef SYSLOG
 #include <syslog.h>
 #endif
+#include <string.h>
 
 
 /* mode to create the file with */
@@ -79,7 +80,11 @@ char *msg;
 #ifdef ZEPHYR
     ZNotice_t znotice;
 
+#ifdef POSIX
+    memset (&znotice, 0, sizeof (znotice));
+#else
     bzero (&znotice, sizeof (znotice));
+#endif
     znotice.z_kind = UNSAFE;
     znotice.z_class = "MOIRA";
     znotice.z_class_inst = inst;
index 50c39080f8cf28503f0d8db1f7b44738f4273a2e..54bc7205408ddb6629730c313a8426597cf8fc87 100644 (file)
@@ -18,7 +18,10 @@ static char *rcsid_fixhost_c = "$Header$";
 #include <netinet/in.h>
 #include <netdb.h>
 #include <stdio.h>
-#include <strings.h>
+#ifdef POSIX
+#include <sys/utsname.h>
+#endif
+#include <string.h>
 #include <ctype.h>
 #include <moira.h>
 
@@ -44,6 +47,9 @@ canonicalize_hostname(host)
     int n_len;
     int has_dot = 0;
     char tbuf[BUFSIZ];
+#ifdef POSIX
+    struct utsname name;
+#endif
     register char *cp;
     
     if (strlen(host) > 2 && host[0] == '"' && host[strlen(host)-1] == '"') {
@@ -53,7 +59,7 @@ canonicalize_hostname(host)
        return(strsave(tbuf));
     }
 
-    if (index(host, '*') || index(host, '?') || index(host, '['))
+    if (strchr(host, '*') || strchr(host, '?') || strchr(host, '['))
       return(host);
 
     hp = gethostbyname(host);
@@ -75,9 +81,14 @@ canonicalize_hostname(host)
            static char *domain = NULL;
 
            if (domain == NULL) {
+#ifdef POSIX
+               (void) uname(&name);
+               strncpy(tbuf, name.nodename, sizeof(tbuf));
+#else
                gethostname(tbuf, sizeof(tbuf));
+#endif
                hp = gethostbyname(tbuf);
-               cp = index(hp->h_name, '.');
+               cp = strchr(hp->h_name, '.');
                if (cp)
                  domain = strsave(++cp);
                else
index d09615c1543e56915e00db057b1b241d20b5dd7c..e34e289f0ece9464103987abf83d19fe7570427d 100644 (file)
@@ -10,6 +10,7 @@
 #include <mit-copyright.h>
 #include <ctype.h>
 #include <moira.h>
+#include <string.h>
 
 extern char *malloc();
 
@@ -32,7 +33,7 @@ int size;
        free(h);
        return((struct hash *) NULL);
     }
-    bzero(h->data, size * sizeof(char *));
+    memset(h->data, 0, size * sizeof(char *));
     return(h);
 }
 
index a0a58014e06df6276a58ec45c9ca854879ad2841..be166df2ba7279e9fb416117ab6ed351eae6a33b 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 #include <mit-copyright.h>
-#include <strings.h>
+#include <string.h>
 #include <ctype.h>
 
 
@@ -24,7 +24,7 @@ char *str;
 {
     char *hyphen;
 
-    while ((hyphen = index(str, '-')) != (char *)0)
+    while ((hyphen = strchr(str, '-')) != (char *)0)
        (void) strcpy(hyphen, hyphen + 1);
 }
 
index a6a24f9b2321530f4f94be4edfa24cdd1fbabc7e..f386d80639b0f5882058467662c4ad17c538aa38 100644 (file)
@@ -14,6 +14,8 @@ static char *rcsid_sms_access_c = "$Header$";
 
 #include <mit-copyright.h>
 #include "mr_private.h"
+#include <string.h>
+
 
 /*
  * Check access to a named query.
@@ -26,7 +28,7 @@ int mr_access(name, argc, argv)
     register char **nargv = (char **)malloc(sizeof(char *) * (argc+1));
     register int status = 0;
     nargv[0] = name;
-    bcopy((char *)argv, (char *)(nargv+1), sizeof(char *) * argc);
+    memcpy((char *)(nargv+1), (char *)argv, sizeof(char *) * argc);
     status = mr_access_internal(argc+1, nargv);
     free(nargv);
     return status;
index ca0eb45398d4796365047944b8fc3bd59fa20fa1..d6db8ca0cbf146197b1074fb636fc984e01cf369 100644 (file)
@@ -20,7 +20,7 @@ static char *rcsid_sms_auth_c = "$Header$";
 #include <ctype.h>
 #include <krb.h>
 #include <krb_et.h>
-#include <strings.h>
+#include <string.h>
 
 /* Authenticate this client with the MR server.  prog is the name of the
  * client program, and will be recorded in the database.
@@ -43,11 +43,11 @@ char *prog;
        
     /* Build a Kerberos authenticator. */
        
-    bzero(host, sizeof(host));
+    memset(host, 0, sizeof(host));
     if (status = mr_host(host, sizeof(host) - 1))
        return status;
 
-    strcpy(realm, krb_realmofhost(host));
+    strcpy(realm, (char *)krb_realmofhost(host));
     for (p = host; *p && *p != '.'; p++)
       if (isupper(*p))
        *p = tolower(*p);
index e1d197e715d88b33b14b4b8ac6af8fa923d286cb..39ebcd45ffc1c3808e8f06005a55af03341bb15c 100644 (file)
@@ -18,7 +18,7 @@ static char *rcsid_sms_connect_c = "$Header$";
 #include <mit-copyright.h>
 #include "mr_private.h"
 #include <moira_site.h>
-#include <strings.h>
+#include <string.h>
 
 static char *mr_server_host = 0;
 
@@ -53,8 +53,8 @@ char *server;
        server = MOIRA_SERVER;
     }
 
-    if (!index(server, ':')) {
-       p = index(MOIRA_SERVER, ':');
+    if (!strchr(server, ':')) {
+       p = strchr(MOIRA_SERVER, ':');
        p++;
        sprintf(sbuf, "%s:%s", server, p);
        server = sbuf;
@@ -76,7 +76,7 @@ char *server;
      */
 
     mr_server_host = strsave(server);
-    if (p = index(mr_server_host, ':'))
+    if (p = strchr(mr_server_host, ':'))
        *p = 0;
     mr_server_host = canonicalize_hostname(mr_server_host);
     return 0;
index 661b7862c73e6d403597e749d30285d492c3a673..0db231f784ceba44e967a52bab2a3d4a11520f37 100644 (file)
@@ -17,6 +17,7 @@ static char *rcsid_sms_param_c = "$Header$";
 #include <sys/types.h>
 #include <netinet/in.h>
 #include "mr_private.h"
+#include <string.h>
 
 /*
  * GDB operations to send and recieve RPC requests and replies.
@@ -91,7 +92,7 @@ mr_start_send(op, hcon, arg)
        
     arg->mr_flattened = buf = malloc(mr_size);
 
-    bzero(arg->mr_flattened, mr_size);
+    memset(arg->mr_flattened, 0, mr_size);
        
     arg->mr_size = mr_size;
        
@@ -117,7 +118,7 @@ mr_start_send(op, hcon, arg)
        len = argl[i];
        *((long *)bp) = htonl(len);
        bp += sizeof(long);
-       bcopy(arg->mr_argv[i], bp, len);
+       memcpy(bp, arg->mr_argv[i], len);
        bp += sizeof(long) * howmany(len, sizeof(long));
     }
     op->fcn.cont = mr_cont_send;
@@ -160,7 +161,7 @@ mr_cont_recv(op, hcon, argp)
            }
            arg->mr_flattened = malloc(arg->mr_size);
            arg->mr_state = S_DECODE_DATA;
-           bcopy((caddr_t)&arg->mr_size, arg->mr_flattened, sizeof(long));
+           memcpy(arg->mr_flattened, (caddr_t)&arg->mr_size, sizeof(long));
                        
            if (gdb_receive_data(hcon,
                                 arg->mr_flattened + sizeof(long),
@@ -193,7 +194,7 @@ mr_cont_recv(op, hcon, argp)
                    return OP_CANCELLED;
                }                   
                arg->mr_argv[i] = (char *)malloc(nlen);
-               bcopy(cp, arg->mr_argv[i], nlen);
+               memcpy(arg->mr_argv[i], cp, nlen);
                arg->mr_argl[i]=nlen;
                cp += sizeof(long) * howmany(nlen, sizeof(long));
            }
index d6162b2c090571f2039e591f62f0aad59b2c4271..0058754bc23c9bfe54bf2d29581f5e27c0334e3c 100644 (file)
@@ -15,6 +15,7 @@ static char *rcsid_sms_query_c = "$Header$";
 
 #include <mit-copyright.h>
 #include "mr_private.h"
+#include <string.h>
 
 /*
  * This routine is the primary external interface to the mr library.
@@ -34,7 +35,7 @@ int mr_query(name, argc, argv, callproc, callarg)
     register char **nargv = (char **)malloc(sizeof(char *) * (argc+1));
     register int status = 0;
     nargv[0] = name;
-    bcopy((char *)argv, (char *)(nargv+1), sizeof(char *) * argc);
+    memcpy((char *)(nargv+1), (char *)argv, sizeof(char *) * argc);
     status = mr_query_internal(argc+1, nargv, callproc, callarg);
     free(nargv);
     return status;
index 8d1809410838004ad34c0e1951e10710448837ad..c7e47cf5b37b9db992f1667d33427edd400915fa 100644 (file)
@@ -16,7 +16,7 @@ static char *rcsid_nfsparttype_c = "$Header$";
 #include <mit-copyright.h>
 #include <moira.h>
 #include <stdio.h>
-#include <strings.h>
+#include <string.h>
 #include <ctype.h>
 
 extern char *strsave();
@@ -91,9 +91,9 @@ parse_filesys_type(fs_type_name)
     
     do {
        /* Copy next component of type to temp */
-       char *t = index (cp, ',');
+       char *t = strchr (cp, ',');
        if (t) {
-           bcopy(cp, temp, t-cp);
+           memcpy(temp, cp, t-cp);
            temp[t-cp]='\0';
            cp = t + 1; /* one after the comma */
        } else {
index eabefd615728f94595b211d86c3ba5ba9c8da01a..952f5c876ec3bb2e1d9ab7c32544b2ff0f47fb61 100644 (file)
--- a/lib/sq.c
+++ b/lib/sq.c
@@ -9,6 +9,7 @@
 
 #include <mit-copyright.h>
 #include <moira.h>
+#include <string.h>
 
 extern char *malloc();
 
@@ -51,7 +52,7 @@ sq_save_args(argc, argv, sq)
     for (i = 0; i < argc; i++) {
        n = strlen(argv[i]) + 1;
        argv_copy[i] = (char *)malloc(n);
-       bcopy(argv[i], argv_copy[i], n);
+       memcpy(argv_copy[i], argv[i], n);
     }
 
     sq_save_data(sq, (char *)argv_copy);
index 665ab6dcd0324c40b1250824ca1d30c484cad760..62385dd16fd6ea690f1b1db2f146ce50879b409b 100644 (file)
@@ -43,7 +43,7 @@ strsave(s)
     }
     len = strlen(s) + 1;
     p = malloc((u_int)len);
-    if (p) bcopy(s, p, len);
+    if (p) memcpy(p, s, len);
     return p;
 }
 /*
index 83a5ebf7ac92c9a0e397f21decfd22f6cba2388e..9ff2bf6bc9850fe23da3769244feb3e6b0d62f8d 100644 (file)
@@ -12,12 +12,15 @@ static char *rcsid_auth_001_c = "$Header$";
 
 #include <mit-copyright.h>
 #include <stdio.h>
-#include <strings.h>
+#include <string.h>
 #include <gdb.h>
 #include <krb.h>
 #include <krb_et.h>
 #include <netinet/in.h>
 #include <errno.h>
+#ifdef POSIX
+#include <sys/utsname.h>
+#endif
 
 extern char buf[BUFSIZ];
 extern int have_authorization;
@@ -50,6 +53,9 @@ auth_001(str)
     AUTH_DAT ad;
     char *p, *first, *config_lookup();
     KTEXT_ST ticket_st;
+#ifdef POSIX
+    struct utsname name;
+#endif
 
     if (send_ok())
        lose("sending okay for authorization (auth_001)");
@@ -58,10 +64,15 @@ auth_001(str)
        code = connection_errno(conn);
        lose("awaiting Kerberos authenticators");
     }
-    gethostname(host, BUFSIZ);
+#ifdef POSIX
+    (void) uname(&name);
+    strncpy(host, name.nodename, sizeof(host));
+#else
+    gethostname(host, sizeof(host));
+#endif
     ticket_st.mbz = 0;
     ticket_st.length = MAX_STRING_SIZE(data);
-    bcopy(STRING_DATA(data), ticket_st.dat, MAX_STRING_SIZE(data));
+    memcpy(ticket_st.dat, STRING_DATA(data), MAX_STRING_SIZE(data));
     code = krb_rd_req(&ticket_st, service,
                      krb_get_phost(host), 0,
                      &ad, KEYFILE);
@@ -102,7 +113,7 @@ auth_001(str)
        lose("sending approval of authorization");
     have_authorization = 1;
     /* Stash away session key */
-    bcopy(ad.session, session, sizeof(session));
+    memcpy(session, ad.session, sizeof(session));
     return(0);
 auth_failed:
     sprintf(buf, "auth for %s.%s@%s failed: %s",
This page took 0.165337 seconds and 5 git commands to generate.