convert-update-to-afsconfig-and-kill-warnings-20010623
authorNathan Neulinger <nneul@umr.edu>
Sat, 23 Jun 2001 17:31:36 +0000 (17:31 +0000)
committerDerrick Brashear <shadow@dementia.org>
Sat, 23 Jun 2001 17:31:36 +0000 (17:31 +0000)
convert upserver and upclient to use afsconfig and kill warnings

src/update/Makefile
src/update/client.c
src/update/server.c
src/update/utils.c

index 19d6b92..b4b45ec 100644 (file)
@@ -14,7 +14,7 @@ LIBS = ${SRCDIR}lib/afs/libauth.a ${SRCDIR}lib/librxkad.a \
        ${SRCDIR}lib/libdes.a ${LIBRX} ${SRCDIR}lib/liblwp.a \
        ${SRCDIR}lib/afs/libcom_err.a ${SRCDIR}lib/afs/util.a \
        ${SRCDIR}lib/afs/libsys.a 
-CFLAGS= ${DBUG}  -I${SRCDIR}include ${XCFLAGS}
+CFLAGS= ${DBUG}  -I${SRCDIR}include -I${TOP_SRCDIR}/config ${XCFLAGS}
 
 PROGS=upclient upserver
 
index 3bf09f5..a90f956 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include <afs/param.h>
+#include <afsconfig.h>
 #include <afs/stds.h>
 #ifdef AFS_AIX32_ENV
 #include <signal.h>
 #include <sys/time.h>
 #include <dirent.h>
 #endif
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 #include <stdio.h>
 #include <errno.h>
 #include <rx/xdr.h>
@@ -41,6 +51,8 @@
 #include <afs/afsutil.h>
 #include <afs/fileutil.h>
 
+RCSID("$Header$");
+
 #include "update.h"
 #include "global.h"
 
