Two getopts related nits:

o getopt returns -1 rather than EOF on errors
	o getopt returns '?' for characters it doesn't know about, so
	  don't include them in the getopt options string.
This commit is contained in:
Warner Losh 1999-06-24 06:43:21 +00:00
parent 02db1769f3
commit 35994ac2c0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=48171
9 changed files with 18 additions and 18 deletions

View File

@ -27,7 +27,7 @@
* i4b daemon - main program entry
* -------------------------------
*
* $Id: main.c,v 1.3 1999/05/20 10:12:42 hm Exp $
* $Id: main.c,v 1.4 1999/05/23 23:24:08 imp Exp $
*
* last edit-date: [Thu Apr 29 09:41:21 1999]
*
@ -118,7 +118,7 @@ main(int argc, char **argv)
#endif
#endif
while ((i = getopt(argc, argv, "bmc:d:fFlL:Pr:s:t:u:?")) != -1)
while ((i = getopt(argc, argv, "bmc:d:fFlL:Pr:s:t:u:")) != -1)
{
switch (i)
{

View File

@ -27,7 +27,7 @@
* main.c - i4b set debug options
* ------------------------------
*
* $Id: main.c,v 1.3 1999/05/20 10:13:12 hm Exp $
* $Id: main.c,v 1.4 1999/05/23 23:24:11 imp Exp $
*
* last edit-date: [Wed Apr 28 16:47:28 1999]
*
@ -84,7 +84,7 @@ main(int argc, char **argv)
ctl_debug_t cdbg;
int ret;
while ((c = getopt(argc, argv, "eghl:mrs:u:zH?")) != -1)
while ((c = getopt(argc, argv, "eghl:mrs:u:zH")) != -1)
{
switch(c)
{

View File

@ -27,7 +27,7 @@
* main.c - isdndecode main program file
* -------------------------------------
*
* $Id: main.c,v 1.3 1999/05/20 10:13:30 hm Exp $
* $Id: main.c,v 1.4 1999/05/23 23:24:13 imp Exp $
*
* last edit-date: [Mon Apr 26 14:02:44 1999]
*
@ -90,7 +90,7 @@ main(int argc, char *argv[])
b = &buf[sizeof(i4b_trace_hdr_t)];
while( (c = getopt(argc, argv, "abdf:hiln:op:u:BPR:T:?")) != -1)
while( (c = getopt(argc, argv, "abdf:hiln:op:u:BPR:T:")) != -1)
{
switch(c)
{

View File

@ -27,7 +27,7 @@
* isdntel - isdn4bsd telephone answering machine support
* ======================================================
*
* $Id: main.c,v 1.3 1999/05/20 10:13:55 hm Exp $
* $Id: main.c,v 1.4 1999/05/23 23:24:16 imp Exp $
*
* last edit-date: [Mon Apr 26 13:56:35 1999]
*
@ -61,7 +61,7 @@ main(int argc, char **argv)
extern char *optarg;
while ((i = getopt(argc, argv, "a:d:p:t:?")) != -1)
while ((i = getopt(argc, argv, "a:d:p:t:")) != -1)
{
switch (i)
{

View File

@ -27,7 +27,7 @@
* isdntelctl - i4b set telephone interface options
* ------------------------------------------------
*
* $Id: main.c,v 1.3 1999/05/20 10:14:04 hm Exp $
* $Id: main.c,v 1.4 1999/05/23 23:24:19 imp Exp $
*
* last edit-date: [Mon Apr 26 14:07:06 1999]
*
@ -72,7 +72,7 @@ main(int argc, char **argv)
int telfd;
char namebuffer[128];
while ((c = getopt(argc, argv, "cgu:AUN?")) != -1)
while ((c = getopt(argc, argv, "cgu:AUN")) != -1)
{
switch(c)
{

View File

@ -27,7 +27,7 @@
* main.c - i4b selftest utility
* -----------------------------
*
* $Id: main.c,v 1.11 1999/04/26 12:10:39 hm Exp $
* $Id: main.c,v 1.3 1999/05/20 10:14:11 hm Exp $
*
* last edit-date: [Mon Apr 26 14:08:40 1999]
*
@ -101,7 +101,7 @@ main(int argc, char **argv)
incomingnumber[0] = '\0';
outgoingnumber[0] = '\0';
while ((c = getopt(argc, argv, "c:d:hi:o:t:w?")) != EOF)
while ((c = getopt(argc, argv, "c:d:hi:o:t:w")) != -1)
{
switch(c)
{

View File

@ -35,7 +35,7 @@
* trace.c - print traces of D (B) channel activity for isdn4bsd
* -------------------------------------------------------------
*
* $Id: trace.c,v 1.3 1999/05/20 10:14:35 hm Exp $
* $Id: trace.c,v 1.4 1999/05/23 23:24:21 imp Exp $
*
* last edit-date: [Sun Feb 14 10:23:28 1999]
*
@ -146,7 +146,7 @@ main(int argc, char *argv[])
b = &buf[sizeof(i4b_trace_hdr_t)];
while( (c = getopt(argc, argv, "abdf:hiln:op:ru:BFPR:T:?")) != -1)
while( (c = getopt(argc, argv, "abdf:hiln:op:ru:BFPR:T:")) != -1)
{
switch(c)
{

View File

@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: iostat.c,v 1.11 1998/09/16 23:14:47 ken Exp $
* $Id: iostat.c,v 1.12 1998/09/20 00:11:14 ken Exp $
*/
/*
* Parts of this program are derived from the original FreeBSD iostat
@ -185,7 +185,7 @@ main(int argc, char **argv)
matches = NULL;
maxshowdevs = 3;
while ((c = getopt(argc, argv, "c:CdhIKM:n:N:ot:Tw:?")) != -1) {
while ((c = getopt(argc, argv, "c:CdhIKM:n:N:ot:Tw:")) != -1) {
switch(c) {
case 'c':
cflag++;

View File

@ -30,7 +30,7 @@
#ifndef lint
static const char rcsid[] =
"$Id$";
"$Id: yppoll.c,v 1.3 1997/10/27 12:30:30 charnier Exp $";
#endif /* not lint */
#include <sys/param.h>
@ -65,7 +65,7 @@ char **argv;
yp_get_default_domain(&domainname);
while( (c=getopt(argc, argv, "h:d:?")) != -1)
while( (c=getopt(argc, argv, "h:d:")) != -1)
switch(c) {
case 'd':
domainname = optarg;