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

Diff for /src/usr.bin/finger/util.c between version 1.5 and 1.6

version 1.5, 1997/05/30 23:35:53 version 1.6, 1997/06/02 21:33:28
Line 47 
Line 47 
 #include <sys/param.h>  #include <sys/param.h>
 #include <sys/stat.h>  #include <sys/stat.h>
 #include <sys/file.h>  #include <sys/file.h>
   #include <err.h>
 #include <stdio.h>  #include <stdio.h>
 #include <stdlib.h>  #include <stdlib.h>
 #include <ctype.h>  #include <ctype.h>
Line 54 
Line 55 
 #include <paths.h>  #include <paths.h>
 #include <errno.h>  #include <errno.h>
 #include <unistd.h>  #include <unistd.h>
   #include <vis.h>
 #include "finger.h"  #include "finger.h"
 #include "extern.h"  #include "extern.h"
   
Line 377 
Line 379 
         *p++ = *num++;          *p++ = *num++;
         *p = '\0';          *p = '\0';
         return(pbuf);          return(pbuf);
   }
   
   /* Like strvis(), but use malloc() to get the space and return a pointer
    * to the beginning of the converted string, not the end.
    *
    * Recycle the malloc()ed area on each call.  This leads to a leak which
    * does not grow.
    */
   char *
   vs(src)
           char *src;
   {
           static char *dst = NULL;
   
           if (dst != NULL)
                   free(dst);
           if ((dst = malloc((4 * strlen(src)) + 1)) == NULL)
                   err(1, "malloc failed");
   
           strvis(dst, src, VIS_SAFE|VIS_NOSLASH);
           return(dst);
 }  }

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