-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
DB wrote:
> Lew Pitcher wrote:
>
>> A program can easily check to find out what name it is run under, and
>> change
>> it's behaviour accordingly.
#include <stdio.h>
#include <stdlib.h>
>> int main(int argc, char *argv[])
>> {
>> if (argc > 0)
>> {
>> if (strcmp(argv[0],"hi") == 0)
>> printf("Hello, world\n");
>> else if (strcmp(argv[0],"bye") == 0)
>> printf("Goodbye, cruel world\n");
>> else
>> printf("Whatchu lookn at, Willis?\n");
return EXIT_SUCCESS;
>> }
else return EXIT_FAILURE;
>> }
>>
>> The above will do different things, if it is run as 'hi' or 'bye' or
>> a.out
>>
>
> I think that should be "What u talkin' 'bout, Willis?"
Only if you like "Diff'rent Strokes" ;-)
- --
Lew Pitcher
Master Codewright & JOAT-in-training | GPG public key available on request
Registered Linux User #112576 (
http://counter.li.org/)
Slackware - Because I know what I'm doing.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFCMjmbagVFX4UWr64RAs/SAKCk1zw+FkeQxXN0aZ0IoESc1YUR0gCg2boo
/cjn+lyiHtUJeIOUZDuuEbA=
=+gXz
-----END PGP SIGNATURE-----