[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.21 and 1.22

version 1.21, 2005/03/15 12:28:48 version 1.22, 2005/08/23 13:43:53
Line 61 
Line 61 
 void    find_idle_and_ttywrite(WHERE *);  void    find_idle_and_ttywrite(WHERE *);
 void    userinfo(PERSON *, struct passwd *);  void    userinfo(PERSON *, struct passwd *);
   
   struct storage {
           struct storage *next;
           char a[1];
   };
   
 void  void
   free_storage(struct storage *st)
   {
           struct storage *nx;
   
           while (st != NULL) {
                   nx = st->next;
                   free(st);
                   st = nx;
           }
   }
   
   void
 find_idle_and_ttywrite(WHERE *w)  find_idle_and_ttywrite(WHERE *w)
 {  {
         struct stat sb;          struct stat sb;
Line 376 
Line 393 
  * The caller is responsible for free()'ing the returned string.   * The caller is responsible for free()'ing the returned string.
  */   */
 char *  char *
 vs(char *src)  vs(struct storage **exist, char *src)
 {  {
         char *dst;          char *dst;
           struct storage *n;
   
         if ((dst = malloc((4 * strlen(src)) + 1)) == NULL)          if ((n = malloc(sizeof(struct storage) + 4 * strlen(src))) == NULL)
                 err(1, "malloc failed");                  err(1, "malloc failed");
           n->next = *exist;
           *exist = n;
   
           dst = n->a;
   
         strvis(dst, src, VIS_SAFE|VIS_NOSLASH);          strvis(dst, src, VIS_SAFE|VIS_NOSLASH);
         return (dst);          return (dst);

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.22