Diff for /src/usr.sbin/cron/lib/misc.c between versions 1.3 and 1.4

version 1.3, 2003/11/16 11:51:15 version 1.4, 2004/03/10 18:27:28
Line 51  static int  LogFD = ERR; Line 51  static int  LogFD = ERR;
 int  int
 strcmp_until(char *left, char *right, int until)  strcmp_until(char *left, char *right, int until)
 {  {
        register int        diff;        int diff;
   
         while (*left && *left != until && *left == *right) {          while (*left && *left != until && *left == *right) {
                 left++;                  left++;
Line 422  allowed(char *username) Line 422  allowed(char *username)
 void  void
 log_it(char *username, int xpid, char *event, char *detail)  log_it(char *username, int xpid, char *event, char *detail)
 {  {
        PID_T                   pid = xpid;        PID_T pid = xpid;
 #if defined(LOG_FILE)  #if defined(LOG_FILE)
        char                    *msg;        char *msg;
        TIME_T                  now = time((TIME_T) 0);        TIME_T now;
        register struct tm      *t = localtime(&now);        struct tm *t;
 #endif /*LOG_FILE*/  #endif /*LOG_FILE*/
   
 #if defined(SYSLOG)  #if defined(SYSLOG)
Line 434  log_it(char *username, int xpid, char *e Line 434  log_it(char *username, int xpid, char *e
 #endif  #endif
   
 #if defined(LOG_FILE)  #if defined(LOG_FILE)
           now = time((TIME_T)0);
           t = localtime(&now);
         /* we assume that MAX_TEMPSTR will hold the date, time, &punctuation.          /* we assume that MAX_TEMPSTR will hold the date, time, &punctuation.
          */           */
         msg = malloc(strlen(username)          msg = malloc(strlen(username)
Line 520  log_close(void) { Line 522  log_close(void) {
  * t    terminators, implicitly including \0   * t    terminators, implicitly including \0
  */   */
 char *  char *
first_word(register char *s, register char *t)first_word(char *s, char *t)
 {  {
         static char retbuf[2][MAX_TEMPSTR + 1]; /* sure wish C had GC */          static char retbuf[2][MAX_TEMPSTR + 1]; /* sure wish C had GC */
         static int retsel = 0;          static int retsel = 0;
        register char *rb, *rp;        char *rb, *rp;
   
         /* select a return buffer */          /* select a return buffer */
         retsel = 1-retsel;          retsel = 1-retsel;
Line 551  first_word(register char *s, register ch Line 553  first_word(register char *s, register ch
  *      heavily ascii-dependent.   *      heavily ascii-dependent.
  */   */
 void  void
mkprint(register char *dst, register unsigned char *src, register int len)mkprint(char *dst, unsigned char *src, int len)
 {  {
         while (len-- > 0)          while (len-- > 0)
         {          {
                register unsigned char ch = *src++;                unsigned char ch = *src++;
   
                 if (ch < ' ') {                 /* control character */                  if (ch < ' ') {                 /* control character */
                         *dst++ = '^';                          *dst++ = '^';
Line 578  mkprint(register char *dst, register uns Line 580  mkprint(register char *dst, register uns
  *      returns a pointer to malloc'd storage, you must call free yourself.   *      returns a pointer to malloc'd storage, you must call free yourself.
  */   */
 char *  char *
mkprints(register unsigned char *src, register unsigned int len)mkprints(unsigned char *src, unsigned int len)
 {  {
        register char *dst = malloc(len*4 + 1);        char *dst;
        
         dst = malloc(len * 4 + 1);
         if (dst != NULL)          if (dst != NULL)
                 mkprint(dst, src, len);                  mkprint(dst, src, len);
   

Removed from v.1.3  
changed lines
  Added in v.1.4