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.
This commit is contained in:
Dan Nicolaescu 2010-07-02 17:50:23 -07:00
parent a6ed0e2898
commit 873fbd0b84
14 changed files with 347 additions and 734 deletions

View file

@ -1,3 +1,18 @@
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):

View file

@ -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);

View file

@ -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;

View file

@ -534,7 +534,7 @@ void parse_qualified_param_ident_or_type (char **);
int globals (int);
void yyerror (char *, char *);
void usage (int) NO_RETURN;
void version () NO_RETURN;
void version (void) NO_RETURN;
@ -546,8 +546,7 @@ void version () NO_RETURN;
name and line number. */
void
yyerror (format, s)
char *format, *s;
yyerror (char *format, char *s)
{
fprintf (stderr, "%s:%d: ", filename, yyline);
fprintf (stderr, format, s);
@ -559,8 +558,7 @@ yyerror (format, s)
available. */
void *
xmalloc (nbytes)
int nbytes;
xmalloc (int nbytes)
{
void *p = malloc (nbytes);
if (p == NULL)
@ -575,9 +573,7 @@ xmalloc (nbytes)
/* Like realloc but print an error and exit if out of memory. */
void *
xrealloc (p, sz)
void *p;
int sz;
xrealloc (void *p, int sz)
{
p = realloc (p, sz);
if (p == NULL)
@ -593,8 +589,7 @@ xrealloc (p, sz)
available.. If S is null, return null. */
char *
xstrdup (s)
char *s;
xstrdup (char *s)
{
if (s)
s = strcpy (xmalloc (strlen (s) + 1), s);
@ -611,7 +606,7 @@ xstrdup (s)
special symbol for globals (`*Globals*'). */
void
init_sym ()
init_sym (void)
{
global_symbols = add_sym (GLOBALS_NAME, NULL);
}
@ -625,9 +620,7 @@ init_sym ()
create a new symbol and set it to default values. */
struct sym *
add_sym (name, nested_in_class)
char *name;
struct sym *nested_in_class;
add_sym (char *name, struct sym *nested_in_class)
{
struct sym *sym;
unsigned h;
@ -668,8 +661,7 @@ add_sym (name, nested_in_class)
/* Add links between superclass SUPER and subclass SUB. */
void
add_link (super, sub)
struct sym *super, *sub;
add_link (struct sym *super, struct sym *sub)
{
struct link *lnk, *lnk2, *p, *prev;
@ -709,11 +701,7 @@ add_link (super, sub)
found or null if not found. */
struct member *
find_member (cls, name, var, sc, hash)
struct sym *cls;
char *name;
int var, sc;
unsigned hash;
find_member (struct sym *cls, char *name, int var, int sc, unsigned int hash)
{
struct member **list;
struct member *p;
@ -763,16 +751,7 @@ find_member (cls, name, var, sc, hash)
F_* defines). */
void
add_member_decl (cls, name, regexp, pos, hash, var, sc, vis, flags)
struct sym *cls;
char *name;
char *regexp;
int pos;
unsigned hash;
int var;
int sc;
int vis;
int flags;
add_member_decl (struct sym *cls, char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int vis, int flags)
{
struct member *m;
@ -820,15 +799,7 @@ add_member_decl (cls, name, regexp, pos, hash, var, sc, vis, flags)
F_* defines). */
void
add_member_defn (cls, name, regexp, pos, hash, var, sc, flags)
struct sym *cls;
char *name;
char *regexp;
int pos;
unsigned hash;
int var;
int sc;
int flags;
add_member_defn (struct sym *cls, char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags)
{
struct member *m;
@ -870,9 +841,7 @@ add_member_defn (cls, name, regexp, pos, hash, var, sc, flags)
if it is non-null. POS is the position in the file. */
void
add_define (name, regexp, pos)
char *name, *regexp;
int pos;
add_define (char *name, char *regexp, int pos)
{
add_global_defn (name, regexp, pos, 0, 1, SC_FRIEND, F_DEFINE);
add_global_decl (name, regexp, pos, 0, 1, SC_FRIEND, F_DEFINE);
@ -890,13 +859,7 @@ add_define (name, regexp, pos)
F_* defines). */
void
add_global_defn (name, regexp, pos, hash, var, sc, flags)
char *name, *regexp;
int pos;
unsigned hash;
int var;
int sc;
int flags;
add_global_defn (char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags)
{
int i;
struct sym *sym;
@ -927,13 +890,7 @@ add_global_defn (name, regexp, pos, hash, var, sc, flags)
F_* defines). */
void
add_global_decl (name, regexp, pos, hash, var, sc, flags)
char *name, *regexp;
int pos;
unsigned hash;
int var;
int sc;
int flags;
add_global_decl (char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags)
{
/* Add declaration only if not already declared. Header files must
be processed before source files for this to have the right effect.
@ -972,12 +929,7 @@ add_global_decl (name, regexp, pos, hash, var, sc, flags)
Value is a pointer to the member's structure. */
struct member *
add_member (cls, name, var, sc, hash)
struct sym *cls;
char *name;
int var;
int sc;
unsigned hash;
add_member (struct sym *cls, char *name, int var, int sc, unsigned int hash)
{
struct member *m = (struct member *) xmalloc (sizeof *m + strlen (name));
struct member **list;
@ -1048,8 +1000,7 @@ add_member (cls, name, var, sc, hash)
in base classes. */
void
mark_virtual (r)
struct sym *r;
mark_virtual (struct sym *r)
{
struct link *p;
struct member *m, *m2;
@ -1073,7 +1024,7 @@ mark_virtual (r)
are virtual because of a virtual declaration in a base class. */
void
mark_inherited_virtual ()
mark_inherited_virtual (void)
{
struct sym *r;
int i;
@ -1088,9 +1039,7 @@ mark_inherited_virtual ()
/* Create and return a symbol for a namespace with name NAME. */
struct sym *
make_namespace (name, context)
char *name;
struct sym *context;
make_namespace (char *name, struct sym *context)
{
struct sym *s = (struct sym *) xmalloc (sizeof *s + strlen (name));
bzero (s, sizeof *s);
@ -1105,9 +1054,7 @@ make_namespace (name, context)
/* Find the symbol for namespace NAME. If not found, retrun NULL */
struct sym *
check_namespace (name, context)
char *name;
struct sym *context;
check_namespace (char *name, struct sym *context)
{
struct sym *p = NULL;
@ -1124,9 +1071,7 @@ check_namespace (name, context)
for NAME to all_namespaces. */
struct sym *
find_namespace (name, context)
char *name;
struct sym *context;
find_namespace (char *name, struct sym *context)
{
struct sym *p = check_namespace (name, context);
@ -1140,8 +1085,7 @@ find_namespace (name, context)
/* Find namespace alias with name NAME. If not found return NULL. */
struct link *
check_namespace_alias (name)
char *name;
check_namespace_alias (char *name)
{
struct link *p = NULL;
struct alias *al;
@ -1165,9 +1109,7 @@ check_namespace_alias (name)
/* Register the name NEW_NAME as an alias for namespace list OLD_NAME. */
void
register_namespace_alias (new_name, old_name)
char *new_name;
struct link *old_name;
register_namespace_alias (char *new_name, struct link *old_name)
{
unsigned h;
char *s;
@ -1195,8 +1137,7 @@ register_namespace_alias (new_name, old_name)
/* Enter namespace with name NAME. */
void
enter_namespace (name)
char *name;
enter_namespace (char *name)
{
struct sym *p = find_namespace (name, current_namespace);
@ -1217,7 +1158,7 @@ enter_namespace (name)
/* Leave the current namespace. */
void
leave_namespace ()
leave_namespace (void)
{
assert (namespace_sp > 0);
current_namespace = namespace_stack[--namespace_sp];
@ -1259,8 +1200,7 @@ int scope_buffer_len;
/* Make sure scope_buffer has enough room to add LEN chars to it. */
void
ensure_scope_buffer_room (len)
int len;
ensure_scope_buffer_room (int len)
{
if (scope_buffer_len + len >= scope_buffer_size)
{
@ -1276,8 +1216,7 @@ ensure_scope_buffer_room (len)
scope name constructed. */
char *
sym_scope_1 (p)
struct sym *p;
sym_scope_1 (struct sym *p)
{
int len;
@ -1311,8 +1250,7 @@ sym_scope_1 (p)
as it would appear in a C*+ source file. */
char *
sym_scope (p)
struct sym *p;
sym_scope (struct sym *p)
{
if (!scope_buffer)
{
@ -1334,9 +1272,7 @@ sym_scope (p)
list. */
int
dump_members (fp, m)
FILE *fp;
struct member *m;
dump_members (FILE *fp, struct member *m)
{
int n;
@ -1369,9 +1305,7 @@ dump_members (fp, m)
/* Dump class ROOT to stream FP. */
void
dump_sym (fp, root)
FILE *fp;
struct sym *root;
dump_sym (FILE *fp, struct sym *root)
{
fputs (CLASS_STRUCT, fp);
PUTSTR (root->name, fp);
@ -1397,9 +1331,7 @@ dump_sym (fp, root)
number of classes written. */
int
dump_tree (fp, root)
FILE *fp;
struct sym *root;
dump_tree (FILE *fp, struct sym *root)
{
struct link *lk;
unsigned n = 0;
@ -1446,8 +1378,7 @@ dump_tree (fp, root)
/* Dump the entire class tree to file FP. */
void
dump_roots (fp)
FILE *fp;
dump_roots (FILE *fp)
{
int i, n = 0;
struct sym *r;
@ -1521,7 +1452,7 @@ do { \
input buffer not consumed. */
int
process_pp_line ()
process_pp_line (void)
{
int in_comment = 0, in_string = 0;
int c;
@ -1592,7 +1523,7 @@ process_pp_line ()
/* Value is the next token from the input buffer. */
int
yylex ()
yylex (void)
{
int c;
char end_char;
@ -2009,7 +1940,7 @@ static char *matching_regexp_buffer, *matching_regexp_end_buf;
shorter than min_regexp. */
char *
matching_regexp ()
matching_regexp (void)
{
char *p;
char *s;
@ -2060,8 +1991,7 @@ matching_regexp ()
/* Return a printable representation of token T. */
char *
token_string (t)
int t;
token_string (int t)
{
static char b[3];
@ -2178,7 +2108,7 @@ token_string (t)
/* Reinitialize the scanner for a new input file. */
void
re_init_scanner ()
re_init_scanner (void)
{
in = inbuffer;
yyline = 1;
@ -2196,9 +2126,7 @@ re_init_scanner ()
table. */
void
insert_keyword (name, tk)
char *name;
int tk;
insert_keyword (char *name, int tk)
{
char *s;
unsigned h = 0;
@ -2219,7 +2147,7 @@ insert_keyword (name, tk)
character class vectors and fills the keyword hash table. */
void
init_scanner ()
init_scanner (void)
{
int i;
@ -2363,8 +2291,7 @@ init_scanner ()
the current lookahead token after skipping. */
int
skip_to (token)
int token;
skip_to (int token)
{
while (!LOOKING_AT2 (YYEOF, token))
MATCH ();
@ -2375,7 +2302,7 @@ skip_to (token)
angle brackets, curly brackets) matching the current lookahead. */
void
skip_matching ()
skip_matching (void)
{
int open, close, n;
@ -2418,7 +2345,7 @@ skip_matching ()
}
void
skip_initializer ()
skip_initializer (void)
{
for (;;)
{
@ -2445,7 +2372,7 @@ skip_initializer ()
/* Build qualified namespace alias (A::B::c) and return it. */
struct link *
match_qualified_namespace_alias ()
match_qualified_namespace_alias (void)
{
struct link *head = NULL;
struct link *cur = NULL;
@ -2482,7 +2409,7 @@ match_qualified_namespace_alias ()
/* Re-initialize the parser by resetting the lookahead token. */
void
re_init_parser ()
re_init_parser (void)
{
tk = -1;
}
@ -2495,8 +2422,7 @@ re_init_parser ()
distinguish between overloaded functions. */
unsigned
parm_list (flags)
int *flags;
parm_list (int *flags)
{
unsigned hash = 0;
int type_seen = 0;
@ -2609,7 +2535,7 @@ parm_list (flags)
/* Print position info to stdout. */
void
print_info ()
print_info (void)
{
if (info_position >= 0 && BUFFER_POS () <= info_position)
if (info_cls)
@ -2624,9 +2550,7 @@ print_info ()
public). */
void
member (cls, vis)
struct sym *cls;
int vis;
member (struct sym *cls, int vis)
{
char *id = NULL;
int sc = SC_MEMBER;
@ -2835,9 +2759,7 @@ member (cls, vis)
union, class). */
void
class_body (cls, tag)
struct sym *cls;
int tag;
class_body (struct sym *cls, int tag)
{
int vis = tag == CLASS ? PRIVATE : PUBLIC;
int temp;
@ -2898,7 +2820,7 @@ class_body (cls, tag)
symbol for that class. */
struct sym *
parse_classname ()
parse_classname (void)
{
struct sym *last_class = NULL;
@ -2928,8 +2850,7 @@ parse_classname ()
a static buffer holding the constructed operator name string. */
char *
operator_name (sc)
int *sc;
operator_name (int *sc)
{
static int id_size = 0;
static char *id = NULL;
@ -3019,8 +2940,7 @@ operator_name (sc)
symbol structure for the ident. */
struct sym *
parse_qualified_ident_or_type (last_id)
char **last_id;
parse_qualified_ident_or_type (char **last_id)
{
struct sym *cls = NULL;
char *id = NULL;
@ -3085,8 +3005,7 @@ parse_qualified_ident_or_type (last_id)
symbol structure for the ident. */
void
parse_qualified_param_ident_or_type (last_id)
char **last_id;
parse_qualified_param_ident_or_type (char **last_id)
{
struct sym *cls = NULL;
static char *id = NULL;
@ -3128,11 +3047,7 @@ parse_qualified_param_ident_or_type (last_id)
Current lookahead is the class name. */
void
class_definition (containing, tag, flags, nested)
struct sym *containing;
int tag;
int flags;
int nested;
class_definition (struct sym *containing, int tag, int flags, int nested)
{
struct sym *current;
struct sym *base_class;
@ -3229,10 +3144,7 @@ class_definition (containing, tag, flags, nested)
information about the member (see the F_* defines). */
void
add_declarator (cls, id, flags, sc)
struct sym **cls;
char **id;
int flags, sc;
add_declarator (struct sym **cls, char **id, int flags, int sc)
{
if (LOOKING_AT2 (';', ','))
{
@ -3275,8 +3187,7 @@ add_declarator (cls, id, flags, sc)
/* Parse a declaration. */
void
declaration (flags)
int flags;
declaration (int flags)
{
char *id = NULL;
struct sym *cls = NULL;
@ -3430,8 +3341,7 @@ declaration (flags)
otherwise. */
int
globals (start_flags)
int start_flags;
globals (int start_flags)
{
int anonymous;
int class_tk;
@ -3549,7 +3459,7 @@ globals (start_flags)
/* Parse the current input file. */
void
yyparse ()
yyparse (void)
{
while (globals (0) == 0)
MATCH_IF ('}');
@ -3565,8 +3475,7 @@ yyparse ()
input files. */
void
add_search_path (path_list)
char *path_list;
add_search_path (char *path_list)
{
while (*path_list)
{
@ -3601,8 +3510,7 @@ add_search_path (path_list)
unchanged file name. */
FILE *
open_file (file)
char *file;
open_file (char *file)
{
FILE *fp = NULL;
static char *buffer;
@ -3661,8 +3569,7 @@ Usage: ebrowse [options] {files}\n\
"
void
usage (error)
int error;
usage (int error)
{
puts (USAGE);
exit (error ? EXIT_FAILURE : EXIT_SUCCESS);
@ -3677,7 +3584,7 @@ usage (error)
#endif
void
version ()
version (void)
{
/* Makes it easier to update automatically. */
char emacs_copyright[] = "Copyright (C) 2010 Free Software Foundation, Inc.";
@ -3693,8 +3600,7 @@ version ()
table. */
void
process_file (file)
char *file;
process_file (char *file)
{
FILE *fp;
@ -3749,8 +3655,7 @@ process_file (file)
is null when EOF is reached. */
char *
read_line (fp)
FILE *fp;
read_line (FILE *fp)
{
static char *buffer;
static int buffer_size;
@ -3786,9 +3691,7 @@ read_line (fp)
/* Main entry point. */
int
main (argc, argv)
int argc;
char **argv;
main (int argc, char **argv)
{
int i;
int any_inputfiles = 0;

View file

@ -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;

View file

@ -848,7 +848,7 @@ static language lang_names [] =
static void
print_language_names ()
print_language_names (void)
{
language *lang;
char **name, **ext;
@ -887,7 +887,7 @@ etags --help --lang=ada.");
# define VERSION "17.38.1.4"
#endif
static void
print_version ()
print_version (void)
{
/* Makes it easier to update automatically. */
char emacs_copyright[] = "Copyright (C) 2010 Free Software Foundation, Inc.";
@ -904,8 +904,7 @@ print_version ()
#endif
static void
print_help (argbuffer)
argument *argbuffer;
print_help (argument *argbuffer)
{
bool help_for_lang = FALSE;
@ -1082,9 +1081,7 @@ Relative ones are stored relative to the output file's directory.\n");
int
main (argc, argv)
int argc;
char *argv[];
main (int argc, char **argv)
{
int i;
unsigned int nincluded_files;
@ -1409,9 +1406,7 @@ main (argc, argv)
* Idea by Vladimir Alexiev <vladimir@cs.ualberta.ca> (1998)
*/
static compressor *
get_compressor_from_suffix (file, extptr)
char *file;
char **extptr;
get_compressor_from_suffix (char *file, char **extptr)
{
compressor *compr;
char *slash, *suffix;
@ -1447,8 +1442,7 @@ get_compressor_from_suffix (file, extptr)
* Return a language given the name.
*/
static language *
get_language_from_langname (name)
const char *name;
get_language_from_langname (const char *name)
{
language *lang;
@ -1470,8 +1464,7 @@ get_language_from_langname (name)
* Return a language given the interpreter name.
*/
static language *
get_language_from_interpreter (interpreter)
char *interpreter;
get_language_from_interpreter (char *interpreter)
{
language *lang;
char **iname;
@ -1493,9 +1486,7 @@ get_language_from_interpreter (interpreter)
* Return a language given the file name.
*/
static language *
get_language_from_filename (file, case_sensitive)
char *file;
bool case_sensitive;
get_language_from_filename (char *file, int case_sensitive)
{
language *lang;
char **name, **ext, *suffix;
@ -1529,9 +1520,7 @@ get_language_from_filename (file, case_sensitive)
* This routine is called on each file argument.
*/
static void
process_file_name (file, lang)
char *file;
language *lang;
process_file_name (char *file, language *lang)
{
struct stat stat_buf;
FILE *inf;
@ -1653,10 +1642,7 @@ process_file_name (file, lang)
}
static void
process_file (fh, fn, lang)
FILE *fh;
char *fn;
language *lang;
process_file (FILE *fh, char *fn, language *lang)
{
static const fdesc emptyfdesc;
fdesc *fdp;
@ -1733,7 +1719,7 @@ process_file (fh, fn, lang)
* of a char is TRUE if it is the string "white", else FALSE.
*/
static void
init ()
init (void)
{
register char *sp;
register int i;
@ -1756,8 +1742,7 @@ init ()
* which finds the function and type definitions.
*/
static void
find_entries (inf)
FILE *inf;
find_entries (FILE *inf)
{
char *cp;
language *lang = curfdp->lang;
@ -1915,14 +1900,14 @@ find_entries (inf)
* etags.el needs to use the same characters that are in NONAM.
*/
static void
make_tag (name, namelen, is_func, linestart, linelen, lno, cno)
char *name; /* tag name, or NULL if unnamed */
int namelen; /* tag length */
bool is_func; /* tag is a function */
char *linestart; /* start of the line where tag is */
int linelen; /* length of the line where tag is */
int lno; /* line number */
long cno; /* character number */
make_tag (char *name, int namelen, int is_func, char *linestart, int linelen, int lno, long int cno)
/* tag name, or NULL if unnamed */
/* tag length */
/* tag is a function */
/* start of the line where tag is */
/* length of the line where tag is */
/* line number */
/* character number */
{
bool named = (name != NULL && namelen > 0);
@ -1958,13 +1943,13 @@ make_tag (name, namelen, is_func, linestart, linelen, lno, cno)
/* Record a tag. */
static void
pfnote (name, is_func, linestart, linelen, lno, cno)
char *name; /* tag name, or NULL if unnamed */
bool is_func; /* tag is a function */
char *linestart; /* start of the line where tag is */
int linelen; /* length of the line where tag is */
int lno; /* line number */
long cno; /* character number */
pfnote (char *name, int is_func, char *linestart, int linelen, int lno, long int cno)
/* tag name, or NULL if unnamed */
/* tag is a function */
/* start of the line where tag is */
/* length of the line where tag is */
/* line number */
/* character number */
{
register node *np;
@ -2018,8 +2003,7 @@ pfnote (name, is_func, linestart, linelen, lno, cno)
* recurse on left children, iterate on right children.
*/
static void
free_tree (np)
register node *np;
free_tree (register node *np)
{
while (np)
{
@ -2037,8 +2021,7 @@ free_tree (np)
* delete a file description
*/
static void
free_fdesc (fdp)
register fdesc *fdp;
free_fdesc (register fdesc *fdp)
{
free (fdp->infname);
free (fdp->infabsname);
@ -2058,8 +2041,7 @@ free_fdesc (fdp)
* maintain state.
*/
static void
add_node (np, cur_node_p)
node *np, **cur_node_p;
add_node (node *np, node **cur_node_p)
{
register int dif;
register node *cur_node = *cur_node_p;
@ -2139,9 +2121,7 @@ add_node (np, cur_node_p)
* given file description (CTAGS case) or free them (ETAGS case).
*/
static void
invalidate_nodes (badfdp, npp)
fdesc *badfdp;
node **npp;
invalidate_nodes (fdesc *badfdp, node **npp)
{
node *np = *npp;
@ -2178,8 +2158,7 @@ static int number_len (long);
/* Length of a non-negative number's decimal representation. */
static int
number_len (num)
long num;
number_len (long int num)
{
int len = 1;
while ((num /= 10) > 0)
@ -2194,8 +2173,7 @@ number_len (num)
* but is still supplied for backward compatibility.
*/
static int
total_size_of_entries (np)
register node *np;
total_size_of_entries (register node *np)
{
register int total = 0;
@ -2215,8 +2193,7 @@ total_size_of_entries (np)
}
static void
put_entries (np)
register node *np;
put_entries (register node *np)
{
register char *sp;
static fdesc *fdp = NULL;
@ -2395,9 +2372,7 @@ inline
#endif
#endif
static unsigned int
hash (str, len)
register const char *str;
register unsigned int len;
hash (register const char *str, register unsigned int len)
{
static unsigned char asso_values[] =
{
@ -2443,9 +2418,7 @@ hash (str, len)
}
static struct C_stab_entry *
in_word_set (str, len)
register const char *str;
register unsigned int len;
in_word_set (register const char *str, register unsigned int len)
{
enum
{
@ -2511,10 +2484,7 @@ in_word_set (str, len)
/*%>*/
static enum sym_type
C_symtype (str, len, c_ext)
char *str;
int len;
int c_ext;
C_symtype (char *str, int len, int c_ext)
{
register struct C_stab_entry *se = in_word_set (str, len);
@ -2658,10 +2628,7 @@ static struct {
&& bracelev == cstack.bracelev[nestlev-1] + 1)
static void
pushclass_above (bracelev, str, len)
int bracelev;
char *str;
int len;
pushclass_above (int bracelev, char *str, int len)
{
int nl;
@ -2680,8 +2647,7 @@ pushclass_above (bracelev, str, len)
}
static void
popclass_above (bracelev)
int bracelev;
popclass_above (int bracelev)
{
int nl;
@ -2695,9 +2661,7 @@ popclass_above (bracelev)
}
static void
write_classname (cn, qualifier)
linebuffer *cn;
char *qualifier;
write_classname (linebuffer *cn, char *qualifier)
{
int i, len;
int qlen = strlen (qualifier);
@ -2752,14 +2716,14 @@ static void make_C_tag (bool);
*/
static bool
consider_token (str, len, c, c_extp, bracelev, parlev, is_func_or_var)
register char *str; /* IN: token pointer */
register int len; /* IN: token length */
register int c; /* IN: first char after the token */
int *c_extp; /* IN, OUT: C extensions mask */
int bracelev; /* IN: brace level */
int parlev; /* IN: parenthesis level */
bool *is_func_or_var; /* OUT: function or variable found */
consider_token (register char *str, register int len, register int c, int *c_extp, int bracelev, int parlev, int *is_func_or_var)
/* IN: token pointer */
/* IN: token length */
/* IN: first char after the token */
/* IN, OUT: C extensions mask */
/* IN: brace level */
/* IN: parenthesis level */
/* OUT: function or variable found */
{
/* When structdef is stagseen, scolonseen, or snone with bracelev > 0,
structtype is the type of the preceding struct-like keyword, and
@ -3093,8 +3057,7 @@ do { \
static void
make_C_tag (isfun)
bool isfun;
make_C_tag (int isfun)
{
/* This function is never called when token.valid is FALSE, but
we must protect against invalid input or internal errors. */
@ -3120,9 +3083,9 @@ make_C_tag (isfun)
* C syntax and adds them to the list.
*/
static void
C_entries (c_ext, inf)
int c_ext; /* extension of C */
FILE *inf; /* input file */
C_entries (int c_ext, FILE *inf)
/* extension of C */
/* input file */
{
register char c; /* latest char read; '\0' for end of line */
register char *lp; /* pointer one beyond the character `c' */
@ -3952,48 +3915,42 @@ C_entries (c_ext, inf)
* of a global flag.
*/
static void
default_C_entries (inf)
FILE *inf;
default_C_entries (FILE *inf)
{
C_entries (cplusplus ? C_PLPL : C_AUTO, inf);
}
/* Always do plain C. */
static void
plain_C_entries (inf)
FILE *inf;
plain_C_entries (FILE *inf)
{
C_entries (0, inf);
}
/* Always do C++. */
static void
Cplusplus_entries (inf)
FILE *inf;
Cplusplus_entries (FILE *inf)
{
C_entries (C_PLPL, inf);
}
/* Always do Java. */
static void
Cjava_entries (inf)
FILE *inf;
Cjava_entries (FILE *inf)
{
C_entries (C_JAVA, inf);
}
/* Always do C*. */
static void
Cstar_entries (inf)
FILE *inf;
Cstar_entries (FILE *inf)
{
C_entries (C_STAR, inf);
}
/* Always do Yacc. */
static void
Yacc_entries (inf)
FILE *inf;
Yacc_entries (FILE *inf)
{
C_entries (YACC, inf);
}
@ -4026,8 +3983,7 @@ Yacc_entries (inf)
* matching on files that have no language defined.
*/
static void
just_read_file (inf)
FILE *inf;
just_read_file (FILE *inf)
{
register char *dummy;
@ -4042,7 +3998,7 @@ static void F_takeprec (void);
static void F_getit (FILE *);
static void
F_takeprec ()
F_takeprec (void)
{
dbp = skip_spaces (dbp);
if (*dbp != '*')
@ -4065,8 +4021,7 @@ F_takeprec ()
}
static void
F_getit (inf)
FILE *inf;
F_getit (FILE *inf)
{
register char *cp;
@ -4090,8 +4045,7 @@ F_getit (inf)
static void
Fortran_functions (inf)
FILE *inf;
Fortran_functions (FILE *inf)
{
LOOP_ON_INPUT_LINES (inf, lb, dbp)
{
@ -4178,9 +4132,7 @@ static void Ada_getit (FILE *, char *);
/* Once we are positioned after an "interesting" keyword, let's get
the real tag value necessary. */
static void
Ada_getit (inf, name_qualifier)
FILE *inf;
char *name_qualifier;
Ada_getit (FILE *inf, char *name_qualifier)
{
register char *cp;
char *name;
@ -4243,8 +4195,7 @@ Ada_getit (inf, name_qualifier)
}
static void
Ada_funcs (inf)
FILE *inf;
Ada_funcs (FILE *inf)
{
bool inquote = FALSE;
bool skip_till_semicolumn = FALSE;
@ -4357,8 +4308,7 @@ Ada_funcs (inf)
* Idea by Bob Weiner, Motorola Inc. (1994)
*/
static void
Asm_labels (inf)
FILE *inf;
Asm_labels (FILE *inf)
{
register char *cp;
@ -4390,8 +4340,7 @@ Asm_labels (inf)
* Ideas by Kai Großjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE> (2001)
*/
static void
Perl_functions (inf)
FILE *inf;
Perl_functions (FILE *inf)
{
char *package = savestr ("main"); /* current package name */
register char *cp;
@ -4473,8 +4422,7 @@ Perl_functions (inf)
* More ideas by seb bacon <seb@jamkit.com> (2002)
*/
static void
Python_functions (inf)
FILE *inf;
Python_functions (FILE *inf)
{
register char *cp;
@ -4504,8 +4452,7 @@ Python_functions (inf)
* Idea by Diez B. Roggisch (2001)
*/
static void
PHP_functions (inf)
FILE *inf;
PHP_functions (FILE *inf)
{
register char *cp, *name;
bool search_identifier = FALSE;
@ -4584,8 +4531,7 @@ PHP_functions (inf)
* Idea by Corny de Souza (1993)
*/
static void
Cobol_paragraphs (inf)
FILE *inf;
Cobol_paragraphs (FILE *inf)
{
register char *bp, *ep;
@ -4613,8 +4559,7 @@ Cobol_paragraphs (inf)
* Ideas by Assar Westerlund <assar@sics.se> (2001)
*/
static void
Makefile_targets (inf)
FILE *inf;
Makefile_targets (FILE *inf)
{
register char *bp;
@ -4649,8 +4594,7 @@ Makefile_targets (inf)
* the tag is skipped.
*/
static void
Pascal_functions (inf)
FILE *inf;
Pascal_functions (FILE *inf)
{
linebuffer tline; /* mostly copied from C_entries */
long save_lcno;
@ -4830,7 +4774,7 @@ Pascal_functions (inf)
static void L_getit (void);
static void
L_getit ()
L_getit (void)
{
if (*dbp == '\'') /* Skip prefix quote */
dbp++;
@ -4846,8 +4790,7 @@ L_getit ()
}
static void
Lisp_functions (inf)
FILE *inf;
Lisp_functions (FILE *inf)
{
LOOP_ON_INPUT_LINES (inf, lb, dbp)
{
@ -4891,8 +4834,7 @@ Lisp_functions (inf)
* "function" and "local function" are tags if they start at column 1.
*/
static void
Lua_functions (inf)
FILE *inf;
Lua_functions (FILE *inf)
{
register char *bp;
@ -4918,8 +4860,7 @@ Lua_functions (inf)
* Masatake Yamato <masata-y@is.aist-nara.ac.jp> (1999)
*/
static void
PS_functions (inf)
FILE *inf;
PS_functions (FILE *inf)
{
register char *bp, *ep;
@ -4949,8 +4890,7 @@ PS_functions (inf)
* Ideas by Eduardo Horvath <eeh@netbsd.org> (2004)
*/
static void
Forth_words (inf)
FILE *inf;
Forth_words (FILE *inf)
{
register char *bp;
@ -4986,8 +4926,7 @@ Forth_words (inf)
* Original code by Ken Haase (1985?)
*/
static void
Scheme_functions (inf)
FILE *inf;
Scheme_functions (FILE *inf)
{
register char *bp;
@ -5038,8 +4977,7 @@ static char TEX_clgrp = '}';
* TeX/LaTeX scanning loop.
*/
static void
TeX_commands (inf)
FILE *inf;
TeX_commands (FILE *inf)
{
char *cp;
linebuffer *key;
@ -5103,8 +5041,7 @@ TeX_commands (inf)
/* Figure out whether TeX's escapechar is '\\' or '!' and set grouping
chars accordingly. */
static void
TEX_mode (inf)
FILE *inf;
TEX_mode (FILE *inf)
{
int c;
@ -5138,9 +5075,7 @@ TEX_mode (inf)
/* Read environment and prepend it to the default string.
Build token table. */
static void
TEX_decode_env (evarname, defenv)
char *evarname;
char *defenv;
TEX_decode_env (char *evarname, char *defenv)
{
register char *env, *p;
int i, len;
@ -5188,8 +5123,7 @@ TEX_decode_env (evarname, defenv)
/* Texinfo support. Dave Love, Mar. 2000. */
static void
Texinfo_nodes (inf)
FILE * inf;
Texinfo_nodes (FILE *inf)
{
char *cp, *start;
LOOP_ON_INPUT_LINES (inf, lb, cp)
@ -5212,8 +5146,7 @@ Texinfo_nodes (inf)
* Francesco Potortì, 2002.
*/
static void
HTML_labels (inf)
FILE * inf;
HTML_labels (FILE *inf)
{
bool getnext = FALSE; /* next text outside of HTML tags is a tag */
bool skiptag = FALSE; /* skip to the end of the current HTML tag */
@ -5338,8 +5271,7 @@ static void prolog_skip_comment (linebuffer *, FILE *);
static int prolog_atom (char *, int);
static void
Prolog_functions (inf)
FILE *inf;
Prolog_functions (FILE *inf)
{
char *cp, *last;
int len;
@ -5375,9 +5307,7 @@ Prolog_functions (inf)
static void
prolog_skip_comment (plb, inf)
linebuffer *plb;
FILE *inf;
prolog_skip_comment (linebuffer *plb, FILE *inf)
{
char *cp;
@ -5403,9 +5333,9 @@ prolog_skip_comment (plb, inf)
* header was found.
*/
static int
prolog_pr (s, last)
char *s;
char *last; /* Name of last clause. */
prolog_pr (char *s, char *last)
/* Name of last clause. */
{
int pos;
int len;
@ -5441,9 +5371,7 @@ prolog_pr (s, last)
* Backslash quotes everything.
*/
static int
prolog_atom (s, pos)
char *s;
int pos;
prolog_atom (char *s, int pos)
{
int origpos;
@ -5503,8 +5431,7 @@ static void erlang_attribute (char *);
static int erlang_atom (char *);
static void
Erlang_functions (inf)
FILE *inf;
Erlang_functions (FILE *inf)
{
char *cp, *last;
int len;
@ -5563,9 +5490,9 @@ Erlang_functions (inf)
* was found.
*/
static int
erlang_func (s, last)
char *s;
char *last; /* Name of last clause. */
erlang_func (char *s, char *last)
/* Name of last clause. */
{
int pos;
int len;
@ -5601,8 +5528,7 @@ erlang_func (s, last)
* -record(graph, {vtab = notable, cyclic = true}).
*/
static void
erlang_attribute (s)
char *s;
erlang_attribute (char *s)
{
char *cp = s;
@ -5622,8 +5548,7 @@ erlang_attribute (s)
* Return the number of bytes consumed, or -1 if there was an error.
*/
static int
erlang_atom (s)
char *s;
erlang_atom (char *s)
{
int pos = 0;
@ -5661,8 +5586,7 @@ static char *substitute (char *, char *, struct re_registers *);
* unterminated regexps.
*/
static char *
scan_separators (name)
char *name;
scan_separators (char *name)
{
char sep = name[0];
char *copyto = name;
@ -5714,8 +5638,7 @@ scan_separators (name)
/* Look at the argument of --regex or --no-regex and do the right
thing. Same for each line of a regexp file. */
static void
analyse_regex (regex_arg)
char *regex_arg;
analyse_regex (char *regex_arg)
{
if (regex_arg == NULL)
{
@ -5786,9 +5709,7 @@ analyse_regex (regex_arg)
/* Separate the regexp pattern, compile it,
and care for optional name and modifiers. */
static void
add_regex (regexp_pattern, lang)
char *regexp_pattern;
language *lang;
add_regex (char *regexp_pattern, language *lang)
{
static struct re_pattern_buffer zeropattern;
char sep, *pat, *name, *modifiers;
@ -5905,9 +5826,7 @@ add_regex (regexp_pattern, lang)
* arguments.
*/
static char *
substitute (in, out, regs)
char *in, *out;
struct re_registers *regs;
substitute (char *in, char *out, struct re_registers *regs)
{
char *result, *t;
int size, dig, diglen;
@ -5954,7 +5873,7 @@ substitute (in, out, regs)
/* Deallocate all regexps. */
static void
free_regexps ()
free_regexps (void)
{
regexp *rp;
while (p_head != NULL)
@ -5976,7 +5895,7 @@ free_regexps ()
* Idea by Ben Wing <ben@666.com> (2002).
*/
static void
regex_tag_multiline ()
regex_tag_multiline (void)
{
char *buffer = filebuf.buffer;
regexp *rp;
@ -6053,8 +5972,7 @@ regex_tag_multiline ()
static bool
nocase_tail (cp)
char *cp;
nocase_tail (char *cp)
{
register int len = 0;
@ -6069,9 +5987,7 @@ nocase_tail (cp)
}
static void
get_tag (bp, namepp)
register char *bp;
char **namepp;
get_tag (register char *bp, char **namepp)
{
register char *cp = bp;
@ -6102,9 +6018,7 @@ get_tag (bp, namepp)
* appended to `filebuf'.
*/
static long
readline_internal (lbp, stream)
linebuffer *lbp;
register FILE *stream;
readline_internal (linebuffer *lbp, register FILE *stream)
{
char *buffer = lbp->buffer;
register char *p = lbp->buffer;
@ -6182,9 +6096,7 @@ readline_internal (lbp, stream)
* directives.
*/
static void
readline (lbp, stream)
linebuffer *lbp;
FILE *stream;
readline (linebuffer *lbp, FILE *stream)
{
long result;
@ -6377,8 +6289,7 @@ readline (lbp, stream)
* with xnew where the string CP has been copied.
*/
static char *
savestr (cp)
char *cp;
savestr (char *cp)
{
return savenstr (cp, strlen (cp));
}
@ -6388,9 +6299,7 @@ savestr (cp)
* the string CP has been copied for at most the first LEN characters.
*/
static char *
savenstr (cp, len)
char *cp;
int len;
savenstr (char *cp, int len)
{
register char *dp;
@ -6407,9 +6316,7 @@ savenstr (cp, len)
* Identical to POSIX strrchr, included for portability.
*/
static char *
etags_strrchr (sp, c)
register const char *sp;
register int c;
etags_strrchr (register const char *sp, register int c)
{
register const char *r;
@ -6429,9 +6336,7 @@ etags_strrchr (sp, c)
* Identical to POSIX strchr, included for portability.
*/
static char *
etags_strchr (sp, c)
register const char *sp;
register int c;
etags_strchr (register const char *sp, register int c)
{
do
{
@ -6447,9 +6352,7 @@ etags_strchr (sp, c)
* Same as BSD's strcasecmp, included for portability.
*/
static int
etags_strcasecmp (s1, s2)
register const char *s1;
register const char *s2;
etags_strcasecmp (register const char *s1, register const char *s2)
{
while (*s1 != '\0'
&& (ISALPHA (*s1) && ISALPHA (*s2)
@ -6469,10 +6372,7 @@ etags_strcasecmp (s1, s2)
* Same as BSD's strncasecmp, included for portability.
*/
static int
etags_strncasecmp (s1, s2, n)
register const char *s1;
register const char *s2;
register int n;
etags_strncasecmp (register const char *s1, register const char *s2, register int n)
{
while (*s1 != '\0' && n-- > 0
&& (ISALPHA (*s1) && ISALPHA (*s2)
@ -6490,8 +6390,7 @@ etags_strncasecmp (s1, s2, n)
/* Skip spaces (end of string is not space), return new pointer. */
static char *
skip_spaces (cp)
char *cp;
skip_spaces (char *cp)
{
while (iswhite (*cp))
cp++;
@ -6500,8 +6399,7 @@ skip_spaces (cp)
/* Skip non spaces, except end of string, return new pointer. */
static char *
skip_non_spaces (cp)
char *cp;
skip_non_spaces (char *cp)
{
while (*cp != '\0' && !iswhite (*cp))
cp++;
@ -6510,23 +6408,21 @@ skip_non_spaces (cp)
/* Print error message and exit. */
void
fatal (s1, s2)
char *s1, *s2;
fatal (char *s1, char *s2)
{
error (s1, s2);
exit (EXIT_FAILURE);
}
static void
pfatal (s1)
char *s1;
pfatal (char *s1)
{
perror (s1);
exit (EXIT_FAILURE);
}
static void
suggest_asking_for_help ()
suggest_asking_for_help (void)
{
fprintf (stderr, "\tTry `%s %s' for a complete list of options.\n",
progname, NO_LONG_OPTIONS ? "-h" : "--help");
@ -6535,8 +6431,7 @@ suggest_asking_for_help ()
/* Print error message. `s1' is printf control string, `s2' is arg for it. */
static void
error (s1, s2)
const char *s1, *s2;
error (const char *s1, const char *s2)
{
fprintf (stderr, "%s: ", progname);
fprintf (stderr, s1, s2);
@ -6546,8 +6441,7 @@ error (s1, s2)
/* Return a newly-allocated string whose contents
concatenate those of s1, s2, s3. */
static 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);
@ -6564,7 +6458,7 @@ concat (s1, s2, s3)
/* Does the same work as the system V getcwd, but does not need to
guess the buffer size in advance. */
static char *
etags_getcwd ()
etags_getcwd (void)
{
#ifdef HAVE_GETCWD
int bufsize = 200;
@ -6614,8 +6508,7 @@ etags_getcwd ()
/* Return a newly allocated string containing the file name of FILE
relative to the absolute directory DIR (which should end with a slash). */
static char *
relative_filename (file, dir)
char *file, *dir;
relative_filename (char *file, char *dir)
{
char *fp, *dp, *afn, *res;
int i;
@ -6654,8 +6547,7 @@ relative_filename (file, dir)
/* Return a newly allocated string containing the absolute file name
of FILE given DIR (which should end with a slash). */
static char *
absolute_filename (file, dir)
char *file, *dir;
absolute_filename (char *file, char *dir)
{
char *slashp, *cp, *res;
@ -6728,8 +6620,7 @@ absolute_filename (file, dir)
file name of dir where FILE resides given DIR (which should
end with a slash). */
static char *
absolute_dirname (file, dir)
char *file, *dir;
absolute_dirname (char *file, char *dir)
{
char *slashp, *res;
char save;
@ -6748,8 +6639,7 @@ absolute_dirname (file, dir)
/* Whether the argument string is an absolute file name. The argument
string must have been canonicalized with canonicalize_filename. */
static bool
filename_is_absolute (fn)
char *fn;
filename_is_absolute (char *fn)
{
return (fn[0] == '/'
#ifdef DOS_NT
@ -6761,8 +6651,7 @@ filename_is_absolute (fn)
/* Upcase DOS drive letter and collapse separators into single slashes.
Works in place. */
static void
canonicalize_filename (fn)
register char *fn;
canonicalize_filename (register char *fn)
{
register char* cp;
char sep = '/';
@ -6791,8 +6680,7 @@ canonicalize_filename (fn)
/* Initialize a linebuffer for use. */
static void
linebuffer_init (lbp)
linebuffer *lbp;
linebuffer_init (linebuffer *lbp)
{
lbp->size = (DEBUG) ? 3 : 200;
lbp->buffer = xnew (lbp->size, char);
@ -6802,9 +6690,7 @@ linebuffer_init (lbp)
/* Set the minimum size of a string contained in a linebuffer. */
static void
linebuffer_setlen (lbp, toksize)
linebuffer *lbp;
int toksize;
linebuffer_setlen (linebuffer *lbp, int toksize)
{
while (lbp->size <= toksize)
{
@ -6816,8 +6702,7 @@ linebuffer_setlen (lbp, toksize)
/* Like malloc but get fatal error if memory is exhausted. */
static PTR
xmalloc (size)
unsigned int size;
xmalloc (unsigned int size)
{
PTR result = (PTR) malloc (size);
if (result == NULL)
@ -6826,9 +6711,7 @@ xmalloc (size)
}
static PTR
xrealloc (ptr, size)
char *ptr;
unsigned int size;
xrealloc (char *ptr, unsigned int size)
{
PTR result = (PTR) realloc (ptr, size);
if (result == NULL)

View file

@ -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))

View file

@ -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);

View file

@ -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;

View file

@ -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
void fatal ();
void error ();
void pfatal_with_name ();
void pfatal_and_delete ();
char *concat ();
long *xmalloc ();
int popmail ();
int pop_retr ();
int mbx_write ();
int mbx_delimit_begin ();
int mbx_delimit_end ();
void fatal (char *s1, char *s2, char *s3);
void error (char *s1, char *s2, char *s3);
void pfatal_with_name (char *name);
void pfatal_and_delete (char *name);
char *concat (char *s1, char *s2, char *s3);
long *xmalloc (unsigned int size);
int popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse_order);
int pop_retr (popserver server, int msgno, FILE *arg);
int mbx_write (char *line, int len, FILE *mbf);
int mbx_delimit_begin (FILE *mbf);
int mbx_delimit_end (FILE *mbf);
/* Nonzero means this is name of a lock file to delete on fatal error. */
char *delete_lockname;
int
main (argc, argv)
int argc;
char **argv;
main (int argc, char **argv)
{
char *inname, *outname;
int indesc, outdesc;
@ -590,8 +588,7 @@ mail_spool_name (inname)
/* Print error message and exit. */
void
fatal (s1, s2, s3)
char *s1, *s2, *s3;
fatal (char *s1, char *s2, char *s3)
{
if (delete_lockname)
unlink (delete_lockname);
@ -603,8 +600,7 @@ fatal (s1, s2, s3)
are args for it or null. */
void
error (s1, s2, s3)
char *s1, *s2, *s3;
error (char *s1, char *s2, char *s3)
{
fprintf (stderr, "movemail: ");
if (s3)
@ -617,15 +613,13 @@ error (s1, s2, s3)
}
void
pfatal_with_name (name)
char *name;
pfatal_with_name (char *name)
{
fatal ("%s for %s", strerror (errno), name);
}
void
pfatal_and_delete (name)
char *name;
pfatal_and_delete (char *name)
{
char *s = strerror (errno);
unlink (name);
@ -635,8 +629,7 @@ pfatal_and_delete (name)
/* Return a newly-allocated string whose contents 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 = (char *) xmalloc (len1 + len2 + len3 + 1);
@ -652,8 +645,7 @@ concat (s1, s2, s3)
/* Like malloc but get fatal error if memory is exhausted. */
long *
xmalloc (size)
unsigned size;
xmalloc (unsigned int size)
{
long *result = (long *) malloc (size);
if (!result)
@ -703,18 +695,13 @@ char Errmsg[200]; /* POP errors, at least, can exceed
*/
int
popmail (mailbox, outfile, preserve, password, reverse_order)
char *mailbox;
char *outfile;
int preserve;
char *password;
int reverse_order;
popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse_order)
{
int nmsgs, nbytes;
register int i;
int mbfi;
FILE *mbf;
char *getenv ();
char *getenv (const char *);
popserver server;
int start, end, increment;
char *user, *hostname;
@ -834,12 +821,9 @@ popmail (mailbox, outfile, preserve, password, reverse_order)
}
int
pop_retr (server, msgno, arg)
popserver server;
int msgno;
FILE *arg;
pop_retr (popserver server, int msgno, FILE *arg)
{
extern char *strerror ();
extern char *strerror (int);
char *line;
int ret;
@ -885,10 +869,7 @@ pop_retr (server, msgno, arg)
&& (a[4] == ' '))
int
mbx_write (line, len, mbf)
char *line;
int len;
FILE *mbf;
mbx_write (char *line, int len, FILE *mbf)
{
#ifdef MOVEMAIL_QUOTE_POP_FROM_LINES
if (IS_FROM_LINE (line))
@ -912,8 +893,7 @@ mbx_write (line, len, mbf)
}
int
mbx_delimit_begin (mbf)
FILE *mbf;
mbx_delimit_begin (FILE *mbf)
{
time_t now;
struct tm *ltime;
@ -930,8 +910,7 @@ mbx_delimit_begin (mbf)
}
int
mbx_delimit_end (mbf)
FILE *mbf;
mbx_delimit_end (FILE *mbf)
{
if (putc ('\n', mbf) == EOF)
return (NOTOK);

View file

@ -166,11 +166,7 @@ int pop_debug = 0;
* explanation of the error.
*/
popserver
pop_open (host, username, password, flags)
char *host;
char *username;
char *password;
int flags;
pop_open (char *host, char *username, char *password, int flags)
{
int sock;
popserver server;
@ -337,10 +333,7 @@ pop_open (host, username, password, flags)
* connection impossible.
*/
int
pop_stat (server, count, size)
popserver server;
int *count;
int *size;
pop_stat (popserver server, int *count, int *size)
{
char *fromserver;
char *end_ptr;
@ -413,11 +406,7 @@ pop_stat (server, count, size)
* connection impossible.
*/
int
pop_list (server, message, IDs, sizes)
popserver server;
int message;
int **IDs;
int **sizes;
pop_list (popserver server, int message, int **IDs, int **sizes)
{
int how_many, i;
char *fromserver;
@ -559,11 +548,7 @@ pop_list (server, message, IDs, sizes)
* Side effects: May kill connection on error.
*/
int
pop_retrieve (server, message, markfrom, msg_buf)
popserver server;
int message;
int markfrom;
char **msg_buf;
pop_retrieve (popserver server, int message, int markfrom, char **msg_buf)
{
int *IDs, *sizes, bufsize, fromcount = 0, cp = 0;
char *ptr, *fromserver;
@ -637,10 +622,7 @@ pop_retrieve (server, message, markfrom, msg_buf)
}
int
pop_retrieve_first (server, message, response)
popserver server;
int message;
char **response;
pop_retrieve_first (popserver server, int message, char **response)
{
sprintf (pop_error, "RETR %d", message);
return (pop_multi_first (server, pop_error, response));
@ -655,25 +637,19 @@ pop_retrieve_first (server, message, response)
*/
int
pop_retrieve_next (server, line)
popserver server;
char **line;
pop_retrieve_next (popserver server, char **line)
{
return (pop_multi_next (server, line));
}
int
pop_retrieve_flush (server)
popserver server;
pop_retrieve_flush (popserver server)
{
return (pop_multi_flush (server));
}
int
pop_top_first (server, message, lines, response)
popserver server;
int message, lines;
char **response;
pop_top_first (popserver server, int message, int lines, char **response)
{
sprintf (pop_error, "TOP %d %d", message, lines);
return (pop_multi_first (server, pop_error, response));
@ -688,25 +664,19 @@ pop_top_first (server, message, lines, response)
*/
int
pop_top_next (server, line)
popserver server;
char **line;
pop_top_next (popserver server, char **line)
{
return (pop_multi_next (server, line));
}
int
pop_top_flush (server)
popserver server;
pop_top_flush (popserver server)
{
return (pop_multi_flush (server));
}
int
pop_multi_first (server, command, response)
popserver server;
char *command;
char **response;
pop_multi_first (popserver server, char *command, char **response)
{
if (server->in_multi)
{
@ -749,9 +719,7 @@ pop_multi_first (server, command, response)
0, LINE is set to null. */
int
pop_multi_next (server, line)
popserver server;
char **line;
pop_multi_next (popserver server, char **line)
{
char *fromserver;
int ret;
@ -789,8 +757,7 @@ pop_multi_next (server, line)
}
int
pop_multi_flush (server)
popserver server;
pop_multi_flush (popserver server)
{
char *line;
int ret;
@ -821,9 +788,7 @@ pop_multi_flush (server)
* otherwise.
*/
int
pop_delete (server, message)
popserver server;
int message;
pop_delete (popserver server, int message)
{
if (server->in_multi)
{
@ -853,8 +818,7 @@ pop_delete (server, message)
* Side effects: Closes connection on error.
*/
int
pop_noop (server)
popserver server;
pop_noop (popserver server)
{
if (server->in_multi)
{
@ -883,8 +847,7 @@ pop_noop (server)
* Side effects: Closes the connection on error.
*/
int
pop_last (server)
popserver server;
pop_last (popserver server)
{
char *fromserver;
@ -941,8 +904,7 @@ pop_last (server)
* Side effects: Closes the connection on error.
*/
int
pop_reset (server)
popserver server;
pop_reset (popserver server)
{
if (pop_retrieve_flush (server))
{
@ -970,8 +932,7 @@ pop_reset (server)
* function is called, even if an error occurs.
*/
int
pop_quit (server)
popserver server;
pop_quit (popserver server)
{
int ret = 0;
@ -1015,9 +976,7 @@ static int have_winsock = 0;
* into pop_error.
*/
static int
socket_connection (host, flags)
char *host;
int flags;
socket_connection (char *host, int flags)
{
#ifdef HAVE_GETADDRINFO
struct addrinfo *res, *it;
@ -1327,9 +1286,7 @@ socket_connection (host, flags)
* THE RETURNED LINE MAY CONTAIN EMBEDDED NULLS!
*/
static int
pop_getline (server, line)
popserver server;
char **line;
pop_getline (popserver server, char **line)
{
#define GETLINE_ERROR "Error reading from server: "
@ -1459,9 +1416,7 @@ pop_getline (server, line)
* Side effects: Closes the connection on error.
*/
static int
sendline (server, line)
popserver server;
char *line;
sendline (popserver server, char *line)
{
#define SENDLINE_ERROR "Error writing to POP server: "
int ret;
@ -1508,10 +1463,7 @@ sendline (server, line)
* Return value: Same as write. Pop_error is not set.
*/
static int
fullwrite (fd, buf, nbytes)
int fd;
char *buf;
int nbytes;
fullwrite (int fd, char *buf, int nbytes)
{
char *cp;
int ret = 0;
@ -1541,8 +1493,7 @@ fullwrite (fd, buf, nbytes)
* Side effects: On failure, may make the connection unusable.
*/
static int
getok (server)
popserver server;
getok (popserver server)
{
char *fromline;
@ -1613,8 +1564,7 @@ gettermination (server)
* since the last pop_reset) may be lost.
*/
void
pop_close (server)
popserver server;
pop_close (popserver server)
{
pop_trash (server);
free ((char *) server);
@ -1630,8 +1580,7 @@ pop_close (server)
* pop_close or pop_quit after this function has been called.
*/
static void
pop_trash (server)
popserver server;
pop_trash (popserver server)
{
if (server->file >= 0)
{
@ -1663,9 +1612,7 @@ pop_trash (server)
null, or 0 if it does not contain one. */
static char *
find_crlf (in_string, len)
char *in_string;
int len;
find_crlf (char *in_string, int len)
{
while (len--)
{

View file

@ -40,7 +40,7 @@ static char time_string[30];
/* Reset the stopwatch to zero. */
void
reset_watch ()
reset_watch (void)
{
EMACS_GET_TIME (TV1);
watch_not_started = 0;
@ -51,7 +51,7 @@ reset_watch ()
If reset_watch was not called yet, exit. */
char *
get_time ()
get_time (void)
{
if (watch_not_started)
exit (EXIT_FAILURE); /* call reset_watch first ! */
@ -79,7 +79,7 @@ gettimeofday (tp, tzp)
#endif
int
main ()
main (void)
{
int c;
while ((c = getchar ()) != EOF)

View file

@ -65,8 +65,7 @@ struct docstr /* Allocated thing for an entry. */
/* Print error message. `s1' is printf control string, `s2' is arg for it. */
void
error (s1, s2)
char *s1, *s2;
error (char *s1, char *s2)
{
fprintf (stderr, "sorted-doc: ");
fprintf (stderr, s1, s2);
@ -76,8 +75,7 @@ error (s1, s2)
/* Print error message and exit. */
void
fatal (s1, s2)
char *s1, *s2;
fatal (char *s1, char *s2)
{
error (s1, s2);
exit (EXIT_FAILURE);
@ -86,8 +84,7 @@ fatal (s1, s2)
/* Like malloc but get fatal error if memory is exhausted. */
char *
xmalloc (size)
int size;
xmalloc (int size)
{
char *result = malloc ((unsigned)size);
if (result == NULL)
@ -96,8 +93,7 @@ xmalloc (size)
}
char *
xstrdup (str)
char * str;
xstrdup (char *str)
{
char *buf = xmalloc (strlen (str) + 1);
(void) strcpy (buf, str);
@ -107,9 +103,7 @@ xstrdup (str)
/* Comparison function for qsort to call. */
int
cmpdoc (a, b)
DOCSTR **a;
DOCSTR **b;
cmpdoc (DOCSTR **a, DOCSTR **b)
{
register int val = strcmp ((*a)->name, (*b)->name);
if (val) return val;
@ -128,7 +122,7 @@ char *states[] =
};
int
main ()
main (void)
{
register DOCSTR *dp = NULL; /* allocated DOCSTR */
register LINE *lp = NULL; /* allocated line */

View file

@ -77,8 +77,7 @@ extern int optind, opterr;
#endif
int
usage (err)
int err;
usage (int err)
{
fprintf (stdout, "Usage: update-game-score [-m MAX ] [ -r ] game/scorefile SCORE DATA\n");
fprintf (stdout, " update-game-score -h\n");
@ -110,8 +109,7 @@ int write_scores (const char *filename, const struct score_entry *scores,
void lose (const char *msg) NO_RETURN;
void
lose (msg)
const char *msg;
lose (const char *msg)
{
fprintf (stderr, "%s\n", msg);
exit (EXIT_FAILURE);
@ -137,8 +135,7 @@ strerror (errnum)
#endif /* ! HAVE_STRERROR */
void
lose_syserr (msg)
const char *msg;
lose_syserr (const char *msg)
{
fprintf (stderr, "%s: %s\n", msg, strerror (errno));
exit (EXIT_FAILURE);
@ -166,9 +163,7 @@ get_user_id (void)
}
char *
get_prefix (running_suid, user_prefix)
int running_suid;
char *user_prefix;
get_prefix (int running_suid, char *user_prefix)
{
if (!running_suid && user_prefix == NULL)
lose ("Not using a shared game directory, and no prefix given.");
@ -184,9 +179,7 @@ get_prefix (running_suid, user_prefix)
}
int
main (argc, argv)
int argc;
char **argv;
main (int argc, char **argv)
{
int c, running_suid;
void *lockstate;
@ -273,9 +266,7 @@ main (argc, argv)
}
int
read_score (f, score)
FILE *f;
struct score_entry *score;
read_score (FILE *f, struct score_entry *score)
{
int c;
if (feof (f))
@ -359,10 +350,7 @@ read_score (f, score)
}
int
read_scores (filename, scores, count)
const char *filename;
struct score_entry **scores;
int *count;
read_scores (const char *filename, struct score_entry **scores, int *count)
{
int readval, scorecount, cursize;
struct score_entry *ret;
@ -395,9 +383,7 @@ read_scores (filename, scores, count)
}
int
score_compare (a, b)
const void *a;
const void *b;
score_compare (const void *a, const void *b)
{
const struct score_entry *sa = (const struct score_entry *) a;
const struct score_entry *sb = (const struct score_entry *) b;
@ -405,9 +391,7 @@ score_compare (a, b)
}
int
score_compare_reverse (a, b)
const void *a;
const void *b;
score_compare_reverse (const void *a, const void *b)
{
const struct score_entry *sa = (const struct score_entry *) a;
const struct score_entry *sb = (const struct score_entry *) b;
@ -415,11 +399,7 @@ score_compare_reverse (a, b)
}
int
push_score (scores, count, newscore, username, newdata)
struct score_entry **scores;
int *count; int newscore;
char *username;
char *newdata;
push_score (struct score_entry **scores, int *count, int newscore, char *username, char *newdata)
{
struct score_entry *newscores
= (struct score_entry *) realloc (*scores,
@ -435,20 +415,14 @@ push_score (scores, count, newscore, username, newdata)
}
void
sort_scores (scores, count, reverse)
struct score_entry *scores;
int count;
int reverse;
sort_scores (struct score_entry *scores, int count, int reverse)
{
qsort (scores, count, sizeof (struct score_entry),
reverse ? score_compare_reverse : score_compare);
}
int
write_scores (filename, scores, count)
const char *filename;
const struct score_entry * scores;
int count;
write_scores (const char *filename, const struct score_entry *scores, int count)
{
FILE *f;
int i;
@ -477,9 +451,7 @@ write_scores (filename, scores, count)
}
int
lock_file (filename, state)
const char *filename;
void **state;
lock_file (const char *filename, void **state)
{
int fd;
struct stat buf;
@ -520,9 +492,7 @@ lock_file (filename, state)
}
int
unlock_file (filename, state)
const char *filename;
void *state;
unlock_file (const char *filename, void *state)
{
char *lockpath = (char *) state;
int ret = unlink (lockpath);