Author: Stan Eisenstat
Subject: Re: [Cs323] Command Line Argument Follow Up
Date: Saturday, 05 Sep 2020, 13:46:59
> Message Posted By: Unknown > > If I have the following argument where /hello and /test dont exist: > "/c/cs323/Hwk1/fiend /hello test -f" the output is: > fiend: invalid argument: -f > > But, If I remove the -f, the output of > "/c/cs323/Hwk1/fiend /hello /test" > is > fiend: stat(/hello) Failed > fiend: stat(test) Failed > > Shouldn't the output of the first command be: > > fiend: stat(/hello) Failed > fiend: stat(test) Failed > fiend: invalid argument: -f > > Since the files are valid but fiend just failed? No. As stated in the specification * The list of FILENAMEs begins with the first argument that is neither -P nor -L and ends just before the next argument that begins with a -. Thus in the first example, -f cannot be the name of a file, and thus must be an invalid option/test/action/operator, which causes fiend to write a message to stderr and exit. --Stan-PREV INDEX NEXT