[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.27 and 1.28

version 1.27, 2014/07/05 05:05:51 version 1.28, 2014/07/05 06:18:58
Line 275 
Line 275 
 /*  /*
  * Send a command message to the remote host.   * Send a command message to the remote host.
  * Called as sendcmd(char cmdchar, char *fmt, arg1, arg2, ...)   * Called as sendcmd(char cmdchar, char *fmt, arg1, arg2, ...)
  * The fmt and arg? arguments are optional.   * The fmt may be NULL, in which case there are no args.
  */   */
 #if     defined(ARG_TYPE) && ARG_TYPE == ARG_STDARG  
 /*  
  * Stdarg frontend to sendcmdmsg()  
  */  
 int  int
 sendcmd(char cmd, char *fmt, ...)  sendcmd(char cmd, const char *fmt, ...)
 {  {
         static char buf[BUFSIZ];          static char buf[BUFSIZ];
         va_list args;          va_list args;
Line 297 
Line 293 
   
         return(sendcmdmsg(cmd, buf, sizeof(buf)));          return(sendcmdmsg(cmd, buf, sizeof(buf)));
 }  }
 #endif  /* ARG_TYPE == ARG_STDARG */  
   
 #if     defined(ARG_TYPE) && ARG_TYPE == ARG_VARARGS  
 /*  /*
  * Varargs frontend to sendcmdmsg()  
  */  
 int  
 sendcmd(va_alist)  
         va_dcl  
 {  
         static char buf[BUFSIZ];  
         va_list args;  
         char cmd;  
         char *fmt;  
   
         va_start(args);  
         /* XXX The "int" is necessary as a workaround for broken varargs */  
         cmd = (char) va_arg(args, int);  
         fmt = va_arg(args, char *);  
         if (fmt)  
                 (void) vsnprintf(buf + (cmd != C_NONE),  
                                  sizeof(buf) - (cmd != C_NONE), fmt, args);  
         else  
                 buf[1] = CNULL;  
         va_end(args);  
   
         return(sendcmdmsg(cmd, buf, sizeof(buf)));  
 }  
 #endif  /* ARG_TYPE == ARG_VARARGS */  
   
 /*  
  * Internal variables and routines for reading lines from the remote.   * Internal variables and routines for reading lines from the remote.
  */   */
 static u_char rembuf[BUFSIZ];  static u_char rembuf[BUFSIZ];
Line 918 
Line 885 
                         *space = ' ';           /* Put back what we zapped */                          *space = ' ';           /* Put back what we zapped */
         }          }
         return (file);          return (file);
 }  
   
 /*  
  * Set line buffering.  
  */  
 int  
 mysetlinebuf(FILE *fp)  
 {  
 #if     SETBUF_TYPE == SETBUF_SETLINEBUF  
         return(setlinebuf(fp));  
 #endif  /* SETBUF_SETLINEBUF */  
 #if     SETBUF_TYPE == SETBUF_SETVBUF  
         return(setvbuf(stdout, NULL, _IOLBF, BUFSIZ));  
 #endif  /* SETBUF_SETVBUF */  
 #if     !defined(SETBUF_TYPE)  
         No SETBUF_TYPE is defined!  
 #endif  /* SETBUF_TYPE */  
 }  }

Legend:
Removed from v.1.27  
changed lines
  Added in v.1.28