From 6e1ec48784403ea55893deff0e41a0ec26f3b6b6 Mon Sep 17 00:00:00 2001 From: christos Date: Thu, 29 Dec 2011 16:41:38 +0000 Subject: [PATCH] Make msgfile optional like other OS's --- usr.bin/gencat/gencat.1 | 9 ++++----- usr.bin/gencat/gencat.c | 10 +++++----- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/usr.bin/gencat/gencat.1 b/usr.bin/gencat/gencat.1 index 1082edabab0d..bdab3ad64242 100644 --- a/usr.bin/gencat/gencat.1 +++ b/usr.bin/gencat/gencat.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: gencat.1,v 1.12 2009/03/09 19:24:32 joerg Exp $ +.\" $NetBSD: gencat.1,v 1.13 2011/12/29 16:41:38 christos Exp $ .\" .\" Copyright (c) 2007 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -29,7 +29,7 @@ .\" .\" Written by Kee Hinckley .\" -.Dd November 4, 2008 +.Dd December 29, 2011 .Dt GENCAT 1 .Os .Sh NAME @@ -38,14 +38,13 @@ .Sh SYNOPSIS .Nm .Ar catfile -.Ar msgfile -.Op Ar msgfile ... +.Op Ar msgfile|- ... .Sh DESCRIPTION The .Nm utility generates a formatted message catalog .Ar catfile -from one or more message source text files +from stdin or one or more message source text files .Ar msgfile . The file .Ar catfile diff --git a/usr.bin/gencat/gencat.c b/usr.bin/gencat/gencat.c index 6be0485a10b9..440d049242ee 100644 --- a/usr.bin/gencat/gencat.c +++ b/usr.bin/gencat/gencat.c @@ -1,4 +1,4 @@ -/* $NetBSD: gencat.c,v 1.32 2011/09/21 14:33:35 christos Exp $ */ +/* $NetBSD: gencat.c,v 1.33 2011/12/29 16:41:38 christos Exp $ */ /* * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: gencat.c,v 1.32 2011/09/21 14:33:35 christos Exp $"); +__RCSID("$NetBSD: gencat.c,v 1.33 2011/12/29 16:41:38 christos Exp $"); #endif /*********************************************************** @@ -163,7 +163,7 @@ main(int argc, char *argv[]) argc -= optind; argv += optind; - if (argc < 2) { + if (argc < 1) { usage(); /* NOTREACHED */ } @@ -193,8 +193,8 @@ main(int argc, char *argv[]) } } - if (((*argv)[0] == '-') && ((*argv)[1] == '\0')) { - if (argc != 2) + if (argc < 2 || (((*argv)[0] == '-') && ((*argv)[1] == '\0'))) { + if (argc > 2) usage(); /* NOTREACHED */ MCParse(STDIN_FILENO);