diff options
author | ru <ru@FreeBSD.org> | 2003-06-18 12:57:43 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2003-06-18 12:57:43 +0000 |
commit | 07bc4ba91abd41caff6943cdd2fba218a48492c8 (patch) | |
tree | 17923f3c3c11ccba32be7fb4eaa72821a948a5b5 /contrib/texinfo/util | |
parent | dbea3df4e6605a55f44a33dcfbdb4cdc8fed0da9 (diff) | |
parent | b0465e4534c37946b9f157053a91a25b88ee6c6f (diff) | |
download | FreeBSD-src-07bc4ba91abd41caff6943cdd2fba218a48492c8.zip FreeBSD-src-07bc4ba91abd41caff6943cdd2fba218a48492c8.tar.gz |
This commit was generated by cvs2svn to compensate for changes in r116525,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'contrib/texinfo/util')
-rw-r--r-- | contrib/texinfo/util/texindex.c | 50 |
1 files changed, 18 insertions, 32 deletions
diff --git a/contrib/texinfo/util/texindex.c b/contrib/texinfo/util/texindex.c index c7dc64b..f63fdb5 100644 --- a/contrib/texinfo/util/texindex.c +++ b/contrib/texinfo/util/texindex.c @@ -1,5 +1,5 @@ /* texindex -- sort TeX index dribble output into an actual index. - $Id: texindex.c,v 1.7 2003/01/19 18:47:15 karl Exp $ + $Id: texindex.c,v 1.9 2003/05/19 13:10:59 karl Exp $ Copyright (C) 1987, 1991, 1992, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. @@ -166,7 +166,7 @@ main (argc, argv) /* In case we write to a redirected stdout that fails. */ /* not ready atexit (close_stdout); */ - + /* Describe the kind of sorting to do. */ /* The first keyfield uses the first braced field and folds case. */ keyfields[0].braced = 1; @@ -218,9 +218,7 @@ main (argc, argv) outfile = outfiles[i]; if (!outfile) - { - outfile = concat (infiles[i], "s", ""); - } + outfile = concat (infiles[i], "s"); need_initials = 0; first_initial = '\0'; @@ -234,7 +232,6 @@ main (argc, argv) flush_tempfiles (tempcount); xexit (0); - return 0; /* Avoid bogus warnings. */ } @@ -322,7 +319,7 @@ decode_command (argc, argv) if (tempdir == NULL) tempdir = DEFAULT_TMPDIR; else - tempdir = concat (tempdir, "/", ""); + tempdir = concat (tempdir, "/"); keep_tempfiles = 0; @@ -401,18 +398,15 @@ maketempname (count) if (!tempbase) { int fd; - char *tmpdir = getenv ("TEMPDIR"); - if (!tmpdir) - tmpdir = "/tmp"; - tempbase = concat (tmpdir, "/txidxXXXXXX"); + tempbase = concat (tempdir, "txidxXXXXXX"); fd = mkstemp (tempbase); - if (fd == -1) + if (fd == -1) pfatal_with_name (tempbase); } sprintf (tempsuffix, ".%d", count); - return concat (tempdir, tempbase, tempsuffix); + return concat (tempbase, tempsuffix); } @@ -1140,7 +1134,7 @@ parsefile (filename, nextline, data, size) } else first_initial = toupper (*p); - + while (*p && *p != '\n') p++; if (p != end) @@ -1653,39 +1647,31 @@ void perror_with_name (name) char *name; { - char *s; - - s = strerror (errno); - printf ("%s: ", program_name); - printf ("%s; for file `%s'.\n", s, name); + fprintf (stderr, "%s: ", program_name); + perror (name); } void pfatal_with_name (name) char *name; { - char *s; - - s = strerror (errno); - printf ("%s: ", program_name); - printf (_("%s; for file `%s'.\n"), s, name); + perror_with_name (name); xexit (1); } -/* Return a newly-allocated string whose contents concatenate those of - S1, S2, S3. */ + +/* Return a newly-allocated string concatenating S1 and S2. */ char * -concat (s1, s2, s3) - char *s1, *s2, *s3; +concat (s1, s2) + char *s1, *s2; { - int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3); - char *result = (char *) xmalloc (len1 + len2 + len3 + 1); + int len1 = strlen (s1), len2 = strlen (s2); + char *result = (char *) xmalloc (len1 + len2 + 1); strcpy (result, s1); strcpy (result + len1, s2); - strcpy (result + len1 + len2, s3); - *(result + len1 + len2 + len3) = 0; + *(result + len1 + len2) = 0; return result; } |