diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-05-10 13:03:15 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-05-10 13:03:15 +0000 |
commit | 5ffedf96e8370ec9773fd55fe2c8a3734da6c55b (patch) | |
tree | 679a845ee5c1cca45bc837a01891fa7d1681bf76 /usr.bin | |
parent | 5631976dfceacb290bbe4df2c8130fc2272a4d1a (diff) |
: after key, exit val for failure
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/ypmatch/ypmatch.1 | 4 | ||||
-rw-r--r-- | usr.bin/ypmatch/ypmatch.c | 16 |
2 files changed, 12 insertions, 8 deletions
diff --git a/usr.bin/ypmatch/ypmatch.1 b/usr.bin/ypmatch/ypmatch.1 index f39f41e7b3f..1ad6b5baf3c 100644 --- a/usr.bin/ypmatch/ypmatch.1 +++ b/usr.bin/ypmatch/ypmatch.1 @@ -27,7 +27,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: ypmatch.1,v 1.1 1995/10/18 08:47:08 deraadt Exp $ +.\" $Id: ypmatch.1,v 1.2 1996/05/10 13:03:13 deraadt Exp $ .\" .Dd December 3, 1993 .Dt YPMATCH 1 @@ -56,7 +56,7 @@ The options are as follows: .It Fl d Ar domainname Specify a domain other than the default domain. .It Fl k -Display map keys. +Print the map key followed by a colon, before printing key value. This option is useful with maps in which the values are null or the key is not part of the value. .It Fl t diff --git a/usr.bin/ypmatch/ypmatch.c b/usr.bin/ypmatch/ypmatch.c index 4d516ab7126..f13fcccb3af 100644 --- a/usr.bin/ypmatch/ypmatch.c +++ b/usr.bin/ypmatch/ypmatch.c @@ -1,5 +1,5 @@ -/* $OpenBSD: ypmatch.c,v 1.3 1996/05/05 16:19:36 deraadt Exp $ */ -/* $NetBSD: ypmatch.c,v 1.6 1996/04/30 22:58:31 jtc Exp $ */ +/* $OpenBSD: ypmatch.c,v 1.4 1996/05/10 13:03:14 deraadt Exp $ */ +/* $NetBSD: ypmatch.c,v 1.8 1996/05/07 01:24:52 jtc Exp $ */ /* * Copyright (c) 1992, 1993, 1996 Theo de Raadt <deraadt@theos.com> @@ -34,7 +34,7 @@ */ #ifndef LINT -static char rcsid[] = "$OpenBSD: ypmatch.c,v 1.3 1996/05/05 16:19:36 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: ypmatch.c,v 1.4 1996/05/10 13:03:14 deraadt Exp $"; #endif #include <sys/param.h> @@ -85,6 +85,7 @@ char **argv; extern int optind; int outbuflen, key, notrans; int c, r, i; + int rval; notrans = key = 0; yp_get_default_domain(&domainname); @@ -119,6 +120,8 @@ char **argv; if( strcmp(inmap, ypaliases[i].alias) == 0) inmap = ypaliases[i].name; } + + rval = 0; for(; optind < argc-1; optind++) { inkey = argv[optind]; @@ -127,7 +130,7 @@ char **argv; switch(r) { case 0: if(key) - printf("%s ", inkey); + printf("%s: ", inkey); printf("%*.*s\n", outbuflen, outbuflen, outbuf); break; case YPERR_YPBIND: @@ -136,8 +139,9 @@ char **argv; default: fprintf(stderr, "Can't match key %s in map %s. Reason: %s\n", inkey, inmap, yperr_string(r)); - exit(1); + rval = 1; + break; } } - exit(0); + exit(rval); } |