summaryrefslogtreecommitdiffstats
path: root/contrib/texinfo/info/filesys.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/texinfo/info/filesys.c')
-rw-r--r--contrib/texinfo/info/filesys.c85
1 files changed, 33 insertions, 52 deletions
diff --git a/contrib/texinfo/info/filesys.c b/contrib/texinfo/info/filesys.c
index 83618f1..8134480 100644
--- a/contrib/texinfo/info/filesys.c
+++ b/contrib/texinfo/info/filesys.c
@@ -1,7 +1,7 @@
/* filesys.c -- filesystem specific functions.
- $Id: filesys.c,v 1.3 2003/01/31 19:18:11 karl Exp $
+ $Id: filesys.c,v 1.6 2004/07/30 17:17:40 karl Exp $
- Copyright (C) 1993, 1997, 1998, 2000, 2002, 2003 Free Software
+ Copyright (C) 1993, 1997, 1998, 2000, 2002, 2003, 2004 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
@@ -26,9 +26,12 @@
#include "filesys.h"
/* Local to this file. */
-static char *info_file_in_path (), *lookup_info_filename ();
-static char *info_absolute_file ();
-static void remember_info_filename (), maybe_initialize_infopath ();
+static char *info_file_in_path (char *filename, char *path);
+static char *lookup_info_filename (char *filename);
+static char *info_absolute_file (char *fname);
+
+static void remember_info_filename (char *filename, char *expansion);
+static void maybe_initialize_infopath (void);
typedef struct
{
@@ -77,8 +80,7 @@ static char *local_temp_filename = (char *)NULL;
static int local_temp_filename_size = 0;
char *
-info_find_fullpath (partial)
- char *partial;
+info_find_fullpath (char *partial)
{
int initial_character;
char *temp;
@@ -141,7 +143,7 @@ info_find_fullpath (partial)
if (temp)
{
remember_info_filename (partial, temp);
- if (strlen (temp) > local_temp_filename_size)
+ if (strlen (temp) > (unsigned int) local_temp_filename_size)
local_temp_filename = (char *) xrealloc
(local_temp_filename,
(local_temp_filename_size = (50 + strlen (temp))));
@@ -157,8 +159,7 @@ info_find_fullpath (partial)
one that is a regular file, return it as a new string. Otherwise, return
a NULL pointer. */
static char *
-info_file_in_path (filename, path)
- char *filename, *path;
+info_file_in_path (char *filename, char *path)
{
struct stat finfo;
char *temp_dirname;
@@ -255,8 +256,7 @@ info_file_in_path (filename, path)
return a NULL pointer. We do it by taking the file name apart
into its directory and basename parts, and calling info_file_in_path.*/
static char *
-info_absolute_file (fname)
- char *fname;
+info_absolute_file (char *fname)
{
char *containing_dir = xstrdup (fname);
char *base = filename_non_directory (containing_dir);
@@ -273,23 +273,21 @@ info_absolute_file (fname)
are no more. Advance IDX to the character after the colon. */
char *
-extract_colon_unit (string, idx)
- char *string;
- int *idx;
+extract_colon_unit (char *string, int *idx)
{
- int i = *idx;
- int start = *idx;
+ unsigned int i = (unsigned int) *idx;
+ unsigned int start = i;
if (!string || i >= strlen (string))
return NULL;
+ if (!string[i]) /* end of string */
+ return NULL;
+
/* Advance to next PATH_SEP. */
while (string[i] && string[i] != PATH_SEP[0])
i++;
- if (!string[i] && i == start) /* end of string, and didn't advance */
- return NULL;
-
{
char *value = xmalloc ((i - start) + 1);
strncpy (value, &string[start], (i - start));
@@ -316,8 +314,7 @@ static int names_and_files_slots = 0;
/* Find the result for having already called info_find_fullpath () with
FILENAME. */
static char *
-lookup_info_filename (filename)
- char *filename;
+lookup_info_filename (char *filename)
{
if (filename && names_and_files)
{
@@ -333,8 +330,7 @@ lookup_info_filename (filename)
/* Add a filename and its expansion to our list. */
static void
-remember_info_filename (filename, expansion)
- char *filename, *expansion;
+remember_info_filename (char *filename, char *expansion)
{
FILENAME_LIST *new;
@@ -358,7 +354,7 @@ remember_info_filename (filename, expansion)
}
static void
-maybe_initialize_infopath ()
+maybe_initialize_infopath (void)
{
if (!infopath_size)
{
@@ -372,9 +368,7 @@ maybe_initialize_infopath ()
/* Add PATH to the list of paths found in INFOPATH. 2nd argument says
whether to put PATH at the front or end of INFOPATH. */
void
-info_add_path (path, where)
- char *path;
- int where;
+info_add_path (char *path, int where)
{
int len;
@@ -408,7 +402,7 @@ info_add_path (path, where)
/* Make INFOPATH have absolutely nothing in it. */
void
-zap_infopath ()
+zap_infopath (void)
{
if (infopath)
free (infopath);
@@ -433,9 +427,7 @@ zap_infopath ()
FIXME: is it a good idea to show the EOL type on the modeline? */
long
-convert_eols (text, textlen)
- char *text;
- long textlen;
+convert_eols (char *text, long int textlen)
{
register char *s = text;
register char *d = text;
@@ -459,11 +451,8 @@ convert_eols (text, textlen)
If the file turns out to be compressed, set IS_COMPRESSED to non-zero.
If the file cannot be read, return a NULL pointer. */
char *
-filesys_read_info_file (pathname, filesize, finfo, is_compressed)
- char *pathname;
- long *filesize;
- struct stat *finfo;
- int *is_compressed;
+filesys_read_info_file (char *pathname, long int *filesize,
+ struct stat *finfo, int *is_compressed)
{
long st_size;
@@ -472,7 +461,7 @@ filesys_read_info_file (pathname, filesize, finfo, is_compressed)
if (compressed_filename_p (pathname))
{
*is_compressed = 1;
- return (filesys_read_compressed (pathname, filesize, finfo));
+ return (filesys_read_compressed (pathname, filesize));
}
else
{
@@ -524,10 +513,7 @@ filesys_read_info_file (pathname, filesize, finfo, is_compressed)
#define FILESYS_PIPE_BUFFER_SIZE (16 * BASIC_PIPE_BUFFER)
char *
-filesys_read_compressed (pathname, filesize, finfo)
- char *pathname;
- long *filesize;
- struct stat *finfo;
+filesys_read_compressed (char *pathname, long int *filesize)
{
FILE *stream;
char *command, *decompressor;
@@ -553,7 +539,7 @@ filesys_read_compressed (pathname, filesize, finfo)
temp = (char *)xmalloc (5 + strlen (command));
sprintf (temp, "%s...", command);
- message_in_echo_area ("%s", temp);
+ message_in_echo_area ("%s", temp, NULL);
free (temp);
}
#endif /* !BUILDING_LIBRARY */
@@ -615,8 +601,7 @@ filesys_read_compressed (pathname, filesize, finfo)
/* Return non-zero if FILENAME belongs to a compressed file. */
int
-compressed_filename_p (filename)
- char *filename;
+compressed_filename_p (char *filename)
{
char *decompressor;
@@ -632,8 +617,7 @@ compressed_filename_p (filename)
/* Return the command string that would be used to decompress FILENAME. */
char *
-filesys_decompressor_for_file (filename)
- char *filename;
+filesys_decompressor_for_file (char *filename)
{
register int i;
char *extension = (char *)NULL;
@@ -676,9 +660,7 @@ static char *errmsg_buf = (char *)NULL;
static int errmsg_buf_size = 0;
char *
-filesys_error_string (filename, error_num)
- char *filename;
- int error_num;
+filesys_error_string (char *filename, int error_num)
{
int len;
char *result;
@@ -701,8 +683,7 @@ filesys_error_string (filename, error_num)
in combination. */
int
-is_dir_name (filename)
- char *filename;
+is_dir_name (char *filename)
{
unsigned i;
OpenPOWER on IntegriCloud