summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorcharnier <charnier@FreeBSD.org>1997-08-29 11:48:50 +0000
committercharnier <charnier@FreeBSD.org>1997-08-29 11:48:50 +0000
commitc1711414d341d04f19f6fa4573f8f057709c6ba0 (patch)
tree064384e8ceb1f45ff86915b38fc8118c5a667734 /usr.bin
parent7f839a6925684ef7b7b0a6163e1b08aea13f3527 (diff)
downloadFreeBSD-src-c1711414d341d04f19f6fa4573f8f057709c6ba0.zip
FreeBSD-src-c1711414d341d04f19f6fa4573f8f057709c6ba0.tar.gz
Use err(3). Add references to others man pages. Wait for the user to
supply the domain before computing a default one. Obtained from: OpenBSD
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ypcat/ypcat.19
-rw-r--r--usr.bin/ypcat/ypcat.c34
2 files changed, 24 insertions, 19 deletions
diff --git a/usr.bin/ypcat/ypcat.1 b/usr.bin/ypcat/ypcat.1
index 9b31994..d0f3800 100644
--- a/usr.bin/ypcat/ypcat.1
+++ b/usr.bin/ypcat/ypcat.1
@@ -26,7 +26,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$
+.\" $Id: ypcat.1,v 1.5 1997/02/22 19:58:10 peter Exp $
.\"
.Dd December 3, 1993
.Dt YPCAT 1
@@ -64,7 +64,10 @@ to their corresponding map names.
Display the map nickname table.
.El
.Sh SEE ALSO
+.Xr domainname 1 ,
.Xr ypmatch 1 ,
-.Xr yp 4
+.Xr yp 4 ,
+.Xr ypbind 8 ,
+.Xr ypset 8
.Sh AUTHOR
-Theo De Raadt
+.An Theo De Raadt Aq deraadt@theos.com .
diff --git a/usr.bin/ypcat/ypcat.c b/usr.bin/ypcat/ypcat.c
index fdefa43..2604115 100644
--- a/usr.bin/ypcat/ypcat.c
+++ b/usr.bin/ypcat/ypcat.c
@@ -27,15 +27,18 @@
* SUCH DAMAGE.
*/
-#ifndef LINT
-static char rcsid[] = "ypcat.c,v 1.2 1993/05/16 02:49:01 deraadt Exp";
-#endif
+#ifndef lint
+static const char rcsid[] =
+ "$Id$";
+#endif /* not lint */
#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
-#include <stdio.h>
#include <ctype.h>
+#include <err.h>
+#include <stdio.h>
+#include <unistd.h>
#include <rpc/rpc.h>
#include <rpc/xdr.h>
@@ -58,14 +61,16 @@ struct ypalias {
int key;
+static void
usage()
{
- fprintf(stderr, "Usage:\n");
- fprintf(stderr, "\typcat [-k] [-d domainname] [-t] mapname\n");
- fprintf(stderr, "\typcat -x\n");
+ fprintf(stderr, "%s\n%s\n",
+ "usage: ypcat [-k] [-d domainname] [-t] mapname",
+ " ypcat -x");
exit(1);
}
+int
printit(instatus, inkey, inkeylen, inval, invallen, indata)
int instatus;
char *inkey;
@@ -86,16 +91,13 @@ int
main(argc, argv)
char **argv;
{
- char *domainname;
+ char *domainname = NULL;
struct ypall_callback ypcb;
char *inmap;
- extern char *optarg;
- extern int optind;
int notrans;
int c, r, i;
notrans = key = 0;
- yp_get_default_domain(&domainname);
while( (c=getopt(argc, argv, "xd:kt")) != -1)
switch(c) {
@@ -121,6 +123,9 @@ char **argv;
if(optind + 1 != argc )
usage();
+ if (!domainname)
+ yp_get_default_domain(&domainname);
+
inmap = argv[optind];
for(i=0; (!notrans) && i<sizeof ypaliases/sizeof ypaliases[0]; i++)
if( strcmp(inmap, ypaliases[i].alias) == 0)
@@ -133,12 +138,9 @@ char **argv;
case 0:
break;
case YPERR_YPBIND:
- fprintf(stderr, "ypcat: not running ypbind\n");
- exit(1);
+ errx(1, "not running ypbind");
default:
- fprintf(stderr, "No such map %s. Reason: %s\n",
- inmap, yperr_string(r));
- exit(1);
+ errx(1, "no such map %s. reason: %s", inmap, yperr_string(r));
}
exit(0);
}
OpenPOWER on IntegriCloud