* add `-x' option to usage().

* `=' vs. `==' in a comparison.
This commit is contained in:
kleink 1997-06-24 17:47:03 +00:00
parent f271ef50c9
commit 3474a69ffa
1 changed files with 5 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: fsirand.c,v 1.3 1997/03/14 00:00:26 cgd Exp $ */ /* $NetBSD: fsirand.c,v 1.4 1997/06/24 17:47:03 kleink Exp $ */
/* /*
* Copyright (c) 1997 Christos Zoulas. All rights reserved. * Copyright (c) 1997 Christos Zoulas. All rights reserved.
@ -30,7 +30,7 @@
*/ */
#ifndef lint #ifndef lint
static char rcsid[] = "$NetBSD: fsirand.c,v 1.3 1997/03/14 00:00:26 cgd Exp $"; static char rcsid[] = "$NetBSD: fsirand.c,v 1.4 1997/06/24 17:47:03 kleink Exp $";
#endif /* lint */ #endif /* lint */
#include <stdio.h> #include <stdio.h>
@ -65,7 +65,8 @@ usage()
{ {
extern char *__progname; extern char *__progname;
(void) fprintf(stderr, "%s: [-p] <special>\n", __progname); (void) fprintf(stderr, "%s: [-x <constant>] [-p] <special>\n",
__progname);
exit(1); exit(1);
} }
@ -187,7 +188,7 @@ main(argc, argv)
break; break;
case 'x': case 'x':
xorval = strtol(optarg, &ep, 0); xorval = strtol(optarg, &ep, 0);
if ((xorval = LONG_MIN || xorval == LONG_MAX) && if ((xorval == LONG_MIN || xorval == LONG_MAX) &&
errno == ERANGE) errno == ERANGE)
err(1, "Out of range constant"); err(1, "Out of range constant");
if (*ep) if (*ep)