svn commit: r226102 - user/gabor/grep/trunk
Gabor Kovesdan
gabor at FreeBSD.org
Fri Oct 7 12:59:04 UTC 2011
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;
More information about the svn-src-user
mailing list