On 4 Dec 2012, at 18:07, Kevin Dalley wrote:

> Please don't use argv[0] to determine the behavior.  This is confusing.
> 
> It should be possible to make a link to a program and have it behave in 
> the same way as the original program. 
> 
> Also, it violates the GNU standards.
> 
> http://www.gnu.org/prep/standards/html_node/User-Interfaces.html#User-Interfaces

Opinion from someone who has had exposure to reading the code but not writing
it, and tripped over the current CLI.

In my opinion using argv[0] to influence program operation is perfectly
reasonable and a lot of linux utilities do it (for better or worse). Moreover,
the appropriate standard should be POSIX not GNU here. I don't believe there
is a POSIX requirement not to do this (but POSIX standards are full of 
surprises).
I understand some people consider it hacky, but it does permit the following
which is what I'd recommend.

If invoked as xfreerdp, use a command line interface as close as possible to the
current one. I know this needs work, having tried to find my way through the
homebrew parser to backport stuff. I would suggest moving to the getopt_long
which has support everywhere, and at least is a known quantity. I do not think
there is anything freerdp does which would not possible using getopt_long, and
there might be bugs which could be fixed by a refactor (from memory the parsing
of certain security parameters depends on other parameters, which means as they
are parsed in order, the effect is dependent upon the ordering of parameters -
this could be fixed by recording parameters prior to interpreting them).

If invoked as [something else], use a CLI more friendly for windows users, be
that borrowed from mstsc or otherwise.

Heuristics that rely on the presence or absence of slashes or minus signs
are bound to fail as filenames on windows can begin with minus signs and
file names (well, paths) on linux can begin with slashes. So don't try and
guess, use something that can never be ambiguous (i.e. argv[0]). I believe
on some non-POSIX platforms it may not be possible to determine the value
of argv[0], but I doubt xfreerdp will run there anyway.

-- 
Alex Bligh





------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Freerdp-devel mailing list
Freerdp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freerdp-devel

Reply via email to