Fixed -m command line option (only numerical form is supported)

This commit is contained in:
Pierre Pronchery 2005-07-14 16:58:16 +00:00
parent 027c167084
commit eb41fcfaad

View File

@ -36,21 +36,21 @@ int main(int argc, char * argv[])
mode_t mode = 0777;
int errcode = 0;
int o;
char * p;
int i;
while((o = getopt(argc, argv, "m:")) != -1)
{
switch(o)
{
case 'm':
/* FIXME */
if((mode = strtol(optarg, NULL, 8)) > 0777)
/* FIXME mode may be an expression */
mode = strtol(optarg, &p, 8);
if(*optarg == '\0' || *p != '\0' || mode > 0777)
return _usage();
break;
case '?':
default:
return _usage();
}
}
if(argc == optind)
return _usage();
for(i = optind; i < argc; i++)