On 2014-06-12 11:32, Alexander Hall wrote:
> On June 11, 2014 6:18:19 AM CEST, Lawrence Teo <l...@openbsd.org> wrote: > >> This diff allows ftp(1) to change the User-Agent for HTTP(S) URL requests via the FTPUSERAGENT environment variable (personally I prefer HTTPUSERAGENT but FTPUSERAGENT is what's used by ftp(1) on other BSDs). This is useful when fetching URLs that are sensitive to the User-Agent, such as sites that send different content if you're using a mobile browser/device. > > I generally dislike passing options as environment variables. The use case you describe does not really strike me as something I'd have in my $ENV. > > Does any of the other ftp's have a corresponding switch for it? There are conflicting precedents. curl provides -A/--user-agent and wget provides -U/--user-agent, and neither appears to obey any environment variable for setting the user agent string. OpenBSD, FreeBSD and NetBSD's ftp(1) all use "-A" to mean something else, and none of them appear to have a "-U" option yet. As the OP mentioned, however, {Net,Free}BSD's ftp(1) already uses $FTPUSERAGENT. As a user, I don't really care which way it happens. I can trivially either run "ftp -U $FTPUSERAGENT ..." or (not assuming any particular shell) "env FTPUSERAGENT=blah ftp ..." depending on what I'm trying to accomplish. If I were trying to write something without checking the man page, which would be rather unsmart, I would probably assume that OpenBSD behaves like the other BSDs. -Adam