[BACK]Return to common.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / rdist

Diff for /src/usr.bin/rdist/common.c between version 1.5 and 1.6

version 1.5, 1997/10/07 23:39:34 version 1.6, 1998/06/26 21:21:01
Line 34 
Line 34 
  */   */
   
 #ifndef lint  #ifndef lint
   #if 0
 static char RCSid[] =  static char RCSid[] =
   "$From: common.c,v 6.82 1998/03/23 23:27:33 michaelc Exp $";
   #else
   static char RCSid[] =
 "$OpenBSD$";  "$OpenBSD$";
   #endif
   
 static char sccsid[] = "@(#)common.c";  static char sccsid[] = "@(#)common.c";
   
Line 52 
Line 57 
 #if     defined(NEED_UTIME_H)  #if     defined(NEED_UTIME_H)
 #include <utime.h>  #include <utime.h>
 #endif  /* defined(NEED_UTIME_H) */  #endif  /* defined(NEED_UTIME_H) */
   #include <sys/socket.h>
   #include <sys/wait.h>
   
 /*  /*
  * Variables common to both client and server   * Variables common to both client and server
Line 111 
Line 118 
   
         if (!progname) {          if (!progname) {
                 progname = strdup(argv[0]);                  progname = strdup(argv[0]);
                 if (cp = strrchr(progname, '/'))                  if ((cp = strrchr(progname, '/')))
                         progname = cp + 1;                          progname = cp + 1;
         }          }
 }  }
Line 141 
Line 148 
         for (i = 0; i < argc; i++)          for (i = 0; i < argc; i++)
                 realargv[i] = strdup(argv[i]);                  realargv[i] = strdup(argv[i]);
   
 #if     defined(SETARGS) && !defined(__OpenBSD__)  #if     defined(SETARGS)
         setargs_settup(argc, argv, envp);          setargs_settup(argc, argv, envp);
 #endif  /* SETARGS */  #endif  /* SETARGS */
   
Line 488 
Line 495 
 /*  /*
  * Non-line-oriented remote read.   * Non-line-oriented remote read.
  */   */
   int
 readrem(p, space)  readrem(p, space)
         char *p;          char *p;
         register int space;          register int space;
Line 542 
Line 550 
         /*          /*
          * Try to avoid getpwuid() call.           * Try to avoid getpwuid() call.
          */           */
         if (lastuid == uid && buf[0] && buf[0] != ':')          if (lastuid == uid && buf[0] != '\0' && buf[0] != ':')
                 return(buf);                  return(buf);
   
         lastuid = uid;          lastuid = uid;
Line 581 
Line 589 
         /*          /*
          * Try to avoid getgrgid() call.           * Try to avoid getgrgid() call.
          */           */
         if (lastgid == gid && buf[0] && buf[0] != ':')          if (lastgid == gid && buf[0] != '\0' && buf[0] != ':')
                 return(buf);                  return(buf);
   
         lastgid = gid;          lastgid = gid;
Line 688 
Line 696 
                         *s3 = '/';                          *s3 = '/';
                 s2 = pw->pw_dir;                  s2 = pw->pw_dir;
         }          }
         for (s1 = ebuf; *s1++ = *s2++; )          for (s1 = ebuf; (*s1++ = *s2++); )
                 ;                  ;
         s2 = --s1;          s2 = --s1;
         if (s3 != NULL) {          if (s3 != NULL) {
                 s2++;                  s2++;
                 while (*s1++ = *s3++)                  while ((*s1++ = *s3++))
                         ;                          ;
         }          }
         return(s2);          return(s2);
Line 761 
Line 769 
                 tv[0].tv_usec = tv[1].tv_usec = (time_t) 0;                  tv[0].tv_usec = tv[1].tv_usec = (time_t) 0;
                 return(utimes(file, tv));                  return(utimes(file, tv));
         } else  /* Set to current time */          } else  /* Set to current time */
                 return(utimes(file, (struct timeval *) NULL));                  return(utimes(file, NULL));
   
 #endif  /* SETFTIME_UTIMES */  #endif  /* SETFTIME_UTIMES */
   
Line 773 
Line 781 
                 utbuf.modtime = mtime;                  utbuf.modtime = mtime;
                 return(utime(file, &utbuf));                  return(utime(file, &utbuf));
         } else  /* Set to current time */          } else  /* Set to current time */
                 return(utime(file, (struct utimbuf *)NULL));                  return(utime(file, NULL));
 #endif  /* SETFTIME_UTIME */  #endif  /* SETFTIME_UTIME */
   
 #if     !defined(SETFTIME_TYPE)  #if     !defined(SETFTIME_TYPE)
Line 932 
Line 940 
 {  {
         register char *cp;          register char *cp;
   
         if (cp = strrchr(path, '/'))          if ((cp = strrchr(path, '/')))
                 return(cp+1);                  return(cp+1);
         else          else
                 return(path);                  return(path);
Line 952 
Line 960 
   
         for (; ;) {          for (; ;) {
                 if (!path)                  if (!path)
                         return((char *) NULL);                          return(NULL);
                 file = path;                  file = path;
                 cp = strchr(path, ':');                  cp = strchr(path, ':');
                 if (cp) {                  if (cp) {
Line 971 
Line 979 
 /*  /*
  * Set line buffering.   * Set line buffering.
  */   */
 extern int  extern void
 mysetlinebuf(fp)  mysetlinebuf(fp)
         FILE *fp;          FILE *fp;
 {  {
 #if     SETBUF_TYPE == SETBUF_SETLINEBUF  #if     SETBUF_TYPE == SETBUF_SETLINEBUF
         return(setlinebuf(fp));          setlinebuf(fp);
 #endif  /* SETBUF_SETLINEBUF */  #endif  /* SETBUF_SETLINEBUF */
 #if     SETBUF_TYPE == SETBUF_SETVBUF  #if     SETBUF_TYPE == SETBUF_SETVBUF
         return(setvbuf(stdout, NULL, _IOLBF, BUFSIZ));          setvbuf(stdout, NULL, _IOLBF, BUFSIZ);
 #endif  /* SETBUF_SETVBUF */  #endif  /* SETBUF_SETVBUF */
 #if     !defined(SETBUF_TYPE)  #if     !defined(SETBUF_TYPE)
         No SETBUF_TYPE is defined!          No SETBUF_TYPE is defined!

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6