Download raw body.
[PATCH] Make incorrect ftp(1) usage more obvious
H. Hartzer <h@hartzer.sh> wrote: > Hi tech@, > > I'm coming from a background of curl, wget, and fetch where I > frequently run my commands with the options after, like: > curl https://openbsd.org -o index.html > Unfortunately, this makes ftp(1)'s behavior a bit confusing. > > For example: > > ftp https://openbsd.org/index.html -o dir/openbsd-index.html > will silently put index.html into the current directory and exit 0. > > ftp(1) only accepts arguments at the start of the command. None after > the URL(s). > > This patch informs the user if they are making such a mistake. It also > adjusts the exit code for usage errors to 2, which makes testing a > little bit easier. It includes some basic regression testing. > > Let me know if you have any questions or if this needs any adjustments. I disagree strongly. We follow original POSIX getopt(3) rules in every program, using libc code. This applies to ALL commands. No commands are different. It means all options must be before non-option arguments. Placing options after non-options is going to break on any non-GLIBC/MUSL system, and you are going to need to get used to that being the wrong thing to do and put your arguments in the standards-mandated order.
[PATCH] Make incorrect ftp(1) usage more obvious