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

Diff for /src/usr.bin/sudo/Attic/fileops.c between version 1.5 and 1.6

version 1.5, 2007/07/26 16:10:16 version 1.6, 2008/11/14 11:58:08
Line 1 
Line 1 
 /*  /*
  * Copyright (c) 1999-2005 Todd C. Miller <Todd.Miller@courtesan.com>   * Copyright (c) 1999-2005, 2007 Todd C. Miller <Todd.Miller@courtesan.com>
  *   *
  * Permission to use, copy, modify, and distribute this software for any   * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above   * purpose with or without fee is hereby granted, provided that the above
Line 27 
Line 27 
 # include <sys/file.h>  # include <sys/file.h>
 #endif /* HAVE_FLOCK */  #endif /* HAVE_FLOCK */
 #include <stdio.h>  #include <stdio.h>
   #ifdef HAVE_STRING_H
   # include <string.h>
   #else
   # ifdef HAVE_STRINGS_H
   #  include <strings.h>
   # endif
   #endif /* HAVE_STRING_H */
   #include <ctype.h>
   #include <limits.h>
 #ifdef HAVE_UNISTD_H  #ifdef HAVE_UNISTD_H
 # include <unistd.h>  # include <unistd.h>
 #endif /* HAVE_UNISTD_H */  #endif /* HAVE_UNISTD_H */
Line 40 
Line 49 
   
 #include "sudo.h"  #include "sudo.h"
   
   #ifndef LINE_MAX
   # define LINE_MAX 2048
   #endif
   
 #ifndef lint  #ifndef lint
 __unused static const char rcsid[] = "$Sudo: fileops.c,v 1.5.2.5 2007/06/12 01:28:41 millert Exp $";  __unused static const char rcsid[] = "$Sudo: fileops.c,v 1.16 2008/11/09 14:13:12 millert Exp $";
 #endif /* lint */  #endif /* lint */
   
 /*  /*
Line 139 
Line 152 
 #endif  #endif
 }  }
 #endif  #endif
   
   /*
    * Read a line of input, remove comments and strip off leading
    * and trailing spaces.  Returns static storage that is reused.
    */
   char *
   sudo_parseln(fp)
       FILE *fp;
   {
       size_t len;
       char *cp = NULL;
       static char buf[LINE_MAX];
   
       if (fgets(buf, sizeof(buf), fp) != NULL) {
           /* Remove comments */
           if ((cp = strchr(buf, '#')) != NULL)
               *cp = '\0';
   
           /* Trim leading and trailing whitespace/newline */
           len = strlen(buf);
           while (len > 0 && isspace(buf[len - 1]))
               buf[--len] = '\0';
           for (cp = buf; isblank(*cp); cp++)
               continue;
       }
       return(cp);
   }

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