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

Diff for /src/usr.bin/rdist/message.c between version 1.6 and 1.7

version 1.6, 1996/07/29 17:50:09 version 1.7, 1998/06/26 21:21:15
Line 34 
Line 34 
  */   */
   
 #ifndef lint  #ifndef lint
   #if 0
 static char RCSid[] =  static char RCSid[] =
   "$From: message.c,v 6.24 1996/07/19 17:00:35 michaelc Exp $";
   #else
   static char RCSid[] =
 "$OpenBSD$";  "$OpenBSD$";
   #endif
   
 static char sccsid[] = "@(#)common.c";  static char sccsid[] = "@(#)common.c";
   
Line 145 
Line 150 
                 if (strcasecmp(name, msgfacility[i].mf_name) == 0)                  if (strcasecmp(name, msgfacility[i].mf_name) == 0)
                         return(&msgfacility[i]);                          return(&msgfacility[i]);
   
         return((MSGFACILITY *) NULL);          return(NULL);
 }  }
   
 /*  /*
Line 160 
Line 165 
                 if (strcasecmp(name, msgtypes[i].mt_name) == 0)                  if (strcasecmp(name, msgtypes[i].mt_name) == 0)
                         return(&msgtypes[i]);                          return(&msgtypes[i]);
   
         return((MSGTYPE *) NULL);          return(NULL);
 }  }
   
 /*  /*
Line 183 
Line 188 
                          msgfac->mf_msgfac != MF_FILE)) {                           msgfac->mf_msgfac != MF_FILE)) {
                 (void) snprintf(ebuf, sizeof(ebuf),                  (void) snprintf(ebuf, sizeof(ebuf),
                 "The \"%s\" message facility cannot be used by the server.",                  "The \"%s\" message facility cannot be used by the server.",
                                msgfac->mf_name);                                  msgfac->mf_name);
                 return(ebuf);                  return(ebuf);
         }          }
   
Line 234 
Line 239 
         msgfac->mf_msgtypes = 0;        /* Start from scratch */          msgfac->mf_msgtypes = 0;        /* Start from scratch */
         while (strptr) {          while (strptr) {
                 word = strptr;                  word = strptr;
                 if (cp = strchr(strptr, ','))                  if ((cp = strchr(strptr, ',')))
                         *cp++ = CNULL;                          *cp++ = CNULL;
                 strptr = cp;                  strptr = cp;
   
                 if (mtp = getmsgtype(word)) {                  if ((mtp = getmsgtype(word))) {
                         msgfac->mf_msgtypes |= mtp->mt_type;                          msgfac->mf_msgtypes |= mtp->mt_type;
                         /*                          /*
                          * XXX This is really a kludge until we add real                           * XXX This is really a kludge until we add real
Line 255 
Line 260 
                 }                  }
         }          }
   
         return((char *) NULL);          return(NULL);
 }  }
   
 /*  /*
Line 280 
Line 285 
          * Each <facility>=<types> list is seperated by ":".           * Each <facility>=<types> list is seperated by ":".
          */           */
         for (optstr = strtok(msgbuf, ":"); optstr;          for (optstr = strtok(msgbuf, ":"); optstr;
              optstr = strtok((char *)NULL, ":")) {               optstr = strtok(NULL, ":")) {
   
                 if ((cp = strchr(optstr, '=')) == NULL)                  if ((cp = strchr(optstr, '=')) == NULL)
                         return("No '=' found");                          return("No '=' found");
Line 302 
Line 307 
                 if (doset) {                  if (doset) {
                         char *mcp;                          char *mcp;
   
                         if (mcp = setmsgtypes(msgfac, cp))                          if ((mcp = setmsgtypes(msgfac, cp)))
                                 return(mcp);                                  return(mcp);
                 }                  }
         }          }
Line 312 
Line 317 
                 msgprconfig();                  msgprconfig();
         }          }
   
         return((char *) NULL);          return(NULL);
 }  }
   
 /*  /*
Line 457 
Line 462 
   
         if (!msgfac->mf_fptr) {          if (!msgfac->mf_fptr) {
                 register char *cp;                  register char *cp;
                 char *getenv();  
                 int fd;                  int fd;
                   char *getenv();
   
                 /*                  /*
                  * Create and open a new temporary file                   * Create and open a new temporary file
                  */                   */
                 if ((cp = getenv("TMPDIR")) == (char *) NULL)                  if ((cp = getenv("TMPDIR")) == NULL)
                         cp = _PATH_TMP;                          cp = _PATH_TMP;
                 tempfile = (char *) xmalloc(strlen(cp) + 1 +                  tempfile = (char *) xmalloc(strlen(cp) + 1 +
                                             strlen(_RDIST_TMP) + 2);                                              strlen(_RDIST_TMP) + 2);
Line 521 
Line 526 
                 /*                  /*
                  * Ensure no stray newlines are present                   * Ensure no stray newlines are present
                  */                   */
                 if (cp = strchr(msgbuf, '\n'))                  if ((cp = strchr(msgbuf, '\n')))
                         *cp = CNULL;                          *cp = CNULL;
   
                 checkhostname();                  checkhostname();
Line 537 
Line 542 
          * logged to the system log facility           * logged to the system log facility
          */           */
         if (IS_ON(flags, MT_SYSLOG)) {          if (IS_ON(flags, MT_SYSLOG)) {
                 msgsendsyslog((MSGFACILITY *)NULL, MT_SYSLOG, flags, mbuf);                  msgsendsyslog(NULL, MT_SYSLOG, flags, mbuf);
                 return;                  return;
         }          }
   
Line 545 
Line 550 
          * Special cases           * Special cases
          */           */
         if (isserver && IS_ON(flags, MT_NOTICE)) {          if (isserver && IS_ON(flags, MT_NOTICE)) {
                 msgsendstdout((MSGFACILITY *)NULL, MT_NOTICE, flags, mbuf);                  msgsendstdout(NULL, MT_NOTICE, flags, mbuf);
                 return;                  return;
         } else if (isserver && IS_ON(flags, MT_REMOTE))          } else if (isserver && IS_ON(flags, MT_REMOTE))
                 msgsendstdout((MSGFACILITY *)NULL, MT_REMOTE, flags, mbuf);                  msgsendstdout(NULL, MT_REMOTE, flags, mbuf);
         else if (isserver && IS_ON(flags, MT_NERROR))          else if (isserver && IS_ON(flags, MT_NERROR))
                 msgsendstdout((MSGFACILITY *)NULL, MT_NERROR, flags, mbuf);                  msgsendstdout(NULL, MT_NERROR, flags, mbuf);
         else if (isserver && IS_ON(flags, MT_FERROR))          else if (isserver && IS_ON(flags, MT_FERROR))
                 msgsendstdout((MSGFACILITY *)NULL, MT_FERROR, flags, mbuf);                  msgsendstdout(NULL, MT_FERROR, flags, mbuf);
   
         /*          /*
          * For each Message Facility, check each Message Type to see           * For each Message Facility, check each Message Type to see
Line 871 
Line 876 
                         return(msgfacility[i].mf_filename);                          return(msgfacility[i].mf_filename);
                 }                  }
   
         return((char *) NULL);          return(NULL);
 }  }

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