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

Diff for /src/usr.bin/getent/getent.c between version 1.9 and 1.10

version 1.9, 2015/01/16 06:40:08 version 1.10, 2015/10/10 05:26:57
Line 34 
Line 34 
 #include <sys/socket.h>  #include <sys/socket.h>
   
 #include <ctype.h>  #include <ctype.h>
   #include <err.h>
 #include <errno.h>  #include <errno.h>
 #include <grp.h>  #include <grp.h>
 #include <limits.h>  #include <limits.h>
Line 75 
Line 76 
 static struct getentdb {  static struct getentdb {
         const char      *name;          const char      *name;
         int             (*fn)(int, char *[]);          int             (*fn)(int, char *[]);
           const char      *pledge;
 } databases[] = {  } databases[] = {
         {       "ethers",       ethers,         },          {       "ethers",       ethers,         "stdio rpath"   },
         {       "group",        group,          },          {       "group",        group,          "stdio rpath"   },
         {       "hosts",        hosts,          },          {       "hosts",        hosts,          "stdio dns"     },
         {       "passwd",       passwd,         },          {       "passwd",       passwd,         "stdio rpath"   },
         {       "protocols",    protocols,      },          {       "protocols",    protocols,      "stdio rpath"   },
         {       "rpc",          rpc,            },          {       "rpc",          rpc,            "stdio rpath"   },
         {       "services",     services,       },          {       "services",     services,       "stdio rpath"   },
         {       "shells",       shells,         },          {       "shells",       shells,         "stdio rpath"   },
   
         {       NULL,           NULL,           },          {       NULL,           NULL,                           },
 };  };
   
 int  int
Line 93 
Line 95 
 {  {
         struct getentdb *curdb;          struct getentdb *curdb;
   
           if (pledge("stdio dns rpath", NULL) == -1)
                   err(1, "pledge");
   
         if (argc < 2)          if (argc < 2)
                 usage();                  usage();
         for (curdb = databases; curdb->name != NULL; curdb++) {          for (curdb = databases; curdb->name != NULL; curdb++) {
                 if (strcmp(curdb->name, argv[1]) == 0) {                  if (strcmp(curdb->name, argv[1]) == 0) {
                           if (pledge(curdb->pledge, NULL) == -1)
                                   err(1, "pledge");
   
                         exit(curdb->fn(argc, argv));                          exit(curdb->fn(argc, argv));
                         break;                          break;
                 }                  }

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10