@@ -223,7 +235,6 @@ again:
     while(1){/*keep doing it */
        char c, c1;
        for(df = dirname; df; df=df->next) {   /*for each directory do */
-           afs_int32 isDir = 0;
            char *curDir;
 
            if (verbose) printf ("Checking dir %s\n", df->name);
@@ -232,7 +243,7 @@ again:
            ZapList(&okhostfiles);
 
            /* construct local path from canonical (wire-format) path */
-           if (errcode = ConstructLocalPath(df->name, "/", &curDir)) {
+           if ((errcode = ConstructLocalPath(df->name, "/", &curDir))) {
                com_err(whoami, errcode, "Unable to construct local path");
                return errcode;
            }
@@ -323,7 +334,7 @@ again:
                    goto fail;
                }
 
-               while(dp = readdir(dirp)) {
+               while((dp = readdir(dirp))) {
                    /* for all the files in the directory df->name do*/
                    strcpy(filename, curDir);
                    strcat(filename,"/");
@@ -377,7 +388,7 @@ afs_int32 time, length;
     char *localname;
 
     /* construct a local path from canonical (wire-format) path */
-    if (error = ConstructLocalPath(filename, "/", &localname) ) {
+    if ((error = ConstructLocalPath(filename, "/", &localname))) {
        com_err(whoami, error, "Unable to construct local path");
        return error;
     }
@@ -393,6 +404,7 @@ afs_int32 time, length;
        return 0;
 }
 
+int
 FetchFile(call, remoteFile, localFile, dirFlag)
   struct rx_call *call;
   char *localFile, *remoteFile;
@@ -436,7 +448,9 @@ int update_ReceiveFile(fd, call, status)
 {
     register char *buffer = (char*) 0;
     afs_int32 length;
+#ifdef notdef
     XDR xdr;
+#endif
     register int blockSize;
     afs_int32 error = 0, len;
 #ifdef AFS_AIX_ENV
@@ -467,7 +481,7 @@ int update_ReceiveFile(fd, call, status)
        return UPDATE_ERROR;
     }
     while (!error && length) {
-       register nbytes = (length>blockSize?blockSize:length);
+       register int nbytes = (length>blockSize?blockSize:length);
        nbytes = rx_Read(call, buffer, nbytes);
        if (!nbytes) error = UPDATE_ERROR;
        if (write(fd, buffer, nbytes) != nbytes) {
@@ -552,7 +566,7 @@ int NotOnHost(filename, okhostfiles)
     
     for(tf=okhostfiles; tf; tf=tf->next) {
        /* construct local path from canonical (wire-format) path */
-       if (rc = ConstructLocalPath(tf->name, "/", &hostfile)) {
+       if ((rc = ConstructLocalPath(tf->name, "/", &hostfile))) {
            com_err(whoami, rc, "Unable to construct local path");
            return -1;
        }
@@ -578,7 +592,7 @@ static int RenameNewFiles(struct filestr *modFiles)
 
   for(tf = modFiles; tf; tf=tf->next) {
       /* construct local path from canonical (wire-format) path */
-      if (errcode = ConstructLocalPath(tf->name, "/", &fname)) {
+      if ((errcode = ConstructLocalPath(tf->name, "/", &fname))) {
          com_err(whoami, errcode, "Unable to construct local path");
          return errcode;
       }
@@ -652,7 +666,8 @@ int GetFileFromUpServer(struct rx_connection *conn, /* handle for upserver */
   /* now set the rest of the file status */
   errcode = chmod(newfile, mode);
   if(errcode){
-    printf("could not change protection on %s to %u\n",newfile, mode);
+    printf("could not change protection on %s to %u\n",newfile, 
+       (unsigned int) mode);
     com_err (whoami, errno,
             "could not change protection on %s to %u",
             newfile, mode);
@@ -676,7 +691,7 @@ int GetFileFromUpServer(struct rx_connection *conn, /* handle for upserver */
   errcode = utimes(newfile, tvp);
 #endif /* NT40 */
   if (errcode) {
-    printf("could not change access and modify times on %s to %u %u\n",newfile, atime, mtime);
+    printf("could not change access and modify times on %s to %u %u\n",newfile, (unsigned int) atime, (unsigned int) mtime);
     com_err (whoami, errno,
             "could not change access and modify times on %s to %u %u",newfile, atime, mtime);
     return 1;
index 88b1409..bf584a7 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include <afs/param.h>
+#include <afsconfig.h>
 #include <afs/stds.h>
 #ifdef AFS_AIX32_ENV
 #include <signal.h>
 #include <sys/file.h>
 #include <dirent.h>
 #endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 #include <sys/stat.h>
 #include <errno.h>
 #include <stdio.h>
 #include <afs/afsutil.h>
 #include <afs/fileutil.h>
 
+RCSID("$Header$");
+
 #include "update.h"
 #include "global.h"
 
 
-extern UPDATE_ExecuteRequest();
+extern int UPDATE_ExecuteRequest();
 static int AddObject(char **expPath, char *dir);
 static int PathInDirectory(char *dir, char *path);
 
@@ -50,7 +62,7 @@ char *dirName[MAXENTRIES];
 int   dirLevel[MAXENTRIES];
 char *whoami;
 
-static Quit();
+static int Quit();
 
 /* check whether caller is authorized to manage RX statistics */
 int update_rxstat_userok(call)
@@ -166,7 +178,7 @@ int main (argc, argv)
     extern struct rx_securityClass *rxnull_NewServerSecurityObject();
     extern afs_int32 afsconf_GetKey();
 
-    int a;
+    int a = 0;
     rxkad_level level;
     rxkad_level newLevel;
 
@@ -215,10 +227,8 @@ int main (argc, argv)
 
     for (a=1; a<argc; a++) {
        if (argv[a][0] == '-') { /* parse options */
-           int arglen = strlen(argv[a]);
            char arg[256];
            lcstring (arg, argv[a], sizeof(arg));
-#define IsArg(a) (strncmp (arg,a, arglen) == 0)
            newLevel = StringToLevel (&argv[a][1]);
            if (newLevel != -1) {
                level = newLevel;       /* set new level */
@@ -286,6 +296,7 @@ int main (argc, argv)
 
     rx_StartServer(1); /* Donate this process to the server process pool */
     Quit("StartServer returned?");
+    return 0;
 }
 
 /* fetch the file name and send it to the remote requester specified by call */
@@ -300,7 +311,7 @@ int UPDATE_FetchFile(call, name)
     char *reqObject;
 
     /* construct a local path from a canonical (wire-format) path */
-    if ( error = ConstructLocalPath(name, "/", &reqObject) ) {
+    if ((error = ConstructLocalPath(name, "/", &reqObject))) {
        com_err(whoami, error, "Unable to construct local path");
        return UPDATE_ERROR;
     }
@@ -332,7 +343,7 @@ int UPDATE_FetchInfo(call, name)
     char *reqObject;
 
     /* construct a local path from a canonical (wire-format) path */
-    if ( error = ConstructLocalPath(name, "/", &reqObject) ) {
+    if ((error = ConstructLocalPath(name, "/", &reqObject))) {
        com_err(whoami, error, "Unable to construct local path");
        return UPDATE_ERROR;
     }
@@ -358,7 +369,7 @@ int UPDATE_FetchInfo(call, name)
     return error;
 } 
 
-static Quit(msg, a, b)
+static int Quit(msg, a, b)
     char *msg;
 {
     fprintf(stderr, msg, a, b);
@@ -373,7 +384,9 @@ register struct stat *status;
     char *buffer = (char*) 0;
     int blockSize;
     afs_int32 length, tlen;
+#ifdef notdef
     XDR xdr;
+#endif
 #ifdef AFS_AIX_ENV
 #include <sys/statfs.h>
     struct statfs tstatfs;
@@ -403,7 +416,7 @@ register struct stat *status;
     rx_Write(call, &tlen, sizeof(afs_int32));  /* send length on fetch */
 #endif
     while (!error && length) {
-       register nbytes = (length>blockSize?blockSize:length);
+       register int nbytes = (length>blockSize?blockSize:length);
        nbytes = read(fd, buffer, nbytes);
        if (nbytes <= 0) {
            fprintf(stderr, "File system read failed\n");
@@ -440,7 +453,7 @@ char *origDir;                   /* orig name of dir before being localized */
     if (!stream) {
        error = EIO;
     } else {
-       while(dp = readdir(dirp)){
+       while((dp = readdir(dirp))){
            strcpy(filename, name);
            strcat(filename,"/");
            strcat(filename,dp->d_name);
@@ -456,7 +469,13 @@ char *origDir;                   /* orig name of dir before being localized */
                
                strcpy(dirEntry, origDir); strcat(dirEntry, "/");
                strcat(dirEntry, dp->d_name);
-               err = fprintf(stream, "\"%s\" %u %u %u %u %u %u\n", dirEntry, tstatus.st_mtime,tstatus.st_size,tstatus.st_mode,tstatus.st_uid,tstatus.st_gid, tstatus.st_atime);
+               err = fprintf(stream, "\"%s\" %u %u %u %u %u %u\n", dirEntry, 
+                       (unsigned int) tstatus.st_mtime,
+                       (unsigned int) tstatus.st_size,
+                       tstatus.st_mode,
+                       tstatus.st_uid,
+                       tstatus.st_gid, 
+                       (unsigned int) tstatus.st_atime);
                if (err < 0) error = EIO;
            }   
            err = close(tfd);
@@ -502,7 +521,7 @@ static int AddObject(char **expPath, char *dir)
   struct stat statbuf;
 
   /* construct a local path from a canonical (wire-format) path */
-  if ( error = ConstructLocalPath(dir, "/", expPath) ) {
+  if ((error = ConstructLocalPath(dir, "/", expPath))) {
       com_err(whoami, error, "Unable to construct local path");
       return error;
   }
index 443cbe7..5573edd 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include <afs/param.h>
+#include <afsconfig.h>
 #include <afs/stds.h>
 #include <rx/rxkad.h>
 #include "global.h"
 #include <WINNT/afssw.h>
 #endif
 #include <stdio.h>
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <stdlib.h>
 
+RCSID("$Header$");
 
+int
 AddToList(ah, aname)
 struct filestr **ah;
 char *aname; {
@@ -31,6 +44,7 @@ char *aname; {
     return 0;
 }
 
+int
 ZapList(ah)
 struct filestr **ah; {
     register struct filestr *tf, *nf;