From b0465e4534c37946b9f157053a91a25b88ee6c6f Mon Sep 17 00:00:00 2001 From: ru Date: Wed, 18 Jun 2003 12:57:43 +0000 Subject: Import of stripped down GNU texinfo 4.6 --- contrib/texinfo/util/install-info.c | 32 +++--------------------- contrib/texinfo/util/texindex.c | 50 +++++++++++++------------------------ 2 files changed, 21 insertions(+), 61 deletions(-) (limited to 'contrib/texinfo/util') diff --git a/contrib/texinfo/util/install-info.c b/contrib/texinfo/util/install-info.c index 75fcba9..d346fb7 100644 --- a/contrib/texinfo/util/install-info.c +++ b/contrib/texinfo/util/install-info.c @@ -1,5 +1,5 @@ /* install-info -- create Info directory entry(ies) for an Info file. - $Id: install-info.c,v 1.7 2003/01/19 18:46:51 karl Exp $ + $Id: install-info.c,v 1.9 2003/05/19 13:10:59 karl Exp $ Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. @@ -165,33 +165,6 @@ fatal (s1, s2, s3) xexit (1); } -/* Memory allocation and string operations. */ - -/* Like malloc but get fatal error if memory is exhausted. */ -void * -xmalloc (size) - unsigned int size; -{ - extern void *malloc (); - void *result = malloc (size); - if (result == NULL) - fatal (_("virtual memory exhausted"), 0, 0); - return result; -} - -/* Like realloc but get fatal error if memory is exhausted. */ -void * -xrealloc (obj, size) - void *obj; - unsigned int size; -{ - extern void *realloc (); - void *result = realloc (obj, size); - if (result == NULL) - fatal (_("virtual memory exhausted"), 0, 0); - return result; -} - /* Return a newly-allocated string whose contents concatenate those of S1, S2, S3. */ char * @@ -1397,7 +1370,7 @@ For more information about these matters, see the files named COPYING.\n"), } if (!spec || spec == entry->entry_sections_tail) continue; - + /* Subtract one because dir_lines is zero-based, but the `end_line' and `start_line' members are one-based. */ @@ -1442,6 +1415,7 @@ For more information about these matters, see the files named COPYING.\n"), entries_to_add, input_sections, compression_program); xexit (0); + return 0; /* Avoid bogus warnings. */ } /* Divide the text at DATA (of SIZE bytes) into lines. 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; } -- cgit v1.1