Commit 873fbd0b authored by Dan Nicolaescu's avatar Dan Nicolaescu

Convert function definitions to standard C.

* lib-src/update-game-score.c: Convert function definitions to standard C.
* lib-src/sorted-doc.c:
* lib-src/profile.c:
* lib-src/pop.c:
* lib-src/movemail.c:
* lib-src/make-docfile.c:
* lib-src/hexl.c:
* lib-src/fakemail.c:
* lib-src/etags.c:
* lib-src/ebrowse.c:
* lib-src/digest-doc.c:
* lib-src/b2m.c: Likewise.
parent a6ed0e28
2010-07-03 Dan Nicolaescu <dann@ics.uci.edu>
* update-game-score.c: Convert function definitions to standard C.
* sorted-doc.c:
* profile.c:
* pop.c:
* movemail.c:
* make-docfile.c:
* hexl.c:
* fakemail.c:
* etags.c:
* ebrowse.c:
* digest-doc.c:
* b2m.c: Likewise.
2010-07-02 Dan Nicolaescu <dann@ics.uci.edu>
* make-docfile.c (xmalloc, xrealloc, concat, readline, fatal):
......
......@@ -64,7 +64,7 @@ struct linebuffer
char *buffer;
};
extern char *strtok();
extern char *strtok(char *, const char *);
long *xmalloc (unsigned int size);
long *xrealloc (char *ptr, unsigned int size);
......@@ -91,9 +91,7 @@ struct option longopts[] =
extern int optind;
int
main (argc, argv)
int argc;
char **argv;
main (int argc, char **argv)
{
logical labels_saved, printing, header, first, last_was_blank_line;
time_t ltoday;
......@@ -220,8 +218,7 @@ main (argc, argv)
* concatenate those of s1, s2, s3.
*/
char *
concat (s1, s2, s3)
char *s1, *s2, *s3;
concat (char *s1, char *s2, char *s3)
{
int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
char *result = xnew (len1 + len2 + len3 + 1, char);
......@@ -240,9 +237,7 @@ concat (s1, s2, s3)
* which is the length of the line including the newline, if any.
*/
long
readline (linebuffer, stream)
struct linebuffer *linebuffer;
register FILE *stream;
readline (struct linebuffer *linebuffer, register FILE *stream)
{
char *buffer = linebuffer->buffer;
register char *p = linebuffer->buffer;
......@@ -292,8 +287,7 @@ readline (linebuffer, stream)
* Like malloc but get fatal error if memory is exhausted.
*/
long *
xmalloc (size)
unsigned int size;
xmalloc (unsigned int size)
{
long *result = (long *) malloc (size);
if (result == NULL)
......@@ -302,9 +296,7 @@ xmalloc (size)
}
long *
xrealloc (ptr, size)
char *ptr;
unsigned int size;
xrealloc (char *ptr, unsigned int size)
{
long *result = (long *) realloc (ptr, size);
if (result == NULL)
......@@ -313,8 +305,7 @@ xrealloc (ptr, size)
}
void
fatal (message)
char *message;
fatal (char *message)
{
fprintf (stderr, "%s: %s\n", progname, message);
exit (EXIT_FAILURE);
......
......@@ -31,7 +31,7 @@ but in texinfo format and sorted by function/variable name. */
#endif
int
main ()
main (void)
{
register int ch;
register int notfirst = 0;
......
This diff is collapsed.
......@@ -81,7 +81,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <errno.h>
char *getenv (), *getwd ();
char *getenv (const char *), *getwd (char *);
char *(getcwd) ();
#ifdef WINDOWSNT
......@@ -157,7 +157,7 @@ char *server_file = NULL;
/* PID of the Emacs server process. */
int emacs_pid = 0;
void print_help_and_exit () NO_RETURN;
void print_help_and_exit (void) NO_RETURN;
struct option longopts[] =
{
......@@ -184,8 +184,7 @@ struct option longopts[] =
/* Like malloc but get fatal error if memory is exhausted. */
long *
xmalloc (size)
unsigned int size;
xmalloc (unsigned int size)
{
long *result = (long *) malloc (size);
if (result == NULL)
......@@ -517,9 +516,7 @@ message (int is_error, char *message, ...)
The global variable `optind' will say how many arguments we used up. */
void
decode_options (argc, argv)
int argc;
char **argv;
decode_options (int argc, char **argv)
{
alternate_editor = egetenv ("ALTERNATE_EDITOR");
......@@ -645,7 +642,7 @@ an empty string");
void
print_help_and_exit ()
print_help_and_exit (void)
{
/* Spaces and tabs are significant in this message; they're chosen so the
message aligns properly both in a tty and in a Windows message box.
......@@ -732,7 +729,7 @@ main (argc, argv)
#define AUTH_KEY_LENGTH 64
#define SEND_BUFFER_SIZE 4096
extern char *strerror ();
extern char *strerror (int);
/* Buffer to accumulate data to send in TCP connections. */
char send_buffer[SEND_BUFFER_SIZE + 1];
......@@ -743,8 +740,7 @@ HSOCKET emacs_socket = 0;
/* On Windows, the socket library was historically separate from the standard
C library, so errors are handled differently. */
void
sock_err_message (function_name)
char *function_name;
sock_err_message (char *function_name)
{
#ifdef WINDOWSNT
char* msg = NULL;
......@@ -768,9 +764,7 @@ sock_err_message (function_name)
- the buffer is full (but this shouldn't happen)
Otherwise, we just accumulate it. */
void
send_to_emacs (s, data)
HSOCKET s;
char *data;
send_to_emacs (int s, char *data)
{
while (data)
{
......@@ -809,9 +803,7 @@ send_to_emacs (s, data)
Does not change the string. Outputs the result to STREAM. */
void
quote_argument (s, str)
HSOCKET s;
char *str;
quote_argument (int s, char *str)
{
char *copy = (char *) xmalloc (strlen (str) * 2 + 1);
char *p, *q;
......@@ -851,8 +843,7 @@ quote_argument (s, str)
modifying the string in place. Returns STR. */
char *
unquote_argument (str)
char *str;
unquote_argument (char *str)
{
char *p, *q;
......@@ -883,8 +874,7 @@ unquote_argument (str)
int
file_name_absolute_p (filename)
const unsigned char *filename;
file_name_absolute_p (const unsigned char *filename)
{
/* Sanity check, it shouldn't happen. */
if (! filename) return FALSE;
......@@ -938,9 +928,7 @@ initialize_sockets ()
* the Emacs server: host, port, pid and authentication string.
*/
int
get_server_config (server, authentication)
struct sockaddr_in *server;
char *authentication;
get_server_config (struct sockaddr_in *server, char *authentication)
{
char dotted[32];
char *port;
......@@ -1005,7 +993,7 @@ get_server_config (server, authentication)
}
HSOCKET
set_tcp_socket ()
set_tcp_socket (void)
{
HSOCKET s;
struct sockaddr_in server;
......@@ -1119,8 +1107,7 @@ find_tty (char **tty_type, char **tty_name, int noabort)
0 - success: none of the above */
static int
socket_status (socket_name)
char *socket_name;
socket_status (char *socket_name)
{
struct stat statbfr;
......@@ -1223,7 +1210,7 @@ init_signals (void)
HSOCKET
set_local_socket ()
set_local_socket (void)
{
HSOCKET s;
struct sockaddr_un server;
......@@ -1526,9 +1513,7 @@ start_daemon_and_retry_set_socket (void)
}
int
main (argc, argv)
int argc;
char **argv;
main (int argc, char **argv)
{
int i, rl, needlf = 0;
char *cwd, *str;
......
This diff is collapsed.
......@@ -147,8 +147,8 @@ static line_list file_preface;
static stream_list the_streams;
static boolean no_problems = true;
extern FILE *popen ();
extern int fclose (), pclose ();
extern FILE *popen (const char *, const char *);
extern int fclose (FILE *), pclose (FILE *);
#ifdef CURRENT_USER
extern struct passwd *getpwuid ();
......@@ -164,8 +164,7 @@ static struct passwd *my_entry;
/* Print error message. `s1' is printf control string, `s2' is arg for it. */
static void
error (s1, s2)
char *s1, *s2;
error (char *s1, char *s2)
{
printf ("%s: ", my_name);
printf (s1, s2);
......@@ -176,8 +175,7 @@ error (s1, s2)
/* Print error message and exit. */
static void
fatal (s1)
char *s1;
fatal (char *s1)
{
error ("%s", s1);
exit (EXIT_FAILURE);
......@@ -186,8 +184,7 @@ fatal (s1)
/* Like malloc but get fatal error if memory is exhausted. */
static long *
xmalloc (size)
int size;
xmalloc (int size)
{
long *result = (long *) malloc (((unsigned) size));
if (result == ((long *) NULL))
......@@ -196,9 +193,7 @@ xmalloc (size)
}
static long *
xrealloc (ptr, size)
long *ptr;
int size;
xrealloc (long int *ptr, int size)
{
long *result = (long *) realloc (ptr, ((unsigned) size));
if (result == ((long *) NULL))
......@@ -209,8 +204,7 @@ xrealloc (ptr, size)
/* Initialize a linebuffer for use */
void
init_linebuffer (linebuffer)
struct linebuffer *linebuffer;
init_linebuffer (struct linebuffer *linebuffer)
{
linebuffer->size = INITIAL_LINE_SIZE;
linebuffer->buffer = ((char *) xmalloc (INITIAL_LINE_SIZE));
......@@ -220,9 +214,7 @@ init_linebuffer (linebuffer)
Return the length of the line. */
long
readline (linebuffer, stream)
struct linebuffer *linebuffer;
FILE *stream;
readline (struct linebuffer *linebuffer, FILE *stream)
{
char *buffer = linebuffer->buffer;
char *p = linebuffer->buffer;
......@@ -257,9 +249,7 @@ readline (linebuffer, stream)
If there is no keyword, return NULL and don't alter *REST. */
char *
get_keyword (field, rest)
register char *field;
char **rest;
get_keyword (register char *field, char **rest)
{
static char keyword[KEYWORD_SIZE];
register char *ptr;
......@@ -284,8 +274,7 @@ get_keyword (field, rest)
/* Nonzero if the string FIELD starts with a colon-terminated keyword. */
boolean
has_keyword (field)
char *field;
has_keyword (char *field)
{
char *ignored;
return (get_keyword (field, &ignored) != ((char *) NULL));
......@@ -302,9 +291,7 @@ has_keyword (field)
the caller has to make it big enough. */
char *
add_field (the_list, field, where)
line_list the_list;
register char *field, *where;
add_field (line_list the_list, register char *field, register char *where)
{
register char c;
while (true)
......@@ -360,7 +347,7 @@ add_field (the_list, field, where)
}
line_list
make_file_preface ()
make_file_preface (void)
{
char *the_string, *temp;
long idiotic_interface;
......@@ -404,9 +391,7 @@ make_file_preface ()
}
void
write_line_list (the_list, the_stream)
register line_list the_list;
FILE *the_stream;
write_line_list (register line_list the_list, FILE *the_stream)
{
for ( ;
the_list != ((line_list) NULL) ;
......@@ -419,7 +404,7 @@ write_line_list (the_list, the_stream)
}
int
close_the_streams ()
close_the_streams (void)
{
register stream_list rem;
for (rem = the_streams;
......@@ -432,9 +417,7 @@ close_the_streams ()
}
void
add_a_stream (the_stream, closing_action)
FILE *the_stream;
int (*closing_action)();
add_a_stream (FILE *the_stream, int (*closing_action) (/* ??? */))
{
stream_list old = the_streams;
the_streams = new_stream ();
......@@ -445,8 +428,7 @@ add_a_stream (the_stream, closing_action)
}
int
my_fclose (the_file)
FILE *the_file;
my_fclose (FILE *the_file)
{
putc ('\n', the_file);
fflush (the_file);
......@@ -454,8 +436,7 @@ my_fclose (the_file)
}
boolean
open_a_file (name)
char *name;
open_a_file (char *name)
{
FILE *the_stream = fopen (name, "a");
if (the_stream != ((FILE *) NULL))
......@@ -470,8 +451,7 @@ open_a_file (name)
}
void
put_string (s)
char *s;
put_string (char *s)
{
register stream_list rem;
for (rem = the_streams;
......@@ -482,8 +462,7 @@ put_string (s)
}
void
put_line (string)
char *string;
put_line (char *string)
{
register stream_list rem;
for (rem = the_streams;
......@@ -543,9 +522,7 @@ put_line (string)
Call open_a_file for each file. */
void
setup_files (the_list, field)
register line_list the_list;
register char *field;
setup_files (register line_list the_list, register char *field)
{
register char *start;
register char c;
......@@ -581,8 +558,7 @@ setup_files (the_list, field)
The result says how big to make the buffer to pass to parse_header. */
int
args_size (the_header)
header the_header;
args_size (header the_header)
{
register header old = the_header;
register line_list rem;
......@@ -613,9 +589,7 @@ args_size (the_header)
Also, if the header has any FCC fields, call setup_files for each one. */
void
parse_header (the_header, where)
header the_header;
register char *where;
parse_header (header the_header, register char *where)
{
register header old = the_header;
do
......@@ -647,7 +621,7 @@ parse_header (the_header, where)
Continuation lines are grouped in the headers they continue. */
header
read_header ()
read_header (void)
{
register header the_header = ((header) NULL);
register line_list *next_line = ((line_list *) NULL);
......@@ -701,8 +675,7 @@ read_header ()
}
void
write_header (the_header)
header the_header;
write_header (header the_header)
{
register header old = the_header;
do
......@@ -719,9 +692,7 @@ write_header (the_header)
}
int
main (argc, argv)
int argc;
char **argv;
main (int argc, char **argv)
{
char *command_line;
header the_header;
......@@ -731,7 +702,7 @@ main (argc, argv)
register int size;
FILE *the_pipe;
extern char *getenv ();
extern char *getenv (const char *);
mail_program_name = getenv ("FAKEMAILER");
if (!(mail_program_name && *mail_program_name))
......
......@@ -49,12 +49,10 @@ int base = DEFAULT_BASE, un_flag = FALSE, iso_flag = FALSE, endian = 1;
int group_by = DEFAULT_GROUPING;
char *progname;
void usage();
void usage(void);
int
main (argc, argv)
int argc;
char *argv[];
main (int argc, char **argv)
{
register long address;
char string[18];
......@@ -278,7 +276,7 @@ main (argc, argv)
}
void
usage ()
usage (void)
{
fprintf (stderr, "usage: %s [-de] [-iso]\n", progname);
exit (EXIT_FAILURE);
......
......@@ -91,8 +91,7 @@ char *progname;
/* VARARGS1 */
void
error (s1, s2)
char *s1, *s2;
error (char *s1, char *s2)
{
fprintf (stderr, "%s: ", progname);
fprintf (stderr, s1, s2);
......@@ -103,8 +102,7 @@ error (s1, s2)
/* VARARGS1 */
void
fatal (s1, s2)
char *s1, *s2;
fatal (char *s1, char *s2)
{
error (s1, s2);
exit (EXIT_FAILURE);
......@@ -113,8 +111,7 @@ fatal (s1, s2)
/* Like malloc but get fatal error if memory is exhausted. */
void *
xmalloc (size)
unsigned int size;
xmalloc (unsigned int size)
{
void *result = (void *) malloc (size);
if (result == NULL)
......@@ -123,9 +120,7 @@ xmalloc (size)
}
int
main (argc, argv)
int argc;
char **argv;
main (int argc, char **argv)
{
int i;
int err_count = 0;
......@@ -187,8 +182,7 @@ main (argc, argv)
/* Add a source file name boundary marker in the output file. */
void
put_filename (filename)
char *filename;
put_filename (char *filename)
{
char *tmp;
......@@ -207,8 +201,7 @@ put_filename (filename)
/* Return 1 if file is not found, 0 if it is found. */
int
scan_file (filename)
char *filename;
scan_file (char *filename)
{
int len = strlen (filename);
......@@ -251,9 +244,7 @@ struct rcsoc_state
spaces are output first. */
static INLINE void
put_char (ch, state)
int ch;
struct rcsoc_state *state;
put_char (int ch, struct rcsoc_state *state)
{
int out_ch;
do
......@@ -286,9 +277,7 @@ put_char (ch, state)
keyword, but were in fact not. */
static void
scan_keyword_or_put_char (ch, state)
int ch;
struct rcsoc_state *state;
scan_keyword_or_put_char (int ch, struct rcsoc_state *state)
{
if (state->keyword
&& *state->cur_keyword_ptr == ch
......@@ -359,11 +348,7 @@ scan_keyword_or_put_char (ch, state)
true if any were encountered. */
int
read_c_string_or_comment (infile, printflag, comment, saw_usage)
FILE *infile;
int printflag;
int *saw_usage;
int comment;
read_c_string_or_comment (FILE *infile, int printflag, int comment, int *saw_usage)
{
register int c;
struct rcsoc_state state;
......@@ -451,10 +436,7 @@ read_c_string_or_comment (infile, printflag, comment, saw_usage)
MINARGS and MAXARGS are the minimum and maximum number of arguments. */
void
write_c_args (out, func, buf, minargs, maxargs)
FILE *out;
char *func, *buf;
int minargs, maxargs;
write_c_args (FILE *out, char *func, char *buf, int minargs, int maxargs)
{
register char *p;
int in_ident = 0;
......@@ -538,8 +520,7 @@ write_c_args (out, func, buf, minargs, maxargs)
Accepts any word starting DEF... so it finds DEFSIMPLE and DEFPRED. */
int
scan_c_file (filename, mode)
char *filename, *mode;
scan_c_file (char *filename, char *mode)
{
FILE *infile;
register int c;
......@@ -815,8 +796,7 @@ scan_c_file (filename, mode)
*/
void
skip_white (infile)
FILE *infile;
skip_white (FILE *infile)
{
char c = ' ';
while (c == ' ' || c == '\t' || c == '\n' || c == '\r')
......@@ -825,9 +805,7 @@ skip_white (infile)
}
void
read_lisp_symbol (infile, buffer)
FILE *infile;
char *buffer;
read_lisp_symbol (FILE *infile, char *buffer)
{
char c;
char *fillp = buffer;
......@@ -855,8 +833,7 @@ read_lisp_symbol (infile, buffer)
}
int
scan_lisp_file (filename, mode)
char *filename, *mode;
scan_lisp_file (char *filename, char *mode)
{
FILE *infile;
register int c;
......
......@@ -140,7 +140,7 @@ static char *mail_spool_name ();
#endif
#endif
char *strerror ();
char *strerror (int);
#ifdef HAVE_INDEX
extern char *index (const char *, int);
#endif
......@@ -148,25 +148,23 @@ extern char *index (const char *, int);
extern char *rindex (const char *, int);
#endif