Prevent useless use of strdup(3)

Obtained from:	NetBSD
This commit is contained in:
Baptiste Daroussin 2015-05-05 08:25:25 +00:00
parent 1dd178d10d
commit 224c825745
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=282460

View File

@ -124,6 +124,8 @@ bool l_toplex; /* procedures only defined at top lex level */
const char *language = "c"; /* the language indicator */
#define ps(x) printf("%s", x)
static char minus[] = "-";
static char minusn[] = "-n";
int
main(int argc, char **argv)
@ -158,7 +160,7 @@ main(int argc, char **argv)
if (!strcmp(argv[0], "-f")) {
filter = true;
argv[0] = argv[argc-1];
argv[argc-1] = strdup("-");
argv[argc-1] = minus;
continue;
}
@ -171,7 +173,7 @@ main(int argc, char **argv)
/* build an index */
if (!strcmp(argv[0], "-x")) {
idx = true;
argv[0] = strdup("-n");
argv[0] = minusn;
}
/* indicate no keywords */