Set the program name if the crunched program is selected through
argv[1] to mimic crt0 behaviour. Do the job by a direct assignment to __progname in order to stay compatible with NetBSD, whose setprogname() is a deliberate no-op. The reason for this change is that some programs (usually those imported from NetBSD) use getprogname() to distinguish between their aliases. (See pkill aka pgrep for example.) This change can be useful, and applicable, to NetBSD, too.
This commit is contained in:
parent
b4b5bf359b
commit
a7aebe893d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=173065
@ -41,6 +41,7 @@ struct stub {
|
||||
int (*f)();
|
||||
};
|
||||
|
||||
extern char *__progname;
|
||||
extern struct stub entry_points[];
|
||||
|
||||
int main(int argc, char **argv, char **envp)
|
||||
@ -83,12 +84,16 @@ int crunched_here(char *path)
|
||||
|
||||
int crunched_main(int argc, char **argv, char **envp)
|
||||
{
|
||||
char *slash;
|
||||
struct stub *ep;
|
||||
int columns, len;
|
||||
|
||||
if(argc <= 1)
|
||||
crunched_usage();
|
||||
|
||||
slash = strrchr(argv[1], '/');
|
||||
__progname = slash? slash+1 : argv[1];
|
||||
|
||||
return main(--argc, ++argv, envp);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user