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

Diff for /src/usr.bin/tip/Attic/value.c between version 1.19 and 1.20

version 1.19, 2010/06/29 05:55:37 version 1.20, 2010/06/29 20:57:33
Line 38 
Line 38 
 static void vassign(value_t *, char *);  static void vassign(value_t *, char *);
 static void vtoken(char *);  static void vtoken(char *);
 static void vprint(value_t *);  static void vprint(value_t *);
 static int vaccess(unsigned int, unsigned int);  
 static char *vinterp(char *, int);  static char *vinterp(char *, int);
   
 static size_t col = 0;  static size_t col = 0;
Line 83 
Line 82 
                         fclose(fp);                          fclose(fp);
                 }                  }
         }          }
         /*  
          * To allow definition of exception prior to fork  
          */  
         vtable[EXCEPTIONS].v_access &= ~(WRITE<<PUBLIC);  
 }  }
   
 /*VARARGS1*/  /*VARARGS1*/
 static void  static void
 vassign(value_t *p, char *v)  vassign(value_t *p, char *v)
 {  {
         if (!vaccess(p->v_access, WRITE)) {          if (p->v_access & READONLY) {
                 printf("access denied\r\n");                  printf("access denied\r\n");
                 return;                  return;
         }          }
Line 136 
Line 131 
   
         if (strcmp(s, "all") == 0) {          if (strcmp(s, "all") == 0) {
                 for (p = vtable; p->v_name; p++)                  for (p = vtable; p->v_name; p++)
                         if (vaccess(p->v_access, READ))                          vprint(p);
                                 vprint(p);  
         } else {          } else {
                 do {                  do {
                         if ((cp = vinterp(s, ' ')))                          if ((cp = vinterp(s, ' ')))
Line 173 
Line 167 
                 }                  }
         } else if ((cp = strchr(s, '?'))) {          } else if ((cp = strchr(s, '?'))) {
                 *cp = '\0';                  *cp = '\0';
                 if ((p = vlookup(s)) && vaccess(p->v_access, READ)) {                  if (p = vlookup(s)) {
                         vprint(p);                          vprint(p);
                         return;                          return;
                 }                  }
Line 239 
Line 233 
                 printf("\r\n");                  printf("\r\n");
                 return;                  return;
         }          }
 }  
   
 static int  
 vaccess(unsigned int mode, unsigned int rw)  
 {  
         if (mode & (rw<<PUBLIC))  
                 return (1);  
         if (mode & (rw<<PRIVATE))  
                 return (1);  
         return ((mode & (rw<<ROOT)) && getuid() == 0);  
 }  }
   
 static value_t *  static value_t *

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.20