CVS commit: src/usr.bin/ypcat

2012-03-04 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Mar  4 11:54:06 UTC 2012

Modified Files:
src/usr.bin/ypcat: ypcat.1

Log Message:
New sentence, new line. Wording.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/ypcat/ypcat.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/ypcat/ypcat.1
diff -u src/usr.bin/ypcat/ypcat.1:1.20 src/usr.bin/ypcat/ypcat.1:1.21
--- src/usr.bin/ypcat/ypcat.1:1.20	Fri Mar  2 17:27:49 2012
+++ src/usr.bin/ypcat/ypcat.1	Sun Mar  4 11:54:06 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: ypcat.1,v 1.20 2012/03/02 17:27:49 christos Exp $
+.\	$NetBSD: ypcat.1,v 1.21 2012/03/04 11:54:06 wiz Exp $
 .\
 .\ Copyright (c) 1993 Winning Strategies, Inc.
 .\ All rights reserved.
@@ -53,9 +53,12 @@ which may be a map name or a map nicknam
 The options are as follows:
 .Bl -tag -width indent
 .It Fl b Ar num_retry
-Do not wait infinite time for ypserver to come up.
-Retry only the specified number times. See 
-.Xr yp_setbindtries 3 for explanation. Valid range is limited from 0 to 65535 by this program. 
+Do not wait infinite time for the ypserver to come up.
+Retry only the specified number of times.
+See
+.Xr yp_setbindtries 3
+for explanation.
+The valid range is limited from 0 to 65535 by this program.
 .It Fl d Ar domainname
 Specify a domain other than the default domain.
 .It Fl k



CVS commit: src/usr.bin/ypcat

2011-01-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jan 12 18:28:19 UTC 2011

Modified Files:
src/usr.bin/ypcat: ypcat.1 ypcat.c

Log Message:
add -s option to compress spaces.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/ypcat/ypcat.1
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/ypcat/ypcat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/ypcat/ypcat.1
diff -u src/usr.bin/ypcat/ypcat.1:1.17 src/usr.bin/ypcat/ypcat.1:1.18
--- src/usr.bin/ypcat/ypcat.1:1.17	Sun Jun 21 11:05:59 2009
+++ src/usr.bin/ypcat/ypcat.1	Wed Jan 12 13:28:19 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: ypcat.1,v 1.17 2009/06/21 15:05:59 wiz Exp $
+.\	$NetBSD: ypcat.1,v 1.18 2011/01/12 18:28:19 christos Exp $
 .\
 .\ Copyright (c) 1993 Winning Strategies, Inc.
 .\ All rights reserved.
@@ -28,7 +28,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.
 .\
-.Dd June 20, 2009
+.Dd January 12, 2011
 .Dt YPCAT 1
 .Os
 .Sh NAME
@@ -36,8 +36,8 @@
 .Nd print the values of all keys in a NIS database
 .Sh SYNOPSIS
 .Nm
-.Op Fl kt
 .Op Fl d Ar domainname
+.Op Fl kst
 .Ar mapname
 .Nm
 .Fl x
@@ -57,6 +57,10 @@
 Display map keys.
 This option is useful with maps in which the values are null or the key
 is not part of the value.
+.It Fl s
+When printing the value of a key, compress all whitespace characters to
+a single space.
+Useful when values contain newlines.
 .It Fl t
 Inhibit translation of map nicknames
 to their corresponding map names.

