npc(1): improves program_name resolution

This commit is contained in:
Emma Tebibyte 2024-07-29 02:35:01 -06:00
parent 8bb57bf2e4
commit 361b34c50f
Signed by: emma
GPG Key ID: 06FA419A1698C270

View File

@ -36,9 +36,10 @@ int main(int argc, char *argv[]) {
int c; int c;
char showend = 0; /* print a dollar sign before each newline */ char showend = 0; /* print a dollar sign before each newline */
char showtab = 0; /* prints tab characters in caret notation */ char showtab = 0; /* prints tab characters in caret notation */
program_name = (argv[0] == NULL ? program_name : argv[0]);
if (argc > 0) { if (argc > 0) {
program_name = argv[0];
while ((c = getopt(argc, argv, "et")) != -1) { while ((c = getopt(argc, argv, "et")) != -1) {
switch (c){ switch (c){
case 'e': showend = 1; break; case 'e': showend = 1; break;