summaryrefslogtreecommitdiffstats
path: root/contrib/com_err/compile_et.c
diff options
context:
space:
mode:
authordfr <dfr@FreeBSD.org>2008-05-08 11:01:46 +0000
committerdfr <dfr@FreeBSD.org>2008-05-08 11:01:46 +0000
commit62929665b739d66740a668830f004f9463f3ced9 (patch)
tree29031943aed09b2fbdbdc248e2868d86477d1ea3 /contrib/com_err/compile_et.c
parente240fee79046f8dbba1a0ff52d7d6d7db5d9ecf4 (diff)
downloadFreeBSD-src-62929665b739d66740a668830f004f9463f3ced9.zip
FreeBSD-src-62929665b739d66740a668830f004f9463f3ced9.tar.gz
Merge from the vendor branch and resolve conflicts.
Diffstat (limited to 'contrib/com_err/compile_et.c')
-rw-r--r--contrib/com_err/compile_et.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/contrib/com_err/compile_et.c b/contrib/com_err/compile_et.c
index 59d9de9..1c78325 100644
--- a/contrib/com_err/compile_et.c
+++ b/contrib/com_err/compile_et.c
@@ -37,7 +37,7 @@
#include <getarg.h>
#if 0
-RCSID("$Id: compile_et.c,v 1.16 2002/08/20 12:44:51 joda Exp $");
+RCSID("$Id: compile_et.c 15426 2005-06-16 19:21:42Z lha $");
#endif
#include <err.h>
@@ -48,7 +48,7 @@ extern FILE *yyin;
extern void yyparse(void);
-long base;
+long base_id;
int number;
char *prefix;
char *id_str;
@@ -158,13 +158,13 @@ generate_h(void)
fprintf(h_file, "typedef enum %s_error_number{\n", name);
for(ec = codes; ec; ec = ec->next) {
- fprintf(h_file, "\t%s = %ld%s\n", ec->name, base + ec->number,
+ fprintf(h_file, "\t%s = %ld%s\n", ec->name, base_id + ec->number,
(ec->next != NULL) ? "," : "");
}
fprintf(h_file, "} %s_error_number;\n", name);
fprintf(h_file, "\n");
- fprintf(h_file, "#define ERROR_TABLE_BASE_%s %ld\n", name, base);
+ fprintf(h_file, "#define ERROR_TABLE_BASE_%s %ld\n", name, base_id);
fprintf(h_file, "\n");
fprintf(h_file, "#endif /* %s */\n", fn);
@@ -196,17 +196,17 @@ int
main(int argc, char **argv)
{
char *p;
- int optind = 0;
+ int optidx = 0;
setprogname(argv[0]);
- if(getarg(args, num_args, argc, argv, &optind))
+ if(getarg(args, num_args, argc, argv, &optidx))
usage(1);
if(help_flag)
usage(0);
- if(optind == argc)
+ if(optidx == argc)
usage(1);
- filename = argv[optind];
+ filename = argv[optidx];
yyin = fopen(filename, "r");
if(yyin == NULL)
err(1, "%s", filename);
@@ -217,8 +217,7 @@ main(int argc, char **argv)
p++;
else
p = filename;
- strncpy(Basename, p, sizeof(Basename));
- Basename[sizeof(Basename) - 1] = '\0';
+ strlcpy(Basename, p, sizeof(Basename));
Basename[strcspn(Basename, ".")] = '\0';
OpenPOWER on IntegriCloud