From 32be6364a6fb1efc53595422792e1e8605f6de1a Mon Sep 17 00:00:00 2001 From: Werner LEMBERG Date: Sat, 7 Jul 2001 22:09:46 +0000 Subject: [PATCH] * src/utils/indxbib/indxbib.cc (main): Change type of `name_max' to size_t. --- ChangeLog | 5 +++++ src/utils/indxbib/indxbib.cc | 52 ++++++++++++++++++++------------------------ 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/ChangeLog b/ChangeLog index c71b4675..452d4fe1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2001-07-07 Werner LEMBERG + + * src/utils/indxbib/indxbib.cc (main): Change type of `name_max' + to size_t. + 2001-07-06 Ruslan Ermilov * tmac/doc.tmac (Rv): Make `Rv' really not parseable. diff --git a/src/utils/indxbib/indxbib.cc b/src/utils/indxbib/indxbib.cc index b2be9642..4b2477f7 100644 --- a/src/utils/indxbib/indxbib.cc +++ b/src/utils/indxbib/indxbib.cc @@ -179,11 +179,9 @@ int main(int argc, char **argv) parser = do_whole_file; break; case 'v': - { - printf("GNU indxbib (groff) version %s\n", Version_string); - exit(0); - break; - } + printf("GNU indxbib (groff) version %s\n", Version_string); + exit(0); + break; case CHAR_MAX + 1: // --help usage(stdout); exit(0); @@ -214,14 +212,13 @@ int main(int argc, char **argv) basename = optind < argc ? argv[optind] : DEFAULT_INDEX_NAME; const char *p = strrchr(basename, DIR_SEPS[0]), *p1; const char *sep = &DIR_SEPS[1]; - while (*sep) - { - p1 = strrchr(basename, *sep); - if (p1 && (!p || p1 > p)) - p = p1; - sep++; - } - long name_max; + while (*sep) { + p1 = strrchr(basename, *sep); + if (p1 && (!p || p1 > p)) + p = p1; + sep++; + } + size_t name_max; if (p) { char *dir = strsave(basename); dir[p - basename] = '\0'; @@ -303,23 +300,22 @@ int main(int argc, char **argv) strcpy(index_file, basename); strcat(index_file, INDEX_SUFFIX); #ifdef HAVE_RENAME - if (rename(temp_index_file, index_file) < 0) - { + if (rename(temp_index_file, index_file) < 0) { #ifdef __MSDOS__ - // RENAME could fail on plain MSDOS filesystems because - // INDEX_FILE is an invalid filename, e.g. it has multiple dots. - char *fname = p ? index_file + (p - basename) : 0; - char *dot = 0; - - // Replace the dot with an underscore and try again. - if (fname - && (dot = strchr(fname, '.')) != 0 - && strcmp(dot, INDEX_SUFFIX) != 0) - *dot = '_'; - if (rename(temp_index_file, index_file) < 0) + // RENAME could fail on plain MSDOS filesystems because + // INDEX_FILE is an invalid filename, e.g. it has multiple dots. + char *fname = p ? index_file + (p - basename) : 0; + char *dot = 0; + + // Replace the dot with an underscore and try again. + if (fname + && (dot = strchr(fname, '.')) != 0 + && strcmp(dot, INDEX_SUFFIX) != 0) + *dot = '_'; + if (rename(temp_index_file, index_file) < 0) #endif - fatal("can't rename temporary index file: %1", strerror(errno)); - } + fatal("can't rename temporary index file: %1", strerror(errno)); + } #else /* not HAVE_RENAME */ ignore_fatal_signals(); if (unlink(index_file) < 0) { -- 2.11.4.GIT