From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/1530 Path: news.gmane.org!not-for-mail From: orc Newsgroups: gmane.linux.lib.musl.general Subject: Re: Priorities for next release? Date: Sun, 12 Aug 2012 02:47:16 +0800 Message-ID: <20120812024716.47125694@sibserver.ru> References: <50258541.6000805@gentoo.org> <20120811000553.GD27715@brightrain.aerifal.cx> <5025AD41.3060009@gentoo.org> <22761.132.241.65.128.1344651681.squirrel@lavabit.com> <20120811023602.GF27715@brightrain.aerifal.cx> <20120811122712.GG27715@brightrain.aerifal.cx> <20120811160950.GH27715@brightrain.aerifal.cx> <20120811165049.GI27715@brightrain.aerifal.cx> <20120812015536.3caa3999@sibserver.ru> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1344710953 6114 80.91.229.3 (11 Aug 2012 18:49:13 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 11 Aug 2012 18:49:13 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-1531-gllmg-musl=m.gmane.org@lists.openwall.com Sat Aug 11 20:49:14 2012 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1T0GkF-0002tq-Ek for gllmg-musl@plane.gmane.org; Sat, 11 Aug 2012 20:49:07 +0200 Original-Received: (qmail 20325 invoked by uid 550); 11 Aug 2012 18:49:06 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 20314 invoked from network); 11 Aug 2012 18:49:02 -0000 In-Reply-To: X-Mailer: claws-mail Xref: news.gmane.org gmane.linux.lib.musl.general:1530 Archived-At: On Sat, 11 Aug 2012 20:41:57 +0200 Daniel Cegie=C5=82ka wrote: > >> 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 =3D basename(argv[0]) with global char *progname ? >=20 > Usually it looks like this: >=20 > extern char *__progname; >=20 > 'extern' means __progname must be available to external objects, so in > code with main(): >=20 > #include >=20 > char *__progname; >=20 > int main(int argc, char *argv[]) > { > __progname =3D argv[0]; > printf("%s\n", __progname); > return 0; > } >=20 > what you think? It works for me... so why basename(argv[0])? >=20 > Daniel basename() is for stripping path objects, for example, when you run prog via full path, /bin/true, basename("/bin/true") =3D "true" See man 3 basename