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

Diff for /src/usr.bin/chpass/edit.c between version 1.27 and 1.28

version 1.27, 2003/06/03 02:56:06 version 1.28, 2005/11/14 15:31:11
Line 56 
Line 56 
 #include "chpass.h"  #include "chpass.h"
   
 int  int
 edit(tempname, pw)  edit(char *tempname, struct passwd *pw)
         char *tempname;  
         struct passwd *pw;  
 {  {
         struct stat begin, end;          struct stat begin, end;
   
Line 86 
Line 84 
  *      set conditional flag if the user gets to edit the shell.   *      set conditional flag if the user gets to edit the shell.
  */   */
 void  void
 display(tempname, fd, pw)  display(char *tempname, int fd, struct passwd *pw)
         char *tempname;  
         int fd;  
         struct passwd *pw;  
 {  {
         FILE *fp;          FILE *fp;
         char *bp, *p;          char *bp, *p;
Line 139 
Line 134 
 }  }
   
 int  int
 verify(tempname, pw)  verify(char *tempname, struct passwd *pw)
         char *tempname;  
         struct passwd *pw;  
 {  {
         unsigned int len, alen, line;          unsigned int alen, line;
         static char buf[LINE_MAX];          static char buf[LINE_MAX];
         struct stat sb;          struct stat sb;
         char *p, *q;          char *p, *q;
Line 218 
Line 211 
                 list[E_LOCATE].save = "";                  list[E_LOCATE].save = "";
   
         /* Build the gecos field. */          /* Build the gecos field. */
         len = strlen(list[E_NAME].save) + strlen(list[E_BPHONE].save) +  
             strlen(list[E_HPHONE].save) + strlen(list[E_LOCATE].save) + 4;  
         for (alen = 0, p = list[E_NAME].save; *p; p++)          for (alen = 0, p = list[E_NAME].save; *p; p++)
                 if (*p == '&')                  if (*p == '&')
                         alen = alen + strlen(pw->pw_name) - 1;                          alen = alen + strlen(pw->pw_name) - 1;
         if (!(p = malloc(len)))          if (asprintf(&p, "%s,%s,%s,%s", list[E_NAME].save,
               list[E_LOCATE].save, list[E_BPHONE].save, list[E_HPHONE].save) == -1)
                 err(1, NULL);                  err(1, NULL);
         (void)snprintf(p, len, "%s,%s,%s,%s", list[E_NAME].save,  
             list[E_LOCATE].save, list[E_BPHONE].save, list[E_HPHONE].save);  
         pw->pw_gecos = p;          pw->pw_gecos = p;
   
         if (snprintf(buf, sizeof(buf),          if (snprintf(buf, sizeof(buf),

Legend:
Removed from v.1.27  
changed lines
  Added in v.1.28