mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-03 23:28:58 +00:00
Use the getprogname(3) function instead of directly accessing
`__progname'. Submitted by: dd
This commit is contained in:
parent
56e04d01c0
commit
3ce3a0bf8d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=90458
|
@ -56,8 +56,6 @@ static const char rcsid[] =
|
|||
#include <unistd.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
extern char *__progname;
|
||||
|
||||
static char *getcwd_logical(void);
|
||||
void usage(void);
|
||||
|
||||
|
@ -69,7 +67,7 @@ main(int argc, char *argv[])
|
|||
char *p;
|
||||
char buf[PATH_MAX];
|
||||
|
||||
if (strcmp(__progname, "realpath") == 0) {
|
||||
if (strcmp(getprogname(), "realpath") == 0) {
|
||||
if (argc != 2)
|
||||
usage();
|
||||
if ((p = realpath(argv[1], buf)) == NULL)
|
||||
|
@ -109,7 +107,7 @@ void
|
|||
usage(void)
|
||||
{
|
||||
|
||||
if (strcmp(__progname, "realpath") == 0)
|
||||
if (strcmp(getprogname(), "realpath") == 0)
|
||||
(void)fprintf(stderr, "usage: realpath [path]\n");
|
||||
else
|
||||
(void)fprintf(stderr, "usage: pwd [-L | -P]\n");
|
||||
|
|
Loading…
Reference in a new issue