Print this page
3243 Add shadow support to getent(1)

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/getent/getent.c
          +++ new/usr/src/cmd/getent/getent.c
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13   *
  14   14   * When distributing Covered Code, include this CDDL HEADER in each
  15   15   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16   16   * If applicable, add the following below this CDDL HEADER, with the
  17   17   * fields enclosed by brackets "[]" replaced with your own identifying
  18   18   * information: Portions Copyright [yyyy] [name of copyright owner]
  19   19   *
  20   20   * CDDL HEADER END
  21   21   */
  22   22  /*
       23 + * Copyright (c) 2014 Gary Mills
  23   24   * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  24   25   * Use is subject to license terms.
  25   26   */
  26   27  
  27      -#pragma ident   "%Z%%M% %I%     %E% SMI"
  28      -
  29   28  #include <stdlib.h>
  30   29  #include <stdio.h>
  31   30  #include <string.h>
  32   31  #include <locale.h>
  33   32  #include <unistd.h>
  34   33  #include "getent.h"
  35   34  
  36   35  static const char *cmdname;
  37   36  
  38   37  struct table {
  39   38          char    *name;                  /* name of the table */
  40   39          int     (*func)(const char **); /* function to do the lookup */
  41   40  };
  42   41  
  43   42  static struct table t[] = {
  44   43          { "passwd",     dogetpw },
       44 +        { "shadow",     dogetsp },
  45   45          { "group",      dogetgr },
  46   46          { "hosts",      dogethost },
  47   47          { "ipnodes",    dogetipnodes },
  48   48          { "services",   dogetserv },
  49   49          { "protocols",  dogetproto },
  50   50          { "ethers",     dogetethers },
  51   51          { "networks",   dogetnet },
  52   52          { "netmasks",   dogetnetmask },
  53   53          { "project",    dogetproject },
  54   54          { NULL,         NULL }
↓ open down ↓ 20 lines elided ↑ open up ↑
  75   75                  usage();
  76   76  
  77   77          for (p = t; p->name != NULL; p++) {
  78   78                  if (strcmp(argv[1], p->name) == 0) {
  79   79                          int rc;
  80   80  
  81   81                          rc = (*p->func)(&argv[2]);
  82   82                          switch (rc) {
  83   83                          case EXC_SYNTAX:
  84   84                                  (void) fprintf(stderr,
  85      -                                        gettext("Syntax error\n"));
       85 +                                    gettext("Syntax error\n"));
  86   86                                  break;
  87   87                          case EXC_ENUM_NOT_SUPPORTED:
  88   88                                  (void) fprintf(stderr,
  89   89          gettext("Enumeration not supported on %s\n"), argv[1]);
  90   90                                  break;
  91   91                          case EXC_NAME_NOT_FOUND:
  92   92                                  break;
  93   93                          }
  94   94                          exit(rc);
  95   95                  }
↓ open down ↓ 13 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX