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:
parent
02db1769f3
commit
35994ac2c0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=48171
@ -27,7 +27,7 @@
|
|||||||
* i4b daemon - main program entry
|
* 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]
|
* last edit-date: [Thu Apr 29 09:41:21 1999]
|
||||||
*
|
*
|
||||||
@ -118,7 +118,7 @@ main(int argc, char **argv)
|
|||||||
#endif
|
#endif
|
||||||
#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)
|
switch (i)
|
||||||
{
|
{
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
* main.c - i4b set debug options
|
* 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]
|
* last edit-date: [Wed Apr 28 16:47:28 1999]
|
||||||
*
|
*
|
||||||
@ -84,7 +84,7 @@ main(int argc, char **argv)
|
|||||||
ctl_debug_t cdbg;
|
ctl_debug_t cdbg;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
while ((c = getopt(argc, argv, "eghl:mrs:u:zH?")) != -1)
|
while ((c = getopt(argc, argv, "eghl:mrs:u:zH")) != -1)
|
||||||
{
|
{
|
||||||
switch(c)
|
switch(c)
|
||||||
{
|
{
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
* main.c - isdndecode main program file
|
* 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]
|
* 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)];
|
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)
|
switch(c)
|
||||||
{
|
{
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
* isdntel - isdn4bsd telephone answering machine support
|
* 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]
|
* last edit-date: [Mon Apr 26 13:56:35 1999]
|
||||||
*
|
*
|
||||||
@ -61,7 +61,7 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
extern char *optarg;
|
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)
|
switch (i)
|
||||||
{
|
{
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
* isdntelctl - i4b set telephone interface options
|
* 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]
|
* last edit-date: [Mon Apr 26 14:07:06 1999]
|
||||||
*
|
*
|
||||||
@ -72,7 +72,7 @@ main(int argc, char **argv)
|
|||||||
int telfd;
|
int telfd;
|
||||||
char namebuffer[128];
|
char namebuffer[128];
|
||||||
|
|
||||||
while ((c = getopt(argc, argv, "cgu:AUN?")) != -1)
|
while ((c = getopt(argc, argv, "cgu:AUN")) != -1)
|
||||||
{
|
{
|
||||||
switch(c)
|
switch(c)
|
||||||
{
|
{
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
* main.c - i4b selftest utility
|
* 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]
|
* last edit-date: [Mon Apr 26 14:08:40 1999]
|
||||||
*
|
*
|
||||||
@ -101,7 +101,7 @@ main(int argc, char **argv)
|
|||||||
incomingnumber[0] = '\0';
|
incomingnumber[0] = '\0';
|
||||||
outgoingnumber[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)
|
switch(c)
|
||||||
{
|
{
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
* trace.c - print traces of D (B) channel activity for isdn4bsd
|
* 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]
|
* 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)];
|
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)
|
switch(c)
|
||||||
{
|
{
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* 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
|
* Parts of this program are derived from the original FreeBSD iostat
|
||||||
@ -185,7 +185,7 @@ main(int argc, char **argv)
|
|||||||
matches = NULL;
|
matches = NULL;
|
||||||
maxshowdevs = 3;
|
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) {
|
switch(c) {
|
||||||
case 'c':
|
case 'c':
|
||||||
cflag++;
|
cflag++;
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] =
|
static const char rcsid[] =
|
||||||
"$Id$";
|
"$Id: yppoll.c,v 1.3 1997/10/27 12:30:30 charnier Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -65,7 +65,7 @@ char **argv;
|
|||||||
|
|
||||||
yp_get_default_domain(&domainname);
|
yp_get_default_domain(&domainname);
|
||||||
|
|
||||||
while( (c=getopt(argc, argv, "h:d:?")) != -1)
|
while( (c=getopt(argc, argv, "h:d:")) != -1)
|
||||||
switch(c) {
|
switch(c) {
|
||||||
case 'd':
|
case 'd':
|
||||||
domainname = optarg;
|
domainname = optarg;
|
||||||
|
Loading…
Reference in New Issue
Block a user