Date: Fri, 7 Oct 2011 12:59:04 +0000 (UTC) From: Gabor Kovesdan <gabor@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r226102 - user/gabor/grep/trunk Message-ID: <201110071259.p97Cx44l011713@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: gabor Date: Fri Oct 7 12:59:04 2011 New Revision: 226102 URL: http://svn.freebsd.org/changeset/base/226102 Log: - Use getprogname() instead of __progname because it is more portable Submitted by: delphij Modified: user/gabor/grep/trunk/grep.c Modified: user/gabor/grep/trunk/grep.c ============================================================================== --- user/gabor/grep/trunk/grep.c Fri Oct 7 12:58:33 2011 (r226101) +++ user/gabor/grep/trunk/grep.c Fri Oct 7 12:59:04 2011 (r226102) @@ -150,15 +150,13 @@ bool prev; /* flag whether or not the int tail; /* lines left to print */ bool notfound; /* file not found */ -extern char *__progname; - /* * Prints usage information and returns 2. */ static void usage(void) { - fprintf(stderr, getstr(4), __progname); + fprintf(stderr, getstr(4), getprogname()); fprintf(stderr, "%s", getstr(5)); fprintf(stderr, "%s", getstr(5)); fprintf(stderr, "%s", getstr(6)); @@ -332,7 +330,8 @@ int main(int argc, char *argv[]) { char **aargv, **eargv, *eopts; - char *pn, *ep; + char *ep; + const char *pn; unsigned long long l; unsigned int aargc, eargc, i; int c, lastc, needpattern, newarg, prevoptind; @@ -346,7 +345,7 @@ main(int argc, char *argv[]) /* Check what is the program name of the binary. In this way we can have all the funcionalities in one binary without the need of scripting and using ugly hacks. */ - pn = __progname; + pn = getprogname(); if (pn[0] == 'b' && pn[1] == 'z') { filebehave = FILE_BZIP; pn += 2; @@ -568,7 +567,7 @@ main(int argc, char *argv[]) filebehave = FILE_MMAP; break; case 'V': - printf(getstr(9), __progname, VERSION); + printf(getstr(9), getprogname(), VERSION); exit(0); case 'v': vflag = true;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201110071259.p97Cx44l011713>