Re: Multipurpose binaries with different names

2009-07-28 Thread Tor Lillqvist
> #ifdef _WIN32 >  executable_name = strrchr (argv[0], '\\'); Bzzt. You have to use the multi-byte character set aware _mbschr() and _mbsrchr() functions from to search for backlashes (or slashes) in "narrow" (char *) system code page strings (for instance, file names) on Windows. The East Asian

Re: Multipurpose binaries with different names

2009-07-28 Thread Paolo Bonzini
On 07/24/2009 11:25 AM, Jan Engelhardt wrote: Hi, when one has a program that does something like if(strcmp(argv[0], "gunzip") == 0) uncompress(); else compress(); and this program also uses a libtool library, then the - lets use this example - just-built "gzip" file will be a

Re: Multipurpose binaries with different names

2009-07-25 Thread Ralf Wildenhues
* Jan Engelhardt wrote on Fri, Jul 24, 2009 at 11:25:51AM CEST: > > if [[ "$0" != %program_name% ]]; then > t=$(mktemp -d); > ln -s %program_name% "$t/${0##*/}"; > [...do libtool setup like LD_LIBRARY_PATH etc...] > exec "$t/${0##*/}"; Actually, this isn't such a bad idea: use '

Re: Multipurpose binaries with different names

2009-07-25 Thread Ralf Wildenhues
Hello Jan, * Jan Engelhardt wrote on Fri, Jul 24, 2009 at 03:57:33PM CEST: > I might resort to using shell scripts instead of symlinks that > will use (using original example) `gzip --mode=gunzip`, because > install(1) does not preserve symlinks across copies either. Gah. Symlinks below $DESTDIR$

Re: Multipurpose binaries with different names

2009-07-24 Thread Bob Friesenhahn
On Fri, 24 Jul 2009, Jan Engelhardt wrote: The reason to do symlinking is that some programs are large enough to warrant not compiling them again or have a double copy of it on the filesystem. The presence of /usr/bin/dir in system I would consider a waste of space, even if it's "just" 100K. Do

Re: Multipurpose binaries with different names

2009-07-24 Thread Jan Engelhardt
On Friday 2009-07-24 13:56, Eric Blake wrote: >> 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

Re: Multipurpose binaries with different names

2009-07-24 Thread Roumen Petrov
Eric Blake wrote: -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: h

Re: Multipurpose binaries with different names

2009-07-24 Thread Eric Blake
-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:

Multipurpose binaries with different names

2009-07-24 Thread Jan Engelhardt
Hi, when one has a program that does something like if(strcmp(argv[0], "gunzip") == 0) uncompress(); else compress(); and this program also uses a libtool library, then the - lets use this example - just-built "gzip" file will be around 4 kilobytes only, it is a libtool wrapper sc