Use an integer instead of a char to store the getopt() return value in

order to match the function prototype and to work with compilers that
default to unsigned chars.
Compare the getopt() return value with -1 instead of EOF.
This commit is contained in:
mark 1996-04-01 21:31:33 +00:00
parent 57472e9fbc
commit f8fcb56bce
2 changed files with 8 additions and 7 deletions

View File

@ -42,7 +42,7 @@ static char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)quota.c 8.1 (Berkeley) 6/6/93";*/
static char rcsid[] = "$Id: quota.c,v 1.10 1996/02/01 02:34:36 jtc Exp $";
static char rcsid[] = "$Id: quota.c,v 1.11 1996/04/01 21:31:33 mark Exp $";
#endif /* not lint */
/*
@ -92,11 +92,11 @@ main(argc, argv)
int ngroups;
gid_t mygid, gidset[NGROUPS];
int i, gflag = 0, uflag = 0;
char ch;
int ch;
extern char *optarg;
extern int optind, errno;
while ((ch = getopt(argc, argv, "ugvq")) != EOF) {
while ((ch = getopt(argc, argv, "ugvq")) != -1) {
switch(ch) {
case 'g':
gflag++;

View File

@ -1,4 +1,4 @@
/* $NetBSD: showmount.c,v 1.5 1995/08/31 22:26:08 jtc Exp $ */
/* $NetBSD: showmount.c,v 1.6 1996/04/01 21:32:19 mark Exp $ */
/*
* Copyright (c) 1989, 1993, 1995
@ -46,7 +46,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)showmount.c 8.3 (Berkeley) 3/29/95";
#endif
static char rcsid[] = "$NetBSD: showmount.c,v 1.5 1995/08/31 22:26:08 jtc Exp $";
static char rcsid[] = "$NetBSD: showmount.c,v 1.6 1996/04/01 21:32:19 mark Exp $";
#endif not lint
#include <sys/types.h>
@ -114,9 +114,10 @@ main(argc, argv)
struct exportslist *exp;
struct grouplist *grp;
int estat, rpcs = 0, mntvers = 1;
char ch, *host;
char *host;
int ch;
while ((ch = getopt(argc, argv, "ade3")) != EOF)
while ((ch = getopt(argc, argv, "ade3")) != -1)
switch((char)ch) {
case 'a':
if (type == 0) {