Index: src/usr.bin/ypcat/ypcat.c
diff -u src/usr.bin/ypcat/ypcat.c:1.14 src/usr.bin/ypcat/ypcat.c:1.15
--- src/usr.bin/ypcat/ypcat.c:1.14	Sun Jun 21 10:58:16 2009
+++ src/usr.bin/ypcat/ypcat.c	Wed Jan 12 13:28:19 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: ypcat.c,v 1.14 2009/06/21 14:58:16 wiz Exp $	*/
+/* $NetBSD: ypcat.c,v 1.15 2011/01/12 18:28:19 christos Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993 Theo de Raadt dera...@fsa.ca
@@ -28,7 +28,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: ypcat.c,v 1.14 2009/06/21 14:58:16 wiz Exp $);
+__RCSID($NetBSD: ypcat.c,v 1.15 2011/01/12 18:28:19 christos Exp $);
 #endif
 
 #include sys/param.h
@@ -52,6 +52,8 @@
 static int	printit(int, char *, int, char *, int, char *);
 static void	usage(void) __attribute__((__noreturn__));
 
+static int	compressspace;
+
 
 int
 main(int argc, char *argv[])
@@ -69,8 +71,20 @@
 	domainname = NULL;
 	notrans = key = 0;
 	ypaliases = ypalias_init();
-	while((c = getopt(argc, argv, xd:kt)) != -1) {
+	while((c = getopt(argc, argv, d:kstx)) != -1) {
 		switch (c) {
+		case 'd':
+			domainname = optarg;
+			break;
+
+		case 'k':
+			key++;
+			break;
+
+		case 's':
+			compressspace++;
+			break;
+
 		case 'x':
 			for (i = 0; ypaliases[i].alias; i++)
 printf(Use \%s\ for \%s\\n,
@@ -78,18 +92,10 @@
 ypaliases[i].name);
 			return 0;
 
-		case 'd':
-			domainname = optarg;
-			break;
-
 		case 't':
 			notrans++;
 			break;
 
-		case 'k':
-			key++;
-			break;
-
 		default:
 			usage();
 		}
@@ -137,10 +143,28 @@
 		return instatus;
 	if (indata)
 		(void)printf(%*.*s, inkeylen, inkeylen, inkey);
-	if (invallen)
-		(void)printf(%s%*.*s, (indata ?   : ), invallen, invallen,
-		inval);
-	(void)printf(\n);
+	if (invallen) {
+		if (indata)
+			(void)putc(' ', stdout);
+		if (compressspace) {
+			int i;
+			int hadspace = 0;
+
+			for (i = 0; i  invallen; i++) {
+if (isspace((unsigned char)inval[i])) {
+	if (hadspace)
+		continue;
+	hadspace = 1;
+	(void)putc(' ', stdout);
+} else {
+	hadspace = 0;
+	(void)putc(inval[i], stdout);
+}
+			}
+		} else
+			(void)printf(%*.*s, invallen, invallen, inval);
+	}
+	(void)putc('\n', stdout);
 	return 0;
 }
 



CVS commit: src/usr.bin/ypcat

2011-01-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jan 12 18:51:42 UTC 2011

Modified Files:
src/usr.bin/ypcat: ypcat.c

Log Message:
fix usage.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/ypcat/ypcat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/ypcat/ypcat.c
diff -u src/usr.bin/ypcat/ypcat.c:1.15 src/usr.bin/ypcat/ypcat.c:1.16
--- src/usr.bin/ypcat/ypcat.c:1.15	Wed Jan 12 13:28:19 2011
+++ src/usr.bin/ypcat/ypcat.c	Wed Jan 12 13:51:42 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: ypcat.c,v 1.15 2011/01/12 18:28:19 christos Exp $	*/
+/* $NetBSD: ypcat.c,v 1.16 2011/01/12 18:51:42 christos Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993 Theo de Raadt dera...@fsa.ca
@@ -28,7 +28,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: ypcat.c,v 1.15 2011/01/12 18:28:19 christos Exp $);
+__RCSID($NetBSD: ypcat.c,v 1.16 2011/01/12 18:51:42 christos Exp $);
 #endif
 
 #include sys/param.h
@@ -172,7 +172,7 @@
 usage(void)
 {
 
-	(void)fprintf(stderr, Usage: %s [-kt] [-d domainname] mapname\n,
+	(void)fprintf(stderr, Usage: %s [-kst] [-d domainname] mapname\n,
 	getprogname());
 	(void)fprintf(stderr,%s -x\n, getprogname());
 	exit(1);



CVS commit: src/usr.bin/ypcat

2011-01-12 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Jan 12 19:55:06 UTC 2011

Modified Files:
src/usr.bin/ypcat: ypcat.1

Log Message:
Sort options in SYNOPSIS.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/ypcat/ypcat.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/ypcat/ypcat.1
diff -u src/usr.bin/ypcat/ypcat.1:1.18 src/usr.bin/ypcat/ypcat.1:1.19
--- src/usr.bin/ypcat/ypcat.1:1.18	Wed Jan 12 18:28:19 2011
+++ src/usr.bin/ypcat/ypcat.1	Wed Jan 12 19:55:06 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: ypcat.1,v 1.18 2011/01/12 18:28:19 christos Exp $
+.\	$NetBSD: ypcat.1,v 1.19 2011/01/12 19:55:06 wiz Exp $
 .\
 .\ Copyright (c) 1993 Winning Strategies, Inc.
 .\ All rights reserved.
@@ -36,8 +36,8 @@
 .Nd print the values of all keys in a NIS database
 .Sh SYNOPSIS
 .Nm
-.Op Fl d Ar domainname
 .Op Fl kst
+.Op Fl d Ar domainname
 .Ar mapname
 .Nm
 .Fl x



CVS commit: src/usr.bin/ypcat

2009-06-21 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Jun 21 14:57:33 UTC 2009

Modified Files:
src/usr.bin/ypcat: ypcat.1

Log Message:
Use Pa for paths.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/ypcat/ypcat.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/ypcat/ypcat.1
diff -u src/usr.bin/ypcat/ypcat.1:1.15 src/usr.bin/ypcat/ypcat.1:1.16
--- src/usr.bin/ypcat/ypcat.1:1.15	Sat Jun 20 19:27:26 2009
+++ src/usr.bin/ypcat/ypcat.1	Sun Jun 21 14:57:33 2009
@@ -1,4 +1,4 @@
-.\	$NetBSD: ypcat.1,v 1.15 2009/06/20 19:27:26 christos Exp $
+.\	$NetBSD: ypcat.1,v 1.16 2009/06/21 14:57:33 wiz Exp $
 .\
 .\ Copyright (c) 1993 Winning Strategies, Inc.
 .\ All rights reserved.
@@ -61,8 +61,10 @@
 Inhibit translation of map nicknames
 to their corresponding map names.
 .It Fl x
-Display the map nickname table, found in /var/yp/nicknames.
-A built-in default translation table is used if /var/yp/nicknames
+Display the map nickname table, found in
+.Pa /var/yp/nicknames .
+A built-in default translation table is used if
+.Pa /var/yp/nicknames
 does not exist (see
 .Xr nicknames 5
 for details).



CVS commit: src/usr.bin/ypcat

2009-06-21 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Jun 21 14:58:16 UTC 2009

Modified Files:
src/usr.bin/ypcat: ypcat.c

Log Message:
Sync usage with man page.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/ypcat/ypcat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/ypcat/ypcat.c
diff -u src/usr.bin/ypcat/ypcat.c:1.13 src/usr.bin/ypcat/ypcat.c:1.14
--- src/usr.bin/ypcat/ypcat.c:1.13	Sat Jun 20 19:27:26 2009
+++ src/usr.bin/ypcat/ypcat.c	Sun Jun 21 14:58:16 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: ypcat.c,v 1.13 2009/06/20 19:27:26 christos Exp $	*/
+/* $NetBSD: ypcat.c,v 1.14 2009/06/21 14:58:16 wiz Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993 Theo de Raadt dera...@fsa.ca
@@ -28,7 +28,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: ypcat.c,v 1.13 2009/06/20 19:27:26 christos Exp $);
+__RCSID($NetBSD: ypcat.c,v 1.14 2009/06/21 14:58:16 wiz Exp $);
 #endif
 
 #include sys/param.h
@@ -148,7 +148,7 @@
 usage(void)
 {
 
-	(void)fprintf(stderr, Usage: %s [-k] [-d domainname] [-t] mapname\n,
+	(void)fprintf(stderr, Usage: %s [-kt] [-d domainname] mapname\n,
 	getprogname());
 	(void)fprintf(stderr,%s -x\n, getprogname());
 	exit(1);



CVS commit: src/usr.bin/ypcat

2009-06-21 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Jun 21 15:05:59 UTC 2009

Modified Files:
src/usr.bin/ypcat: ypcat.1

Log Message:
Remove superfluous quotes.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/ypcat/ypcat.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/ypcat/ypcat.1
diff -u src/usr.bin/ypcat/ypcat.1:1.16 src/usr.bin/ypcat/ypcat.1:1.17
--- src/usr.bin/ypcat/ypcat.1:1.16	Sun Jun 21 14:57:33 2009
+++ src/usr.bin/ypcat/ypcat.1	Sun Jun 21 15:05:59 2009
@@ -1,4 +1,4 @@
-.\	$NetBSD: ypcat.1,v 1.16 2009/06/21 14:57:33 wiz Exp $
+.\	$NetBSD: ypcat.1,v 1.17 2009/06/21 15:05:59 wiz Exp $
 .\
 .\ Copyright (c) 1993 Winning Strategies, Inc.
 .\ All rights reserved.
@@ -33,7 +33,7 @@
 .Os
 .Sh NAME
 .Nm ypcat
-.Nd print the values of all keys in a NIS database
+.Nd print the values of all keys in a NIS database
 .Sh SYNOPSIS
 .Nm
 .Op Fl kt



CVS commit: src/usr.bin/ypcat

2009-04-14 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Tue Apr 14 09:55:07 UTC 2009

Modified Files:
src/usr.bin/ypcat: ypcat.c

Log Message:
Fix WARNS=4 issues (-Wcast-qual -Wsign-compare)


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/ypcat/ypcat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/ypcat/ypcat.c
diff -u src/usr.bin/ypcat/ypcat.c:1.11 src/usr.bin/ypcat/ypcat.c:1.12
--- src/usr.bin/ypcat/ypcat.c:1.11	Wed Dec 10 12:06:26 2003
+++ src/usr.bin/ypcat/ypcat.c	Tue Apr 14 09:55:07 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ypcat.c,v 1.11 2003/12/10 12:06:26 agc Exp $	*/
+/*	$NetBSD: ypcat.c,v 1.12 2009/04/14 09:55:07 lukem Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993 Theo de Raadt dera...@fsa.ca
@@ -28,7 +28,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: ypcat.c,v 1.11 2003/12/10 12:06:26 agc Exp $);
+__RCSID($NetBSD: ypcat.c,v 1.12 2009/04/14 09:55:07 lukem Exp $);
 #endif
 
 #include sys/param.h
@@ -47,7 +47,7 @@
 #include rpcsvc/ypclnt.h
 
 const struct ypalias {
-	char *alias, *name;
+	const char *alias, *name;
 } ypaliases[] = {
 	{ passwd, passwd.byname },
 	{ group, group.byname },
@@ -72,9 +72,10 @@
 {
 	char *domainname;
 	struct ypall_callback ypcb;
-	char *inmap;
+	const char *inmap;
 	int notrans;
-	int c, r, i;
+	int c, r;
+	size_t i;
 
 	domainname = NULL;
 	notrans = key = 0;