#include #include #include #include #include #include #include #include #include struct ypalias { char *alias, *name; } ypaliases[] = { { "passwd", "passwd.byname" }, { "group", "group.byname" }, { "networks", "networks.byaddr" }, { "hosts", "hosts.byaddr" }, { "protocols", "protocols.bynumber" }, { "services", "services.byname" }, { "aliases", "mail.aliases" }, { "ethers", "ethers.byname" }, }; usage() { fprintf(stderr, "Usage:\n"); fprintf(stderr, "\typmatch [-d domain] [-t] [-k] key [key ...] mname\n"); fprintf(stderr, "\typmatch -x\n"); fprintf(stderr, "where\n"); fprintf(stderr, "\tmname may be either a mapname or a nickname for a map\n"); fprintf(stderr, "\t-t inhibits map nickname translation\n"); fprintf(stderr, "\t-k prints keys as well as values.\n"); fprintf(stderr, "\t-x dumps the map nickname translation table.\n"); exit(1); } int main(argc, argv) char **argv; { char *domainname; char *inkey, *inmap, *outbuf; extern char *optarg; extern int optind; int outbuflen, key, notrans; int c, r, i; notrans = key = 0; yp_get_default_domain(&domainname); while( (c=getopt(argc, argv, "xd:kt")) != -1) switch(c) { case 'x': for(i=0; i