Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sat, 11 Aug 2012 20:41:57 +0200
From: Daniel Cegiełka <daniel.cegielka@...il.com>
To: musl@...ts.openwall.com
Subject: Re: Priorities for next release?

>> Couldn't this code just be fixed to add an argument to usage() and
>> call usage(argv[0]) or even usage(basename(argv[0])) if preferred?
>>
>> Rich
>
> Or even progname = basename(argv[0]) with global char *progname ?

Usually it looks like this:

extern char *__progname;

'extern' means __progname must be available to external objects, so in
code with main():

#include <stdio.h>

char *__progname;

int main(int argc, char *argv[])
{
        __progname = argv[0];
        printf("%s\n", __progname);
        return 0;
}

what you think? It works for me... so why basename(argv[0])?

Daniel

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.