[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Multipurpose binaries with different names
From: |
Eric Blake |
Subject: |
Re: Multipurpose binaries with different names |
Date: |
Fri, 24 Jul 2009 05:56:35 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.22) Gecko/20090605 Thunderbird/2.0.0.22 Mnenhy/0.7.6.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Jan Engelhardt on 7/24/2009 3:25 AM:
> Hi,
>
>
> when one has a program that does something like
>
> if(strcmp(argv[0], "gunzip") == 0)
> uncompress();
> else
> compress();
GNU Coding Standards frown on this practice:
http://www.gnu.org/software/automake/manual/standards.html#User-Interfaces
Instead, it should be done the way coreutils differentiates 'ls' from
'dir' behavior - the latter merely #defines a single variable to choose a
different set of defaults, then includes the source of the former. But
the point is that they are two distinct applications, rather than one that
makes decisions based on argv[0].
That said, you are correct that not all programs follow GCS this closely,
so it would indeed be nice if libtool wrapper scripts could accomodate
this. But better than creating a temporary file every time would be
figuring out ways to change argv[0] from the shell (although not all
shells support this, and those that do don't always do it in the same manner).
- --
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkppoXMACgkQ84KuGfSFAYCqTQCgtyaccnT7h+hZ6cpSJLqzXvTT
dXEAn2DLAphgb1sN0c4UJcLbGEz7+QK3
=boVj
-----END PGP SIGNATURE-----