dj(1), intcmp(1), mm(1), npc(1), scrut(1), strcmp(1): changes to use and modify program_name
This commit is contained in:
8
src/dj.c
8
src/dj.c
@@ -30,7 +30,7 @@
|
||||
|
||||
extern int errno;
|
||||
|
||||
static char *program_name = "dj";
|
||||
char *program_name = "dj";
|
||||
|
||||
/* dj uses two structures that respectively correspond to the reading and
|
||||
* writing ends of its jockeyed "pipe". User-configurable members are noted
|
||||
@@ -163,7 +163,7 @@ int main(int argc, char *argv[]) {
|
||||
size_t i; /* side of io being modified */
|
||||
char noerror; /* 0=exits (default) 1=retries on partial reads or writes */
|
||||
struct Io io[2 /* { in, out } */];
|
||||
char *s = (argv[0] == NULL ? program_name : argv[0]);
|
||||
program_name = (argv[0] == NULL ? program_name : argv[0]);
|
||||
|
||||
/* Set defaults. */
|
||||
align = -1;
|
||||
@@ -234,7 +234,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
return usage(s);
|
||||
return usage(program_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -242,7 +242,7 @@ int main(int argc, char *argv[]) {
|
||||
assert(io->fd != STDIN_FILENO || io->fl == read_flags);
|
||||
assert(io->fd != STDOUT_FILENO || io->fl == write_flags);
|
||||
|
||||
if (argc > optind) { return usage(s); }
|
||||
if (argc > optind) { return usage(program_name); }
|
||||
|
||||
for (i = 0; i < (sizeof io) / (sizeof *io); ++i) {
|
||||
/* buffer allocation */
|
||||
|
||||
Reference in New Issue
Block a user