diff options
Diffstat (limited to 'bin/domainname/domainname.c')
-rw-r--r-- | bin/domainname/domainname.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/bin/domainname/domainname.c b/bin/domainname/domainname.c index 1a173e9..0dfcb4b 100644 --- a/bin/domainname/domainname.c +++ b/bin/domainname/domainname.c @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: domainname.c,v 1.8 1997/02/22 14:03:01 peter Exp $ */ #ifndef lint @@ -51,14 +51,28 @@ static char const sccsid[] = "From: @(#)hostname.c 8.1 (Berkeley) 5/31/93"; #include <string.h> #include <unistd.h> +extern char *__progname; + +void usage __P((void)); + int main(argc,argv) int argc; char *argv[]; { + int ch; char domainname[MAXHOSTNAMELEN]; - argc--, argv++; + while ((ch = getopt(argc, argv, "")) != -1) + switch (ch) { + default: + usage(); + } + argc -= optind; + argv += optind; + + if (argc > 1) + usage(); if (*argv) { if (setdomainname(*argv, strlen(*argv))) @@ -70,3 +84,10 @@ main(argc,argv) } exit(0); } + +void +usage() +{ + (void)fprintf(stderr, "usage: %s [ypdomain]\n", __progname); + exit(1); +} |