From 62929665b739d66740a668830f004f9463f3ced9 Mon Sep 17 00:00:00 2001 From: dfr Date: Thu, 8 May 2008 11:01:46 +0000 Subject: Merge from the vendor branch and resolve conflicts. --- contrib/com_err/compile_et.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'contrib/com_err/compile_et.c') 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 #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 @@ -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'; -- cgit v1.1