Revised names for lesser beings
This commit is contained in:
parent
26a160f6b0
commit
6c7ecaa390
28
src/main.c
28
src/main.c
@ -7,8 +7,8 @@
|
||||
#define ALLOCATION_CHUNK (1024UL)
|
||||
#define ALLOCATION_LIMIT (1024UL * 1024UL)
|
||||
|
||||
#ifndef PROGN
|
||||
# define PROGN "hl"
|
||||
#ifndef PROGRAM_NAME
|
||||
# define PROGRAM_NAME "hl"
|
||||
#endif
|
||||
|
||||
enum { NORMAL, BOLD, DARKNESS, ITALIC, UNDERLINE, BLINK, DUNNO_6, REVERSE, INVISIBLE };
|
||||
@ -305,7 +305,7 @@ slurp(const char * fn)
|
||||
b = malloc(len);
|
||||
if (b &&
|
||||
len != fread(b, 1, len, fp))
|
||||
{ perror(PROGN); }
|
||||
{ perror(PROGRAM_NAME); }
|
||||
fclose(fp);
|
||||
return b;
|
||||
}
|
||||
@ -313,18 +313,14 @@ slurp(const char * fn)
|
||||
{ return NULL; }
|
||||
}
|
||||
|
||||
#define OPT(c,s) \
|
||||
/* "Short" */
|
||||
#define SHORT_OPT(c,s) \
|
||||
if ((c == argv[0][0] && argv[0][1] == '\0') || \
|
||||
0 == strncmp(argv[0], s, strlen(s)))
|
||||
|
||||
#define SOPT(s) \
|
||||
#define OPT(s) \
|
||||
if (0 == strncmp(argv[0], s, strlen(s)))
|
||||
|
||||
/*
|
||||
Valgrind: Depends on uninitialized value (buffer [0])...?
|
||||
280 : } while ((buffer [buffer_size - 1] != '\0') || (buffer_size != ALLOCATION_LIMIT));
|
||||
285 : while (buffer [offset] != '\0') {
|
||||
*/
|
||||
int main (
|
||||
int argc,
|
||||
char ** argv
|
||||
@ -336,16 +332,16 @@ int main (
|
||||
while (++argv, --argc) {
|
||||
if (argv[0][0] == '-') {
|
||||
argv[0]++;
|
||||
OPT ('?',"help") {
|
||||
fprintf (stderr, PROGN ": hl [OPTIONS] FILES ...\n");
|
||||
SHORT_OPT ('?',"help") {
|
||||
fprintf (stderr, PROGRAM_NAME ": hl [OPTIONS] FILES ...\n");
|
||||
return (0);
|
||||
}
|
||||
SOPT ("version") {
|
||||
fprintf(stderr, PROGN ": Version 9000\n");
|
||||
OPT ("version") {
|
||||
fprintf(stderr, PROGRAM_NAME ": Version 9000\n");
|
||||
return (0);
|
||||
}
|
||||
else {
|
||||
fprintf (stderr, PROGN ": Unrecognized option '%s'\n", argv [0]);
|
||||
fprintf (stderr, PROGRAM_NAME ": Unrecognized option '%s'\n", argv [0]);
|
||||
return (1);
|
||||
}
|
||||
} else {
|
||||
@ -360,7 +356,7 @@ int main (
|
||||
|
||||
buffer = realloc (buffer, ALLOCATION_CHUNK);
|
||||
|
||||
#define MEMFAIL(v) if (v == NULL) { perror(PROGN); return (1); }
|
||||
#define MEMFAIL(v) if (v == NULL) { perror(PROGRAM_NAME); return (1); }
|
||||
MEMFAIL(buffer);
|
||||
|
||||
do {
|
||||
|
Loading…
Reference in New Issue
Block a user