From 0a899ac0fd19cac4992b305c4b4ead1bcca345b1 Mon Sep 17 00:00:00 2001 From: mainzelm Date: Mon, 2 Feb 2004 17:18:39 +0000 Subject: [PATCH] Use strcmp to check for empty arguments. --- scsh/process_args.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/scsh/process_args.c b/scsh/process_args.c index daec9db..e39c791 100644 --- a/scsh/process_args.c +++ b/scsh/process_args.c @@ -1,5 +1,6 @@ #include #include +#include #define streq(a,b) (strcmp((a),(b))==0) @@ -45,7 +46,7 @@ char ** process_args(char **argv, exit(1);}} for (; *argv; argv++) - if (argv[0][0] == NULL) + if (streq (argv[0],"")) /* process_meta_arg inserts an empty argument for every space. Skip it. */ continue; @@ -60,7 +61,7 @@ char ** process_args(char **argv, case 'h': /* heapsize */ argv++; if( !*argv ) bad_args(3); /* die */ - while (argv[0][0] == NULL)argv++; /* Skip empty arguments */ + while (streq (argv[0],"")) argv++; /* Skip empty arguments */ *pheap_size = atoi(*argv); if( *pheap_size <= 0 ) bad_args(4); break; @@ -68,7 +69,7 @@ char ** process_args(char **argv, case 's': argv++; if( !*argv ) bad_args(5); /* die */ - while (argv[0][0] == NULL) argv++; /* Skip empty arguments */ + while (streq (argv[0],"")) argv++; /* Skip empty arguments */ *pstack_size = atoi(*argv); if (*pstack_size <= 0) bad_args(6); break; @@ -76,7 +77,7 @@ char ** process_args(char **argv, case 'o': /* object file */ argv++; if( !*argv ) bad_args(7); /* die */ - while (argv[0][0] == NULL)argv++; /* Skip empty arguments */ + while (streq (argv[0],"")) argv++; /* Skip empty arguments */ *pobject_file = *argv; break; @@ -84,7 +85,7 @@ char ** process_args(char **argv, case 'i': argv++; if( !*argv ) bad_args(8); /* die */ - while (argv[0][0] == NULL)argv++; /* Skip empty arguments */ + while (streq (argv[0],"")) argv++; /* Skip empty arguments */ *pimage_name = *argv++; return argv;