mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-04 02:51:31 -08:00
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:
parent
a6ed0e2898
commit
873fbd0b84
14 changed files with 347 additions and 734 deletions
|
|
@ -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>
|
2010-07-02 Dan Nicolaescu <dann@ics.uci.edu>
|
||||||
|
|
||||||
* make-docfile.c (xmalloc, xrealloc, concat, readline, fatal):
|
* make-docfile.c (xmalloc, xrealloc, concat, readline, fatal):
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ struct linebuffer
|
||||||
char *buffer;
|
char *buffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern char *strtok();
|
extern char *strtok(char *, const char *);
|
||||||
|
|
||||||
long *xmalloc (unsigned int size);
|
long *xmalloc (unsigned int size);
|
||||||
long *xrealloc (char *ptr, unsigned int size);
|
long *xrealloc (char *ptr, unsigned int size);
|
||||||
|
|
@ -91,9 +91,7 @@ struct option longopts[] =
|
||||||
extern int optind;
|
extern int optind;
|
||||||
|
|
||||||
int
|
int
|
||||||
main (argc, argv)
|
main (int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
logical labels_saved, printing, header, first, last_was_blank_line;
|
logical labels_saved, printing, header, first, last_was_blank_line;
|
||||||
time_t ltoday;
|
time_t ltoday;
|
||||||
|
|
@ -220,8 +218,7 @@ main (argc, argv)
|
||||||
* concatenate those of s1, s2, s3.
|
* concatenate those of s1, s2, s3.
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
concat (s1, s2, s3)
|
concat (char *s1, char *s2, char *s3)
|
||||||
char *s1, *s2, *s3;
|
|
||||||
{
|
{
|
||||||
int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
|
int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
|
||||||
char *result = xnew (len1 + len2 + len3 + 1, char);
|
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.
|
* which is the length of the line including the newline, if any.
|
||||||
*/
|
*/
|
||||||
long
|
long
|
||||||
readline (linebuffer, stream)
|
readline (struct linebuffer *linebuffer, register FILE *stream)
|
||||||
struct linebuffer *linebuffer;
|
|
||||||
register FILE *stream;
|
|
||||||
{
|
{
|
||||||
char *buffer = linebuffer->buffer;
|
char *buffer = linebuffer->buffer;
|
||||||
register char *p = linebuffer->buffer;
|
register char *p = linebuffer->buffer;
|
||||||
|
|
@ -292,8 +287,7 @@ readline (linebuffer, stream)
|
||||||
* Like malloc but get fatal error if memory is exhausted.
|
* Like malloc but get fatal error if memory is exhausted.
|
||||||
*/
|
*/
|
||||||
long *
|
long *
|
||||||
xmalloc (size)
|
xmalloc (unsigned int size)
|
||||||
unsigned int size;
|
|
||||||
{
|
{
|
||||||
long *result = (long *) malloc (size);
|
long *result = (long *) malloc (size);
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
|
|
@ -302,9 +296,7 @@ xmalloc (size)
|
||||||
}
|
}
|
||||||
|
|
||||||
long *
|
long *
|
||||||
xrealloc (ptr, size)
|
xrealloc (char *ptr, unsigned int size)
|
||||||
char *ptr;
|
|
||||||
unsigned int size;
|
|
||||||
{
|
{
|
||||||
long *result = (long *) realloc (ptr, size);
|
long *result = (long *) realloc (ptr, size);
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
|
|
@ -313,8 +305,7 @@ xrealloc (ptr, size)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
fatal (message)
|
fatal (char *message)
|
||||||
char *message;
|
|
||||||
{
|
{
|
||||||
fprintf (stderr, "%s: %s\n", progname, message);
|
fprintf (stderr, "%s: %s\n", progname, message);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ but in texinfo format and sorted by function/variable name. */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
main ()
|
main (void)
|
||||||
{
|
{
|
||||||
register int ch;
|
register int ch;
|
||||||
register int notfirst = 0;
|
register int notfirst = 0;
|
||||||
|
|
|
||||||
|
|
@ -534,7 +534,7 @@ void parse_qualified_param_ident_or_type (char **);
|
||||||
int globals (int);
|
int globals (int);
|
||||||
void yyerror (char *, char *);
|
void yyerror (char *, char *);
|
||||||
void usage (int) NO_RETURN;
|
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. */
|
name and line number. */
|
||||||
|
|
||||||
void
|
void
|
||||||
yyerror (format, s)
|
yyerror (char *format, char *s)
|
||||||
char *format, *s;
|
|
||||||
{
|
{
|
||||||
fprintf (stderr, "%s:%d: ", filename, yyline);
|
fprintf (stderr, "%s:%d: ", filename, yyline);
|
||||||
fprintf (stderr, format, s);
|
fprintf (stderr, format, s);
|
||||||
|
|
@ -559,8 +558,7 @@ yyerror (format, s)
|
||||||
available. */
|
available. */
|
||||||
|
|
||||||
void *
|
void *
|
||||||
xmalloc (nbytes)
|
xmalloc (int nbytes)
|
||||||
int nbytes;
|
|
||||||
{
|
{
|
||||||
void *p = malloc (nbytes);
|
void *p = malloc (nbytes);
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
|
|
@ -575,9 +573,7 @@ xmalloc (nbytes)
|
||||||
/* Like realloc but print an error and exit if out of memory. */
|
/* Like realloc but print an error and exit if out of memory. */
|
||||||
|
|
||||||
void *
|
void *
|
||||||
xrealloc (p, sz)
|
xrealloc (void *p, int sz)
|
||||||
void *p;
|
|
||||||
int sz;
|
|
||||||
{
|
{
|
||||||
p = realloc (p, sz);
|
p = realloc (p, sz);
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
|
|
@ -593,8 +589,7 @@ xrealloc (p, sz)
|
||||||
available.. If S is null, return null. */
|
available.. If S is null, return null. */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
xstrdup (s)
|
xstrdup (char *s)
|
||||||
char *s;
|
|
||||||
{
|
{
|
||||||
if (s)
|
if (s)
|
||||||
s = strcpy (xmalloc (strlen (s) + 1), s);
|
s = strcpy (xmalloc (strlen (s) + 1), s);
|
||||||
|
|
@ -611,7 +606,7 @@ xstrdup (s)
|
||||||
special symbol for globals (`*Globals*'). */
|
special symbol for globals (`*Globals*'). */
|
||||||
|
|
||||||
void
|
void
|
||||||
init_sym ()
|
init_sym (void)
|
||||||
{
|
{
|
||||||
global_symbols = add_sym (GLOBALS_NAME, NULL);
|
global_symbols = add_sym (GLOBALS_NAME, NULL);
|
||||||
}
|
}
|
||||||
|
|
@ -625,9 +620,7 @@ init_sym ()
|
||||||
create a new symbol and set it to default values. */
|
create a new symbol and set it to default values. */
|
||||||
|
|
||||||
struct sym *
|
struct sym *
|
||||||
add_sym (name, nested_in_class)
|
add_sym (char *name, struct sym *nested_in_class)
|
||||||
char *name;
|
|
||||||
struct sym *nested_in_class;
|
|
||||||
{
|
{
|
||||||
struct sym *sym;
|
struct sym *sym;
|
||||||
unsigned h;
|
unsigned h;
|
||||||
|
|
@ -668,8 +661,7 @@ add_sym (name, nested_in_class)
|
||||||
/* Add links between superclass SUPER and subclass SUB. */
|
/* Add links between superclass SUPER and subclass SUB. */
|
||||||
|
|
||||||
void
|
void
|
||||||
add_link (super, sub)
|
add_link (struct sym *super, struct sym *sub)
|
||||||
struct sym *super, *sub;
|
|
||||||
{
|
{
|
||||||
struct link *lnk, *lnk2, *p, *prev;
|
struct link *lnk, *lnk2, *p, *prev;
|
||||||
|
|
||||||
|
|
@ -709,11 +701,7 @@ add_link (super, sub)
|
||||||
found or null if not found. */
|
found or null if not found. */
|
||||||
|
|
||||||
struct member *
|
struct member *
|
||||||
find_member (cls, name, var, sc, hash)
|
find_member (struct sym *cls, char *name, int var, int sc, unsigned int hash)
|
||||||
struct sym *cls;
|
|
||||||
char *name;
|
|
||||||
int var, sc;
|
|
||||||
unsigned hash;
|
|
||||||
{
|
{
|
||||||
struct member **list;
|
struct member **list;
|
||||||
struct member *p;
|
struct member *p;
|
||||||
|
|
@ -763,16 +751,7 @@ find_member (cls, name, var, sc, hash)
|
||||||
F_* defines). */
|
F_* defines). */
|
||||||
|
|
||||||
void
|
void
|
||||||
add_member_decl (cls, name, regexp, pos, hash, var, sc, vis, 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 sym *cls;
|
|
||||||
char *name;
|
|
||||||
char *regexp;
|
|
||||||
int pos;
|
|
||||||
unsigned hash;
|
|
||||||
int var;
|
|
||||||
int sc;
|
|
||||||
int vis;
|
|
||||||
int flags;
|
|
||||||
{
|
{
|
||||||
struct member *m;
|
struct member *m;
|
||||||
|
|
||||||
|
|
@ -820,15 +799,7 @@ add_member_decl (cls, name, regexp, pos, hash, var, sc, vis, flags)
|
||||||
F_* defines). */
|
F_* defines). */
|
||||||
|
|
||||||
void
|
void
|
||||||
add_member_defn (cls, name, regexp, pos, hash, var, sc, flags)
|
add_member_defn (struct sym *cls, char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags)
|
||||||
struct sym *cls;
|
|
||||||
char *name;
|
|
||||||
char *regexp;
|
|
||||||
int pos;
|
|
||||||
unsigned hash;
|
|
||||||
int var;
|
|
||||||
int sc;
|
|
||||||
int flags;
|
|
||||||
{
|
{
|
||||||
struct member *m;
|
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. */
|
if it is non-null. POS is the position in the file. */
|
||||||
|
|
||||||
void
|
void
|
||||||
add_define (name, regexp, pos)
|
add_define (char *name, char *regexp, int pos)
|
||||||
char *name, *regexp;
|
|
||||||
int pos;
|
|
||||||
{
|
{
|
||||||
add_global_defn (name, regexp, pos, 0, 1, SC_FRIEND, F_DEFINE);
|
add_global_defn (name, regexp, pos, 0, 1, SC_FRIEND, F_DEFINE);
|
||||||
add_global_decl (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). */
|
F_* defines). */
|
||||||
|
|
||||||
void
|
void
|
||||||
add_global_defn (name, regexp, pos, hash, var, sc, flags)
|
add_global_defn (char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags)
|
||||||
char *name, *regexp;
|
|
||||||
int pos;
|
|
||||||
unsigned hash;
|
|
||||||
int var;
|
|
||||||
int sc;
|
|
||||||
int flags;
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct sym *sym;
|
struct sym *sym;
|
||||||
|
|
@ -927,13 +890,7 @@ add_global_defn (name, regexp, pos, hash, var, sc, flags)
|
||||||
F_* defines). */
|
F_* defines). */
|
||||||
|
|
||||||
void
|
void
|
||||||
add_global_decl (name, regexp, pos, hash, var, sc, flags)
|
add_global_decl (char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags)
|
||||||
char *name, *regexp;
|
|
||||||
int pos;
|
|
||||||
unsigned hash;
|
|
||||||
int var;
|
|
||||||
int sc;
|
|
||||||
int flags;
|
|
||||||
{
|
{
|
||||||
/* Add declaration only if not already declared. Header files must
|
/* Add declaration only if not already declared. Header files must
|
||||||
be processed before source files for this to have the right effect.
|
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. */
|
Value is a pointer to the member's structure. */
|
||||||
|
|
||||||
struct member *
|
struct member *
|
||||||
add_member (cls, name, var, sc, hash)
|
add_member (struct sym *cls, char *name, int var, int sc, unsigned int hash)
|
||||||
struct sym *cls;
|
|
||||||
char *name;
|
|
||||||
int var;
|
|
||||||
int sc;
|
|
||||||
unsigned hash;
|
|
||||||
{
|
{
|
||||||
struct member *m = (struct member *) xmalloc (sizeof *m + strlen (name));
|
struct member *m = (struct member *) xmalloc (sizeof *m + strlen (name));
|
||||||
struct member **list;
|
struct member **list;
|
||||||
|
|
@ -1048,8 +1000,7 @@ add_member (cls, name, var, sc, hash)
|
||||||
in base classes. */
|
in base classes. */
|
||||||
|
|
||||||
void
|
void
|
||||||
mark_virtual (r)
|
mark_virtual (struct sym *r)
|
||||||
struct sym *r;
|
|
||||||
{
|
{
|
||||||
struct link *p;
|
struct link *p;
|
||||||
struct member *m, *m2;
|
struct member *m, *m2;
|
||||||
|
|
@ -1073,7 +1024,7 @@ mark_virtual (r)
|
||||||
are virtual because of a virtual declaration in a base class. */
|
are virtual because of a virtual declaration in a base class. */
|
||||||
|
|
||||||
void
|
void
|
||||||
mark_inherited_virtual ()
|
mark_inherited_virtual (void)
|
||||||
{
|
{
|
||||||
struct sym *r;
|
struct sym *r;
|
||||||
int i;
|
int i;
|
||||||
|
|
@ -1088,9 +1039,7 @@ mark_inherited_virtual ()
|
||||||
/* Create and return a symbol for a namespace with name NAME. */
|
/* Create and return a symbol for a namespace with name NAME. */
|
||||||
|
|
||||||
struct sym *
|
struct sym *
|
||||||
make_namespace (name, context)
|
make_namespace (char *name, struct sym *context)
|
||||||
char *name;
|
|
||||||
struct sym *context;
|
|
||||||
{
|
{
|
||||||
struct sym *s = (struct sym *) xmalloc (sizeof *s + strlen (name));
|
struct sym *s = (struct sym *) xmalloc (sizeof *s + strlen (name));
|
||||||
bzero (s, sizeof *s);
|
bzero (s, sizeof *s);
|
||||||
|
|
@ -1105,9 +1054,7 @@ make_namespace (name, context)
|
||||||
/* Find the symbol for namespace NAME. If not found, retrun NULL */
|
/* Find the symbol for namespace NAME. If not found, retrun NULL */
|
||||||
|
|
||||||
struct sym *
|
struct sym *
|
||||||
check_namespace (name, context)
|
check_namespace (char *name, struct sym *context)
|
||||||
char *name;
|
|
||||||
struct sym *context;
|
|
||||||
{
|
{
|
||||||
struct sym *p = NULL;
|
struct sym *p = NULL;
|
||||||
|
|
||||||
|
|
@ -1124,9 +1071,7 @@ check_namespace (name, context)
|
||||||
for NAME to all_namespaces. */
|
for NAME to all_namespaces. */
|
||||||
|
|
||||||
struct sym *
|
struct sym *
|
||||||
find_namespace (name, context)
|
find_namespace (char *name, struct sym *context)
|
||||||
char *name;
|
|
||||||
struct sym *context;
|
|
||||||
{
|
{
|
||||||
struct sym *p = check_namespace (name, 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. */
|
/* Find namespace alias with name NAME. If not found return NULL. */
|
||||||
|
|
||||||
struct link *
|
struct link *
|
||||||
check_namespace_alias (name)
|
check_namespace_alias (char *name)
|
||||||
char *name;
|
|
||||||
{
|
{
|
||||||
struct link *p = NULL;
|
struct link *p = NULL;
|
||||||
struct alias *al;
|
struct alias *al;
|
||||||
|
|
@ -1165,9 +1109,7 @@ check_namespace_alias (name)
|
||||||
/* Register the name NEW_NAME as an alias for namespace list OLD_NAME. */
|
/* Register the name NEW_NAME as an alias for namespace list OLD_NAME. */
|
||||||
|
|
||||||
void
|
void
|
||||||
register_namespace_alias (new_name, old_name)
|
register_namespace_alias (char *new_name, struct link *old_name)
|
||||||
char *new_name;
|
|
||||||
struct link *old_name;
|
|
||||||
{
|
{
|
||||||
unsigned h;
|
unsigned h;
|
||||||
char *s;
|
char *s;
|
||||||
|
|
@ -1195,8 +1137,7 @@ register_namespace_alias (new_name, old_name)
|
||||||
/* Enter namespace with name NAME. */
|
/* Enter namespace with name NAME. */
|
||||||
|
|
||||||
void
|
void
|
||||||
enter_namespace (name)
|
enter_namespace (char *name)
|
||||||
char *name;
|
|
||||||
{
|
{
|
||||||
struct sym *p = find_namespace (name, current_namespace);
|
struct sym *p = find_namespace (name, current_namespace);
|
||||||
|
|
||||||
|
|
@ -1217,7 +1158,7 @@ enter_namespace (name)
|
||||||
/* Leave the current namespace. */
|
/* Leave the current namespace. */
|
||||||
|
|
||||||
void
|
void
|
||||||
leave_namespace ()
|
leave_namespace (void)
|
||||||
{
|
{
|
||||||
assert (namespace_sp > 0);
|
assert (namespace_sp > 0);
|
||||||
current_namespace = namespace_stack[--namespace_sp];
|
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. */
|
/* Make sure scope_buffer has enough room to add LEN chars to it. */
|
||||||
|
|
||||||
void
|
void
|
||||||
ensure_scope_buffer_room (len)
|
ensure_scope_buffer_room (int len)
|
||||||
int len;
|
|
||||||
{
|
{
|
||||||
if (scope_buffer_len + len >= scope_buffer_size)
|
if (scope_buffer_len + len >= scope_buffer_size)
|
||||||
{
|
{
|
||||||
|
|
@ -1276,8 +1216,7 @@ ensure_scope_buffer_room (len)
|
||||||
scope name constructed. */
|
scope name constructed. */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
sym_scope_1 (p)
|
sym_scope_1 (struct sym *p)
|
||||||
struct sym *p;
|
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
|
|
@ -1311,8 +1250,7 @@ sym_scope_1 (p)
|
||||||
as it would appear in a C*+ source file. */
|
as it would appear in a C*+ source file. */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
sym_scope (p)
|
sym_scope (struct sym *p)
|
||||||
struct sym *p;
|
|
||||||
{
|
{
|
||||||
if (!scope_buffer)
|
if (!scope_buffer)
|
||||||
{
|
{
|
||||||
|
|
@ -1334,9 +1272,7 @@ sym_scope (p)
|
||||||
list. */
|
list. */
|
||||||
|
|
||||||
int
|
int
|
||||||
dump_members (fp, m)
|
dump_members (FILE *fp, struct member *m)
|
||||||
FILE *fp;
|
|
||||||
struct member *m;
|
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
|
|
@ -1369,9 +1305,7 @@ dump_members (fp, m)
|
||||||
/* Dump class ROOT to stream FP. */
|
/* Dump class ROOT to stream FP. */
|
||||||
|
|
||||||
void
|
void
|
||||||
dump_sym (fp, root)
|
dump_sym (FILE *fp, struct sym *root)
|
||||||
FILE *fp;
|
|
||||||
struct sym *root;
|
|
||||||
{
|
{
|
||||||
fputs (CLASS_STRUCT, fp);
|
fputs (CLASS_STRUCT, fp);
|
||||||
PUTSTR (root->name, fp);
|
PUTSTR (root->name, fp);
|
||||||
|
|
@ -1397,9 +1331,7 @@ dump_sym (fp, root)
|
||||||
number of classes written. */
|
number of classes written. */
|
||||||
|
|
||||||
int
|
int
|
||||||
dump_tree (fp, root)
|
dump_tree (FILE *fp, struct sym *root)
|
||||||
FILE *fp;
|
|
||||||
struct sym *root;
|
|
||||||
{
|
{
|
||||||
struct link *lk;
|
struct link *lk;
|
||||||
unsigned n = 0;
|
unsigned n = 0;
|
||||||
|
|
@ -1446,8 +1378,7 @@ dump_tree (fp, root)
|
||||||
/* Dump the entire class tree to file FP. */
|
/* Dump the entire class tree to file FP. */
|
||||||
|
|
||||||
void
|
void
|
||||||
dump_roots (fp)
|
dump_roots (FILE *fp)
|
||||||
FILE *fp;
|
|
||||||
{
|
{
|
||||||
int i, n = 0;
|
int i, n = 0;
|
||||||
struct sym *r;
|
struct sym *r;
|
||||||
|
|
@ -1521,7 +1452,7 @@ do { \
|
||||||
input buffer not consumed. */
|
input buffer not consumed. */
|
||||||
|
|
||||||
int
|
int
|
||||||
process_pp_line ()
|
process_pp_line (void)
|
||||||
{
|
{
|
||||||
int in_comment = 0, in_string = 0;
|
int in_comment = 0, in_string = 0;
|
||||||
int c;
|
int c;
|
||||||
|
|
@ -1592,7 +1523,7 @@ process_pp_line ()
|
||||||
/* Value is the next token from the input buffer. */
|
/* Value is the next token from the input buffer. */
|
||||||
|
|
||||||
int
|
int
|
||||||
yylex ()
|
yylex (void)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
char end_char;
|
char end_char;
|
||||||
|
|
@ -2009,7 +1940,7 @@ static char *matching_regexp_buffer, *matching_regexp_end_buf;
|
||||||
shorter than min_regexp. */
|
shorter than min_regexp. */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
matching_regexp ()
|
matching_regexp (void)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
char *s;
|
char *s;
|
||||||
|
|
@ -2060,8 +1991,7 @@ matching_regexp ()
|
||||||
/* Return a printable representation of token T. */
|
/* Return a printable representation of token T. */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
token_string (t)
|
token_string (int t)
|
||||||
int t;
|
|
||||||
{
|
{
|
||||||
static char b[3];
|
static char b[3];
|
||||||
|
|
||||||
|
|
@ -2178,7 +2108,7 @@ token_string (t)
|
||||||
/* Reinitialize the scanner for a new input file. */
|
/* Reinitialize the scanner for a new input file. */
|
||||||
|
|
||||||
void
|
void
|
||||||
re_init_scanner ()
|
re_init_scanner (void)
|
||||||
{
|
{
|
||||||
in = inbuffer;
|
in = inbuffer;
|
||||||
yyline = 1;
|
yyline = 1;
|
||||||
|
|
@ -2196,9 +2126,7 @@ re_init_scanner ()
|
||||||
table. */
|
table. */
|
||||||
|
|
||||||
void
|
void
|
||||||
insert_keyword (name, tk)
|
insert_keyword (char *name, int tk)
|
||||||
char *name;
|
|
||||||
int tk;
|
|
||||||
{
|
{
|
||||||
char *s;
|
char *s;
|
||||||
unsigned h = 0;
|
unsigned h = 0;
|
||||||
|
|
@ -2219,7 +2147,7 @@ insert_keyword (name, tk)
|
||||||
character class vectors and fills the keyword hash table. */
|
character class vectors and fills the keyword hash table. */
|
||||||
|
|
||||||
void
|
void
|
||||||
init_scanner ()
|
init_scanner (void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
@ -2363,8 +2291,7 @@ init_scanner ()
|
||||||
the current lookahead token after skipping. */
|
the current lookahead token after skipping. */
|
||||||
|
|
||||||
int
|
int
|
||||||
skip_to (token)
|
skip_to (int token)
|
||||||
int token;
|
|
||||||
{
|
{
|
||||||
while (!LOOKING_AT2 (YYEOF, token))
|
while (!LOOKING_AT2 (YYEOF, token))
|
||||||
MATCH ();
|
MATCH ();
|
||||||
|
|
@ -2375,7 +2302,7 @@ skip_to (token)
|
||||||
angle brackets, curly brackets) matching the current lookahead. */
|
angle brackets, curly brackets) matching the current lookahead. */
|
||||||
|
|
||||||
void
|
void
|
||||||
skip_matching ()
|
skip_matching (void)
|
||||||
{
|
{
|
||||||
int open, close, n;
|
int open, close, n;
|
||||||
|
|
||||||
|
|
@ -2418,7 +2345,7 @@ skip_matching ()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
skip_initializer ()
|
skip_initializer (void)
|
||||||
{
|
{
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
|
@ -2445,7 +2372,7 @@ skip_initializer ()
|
||||||
/* Build qualified namespace alias (A::B::c) and return it. */
|
/* Build qualified namespace alias (A::B::c) and return it. */
|
||||||
|
|
||||||
struct link *
|
struct link *
|
||||||
match_qualified_namespace_alias ()
|
match_qualified_namespace_alias (void)
|
||||||
{
|
{
|
||||||
struct link *head = NULL;
|
struct link *head = NULL;
|
||||||
struct link *cur = NULL;
|
struct link *cur = NULL;
|
||||||
|
|
@ -2482,7 +2409,7 @@ match_qualified_namespace_alias ()
|
||||||
/* Re-initialize the parser by resetting the lookahead token. */
|
/* Re-initialize the parser by resetting the lookahead token. */
|
||||||
|
|
||||||
void
|
void
|
||||||
re_init_parser ()
|
re_init_parser (void)
|
||||||
{
|
{
|
||||||
tk = -1;
|
tk = -1;
|
||||||
}
|
}
|
||||||
|
|
@ -2495,8 +2422,7 @@ re_init_parser ()
|
||||||
distinguish between overloaded functions. */
|
distinguish between overloaded functions. */
|
||||||
|
|
||||||
unsigned
|
unsigned
|
||||||
parm_list (flags)
|
parm_list (int *flags)
|
||||||
int *flags;
|
|
||||||
{
|
{
|
||||||
unsigned hash = 0;
|
unsigned hash = 0;
|
||||||
int type_seen = 0;
|
int type_seen = 0;
|
||||||
|
|
@ -2609,7 +2535,7 @@ parm_list (flags)
|
||||||
/* Print position info to stdout. */
|
/* Print position info to stdout. */
|
||||||
|
|
||||||
void
|
void
|
||||||
print_info ()
|
print_info (void)
|
||||||
{
|
{
|
||||||
if (info_position >= 0 && BUFFER_POS () <= info_position)
|
if (info_position >= 0 && BUFFER_POS () <= info_position)
|
||||||
if (info_cls)
|
if (info_cls)
|
||||||
|
|
@ -2624,9 +2550,7 @@ print_info ()
|
||||||
public). */
|
public). */
|
||||||
|
|
||||||
void
|
void
|
||||||
member (cls, vis)
|
member (struct sym *cls, int vis)
|
||||||
struct sym *cls;
|
|
||||||
int vis;
|
|
||||||
{
|
{
|
||||||
char *id = NULL;
|
char *id = NULL;
|
||||||
int sc = SC_MEMBER;
|
int sc = SC_MEMBER;
|
||||||
|
|
@ -2835,9 +2759,7 @@ member (cls, vis)
|
||||||
union, class). */
|
union, class). */
|
||||||
|
|
||||||
void
|
void
|
||||||
class_body (cls, tag)
|
class_body (struct sym *cls, int tag)
|
||||||
struct sym *cls;
|
|
||||||
int tag;
|
|
||||||
{
|
{
|
||||||
int vis = tag == CLASS ? PRIVATE : PUBLIC;
|
int vis = tag == CLASS ? PRIVATE : PUBLIC;
|
||||||
int temp;
|
int temp;
|
||||||
|
|
@ -2898,7 +2820,7 @@ class_body (cls, tag)
|
||||||
symbol for that class. */
|
symbol for that class. */
|
||||||
|
|
||||||
struct sym *
|
struct sym *
|
||||||
parse_classname ()
|
parse_classname (void)
|
||||||
{
|
{
|
||||||
struct sym *last_class = NULL;
|
struct sym *last_class = NULL;
|
||||||
|
|
||||||
|
|
@ -2928,8 +2850,7 @@ parse_classname ()
|
||||||
a static buffer holding the constructed operator name string. */
|
a static buffer holding the constructed operator name string. */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
operator_name (sc)
|
operator_name (int *sc)
|
||||||
int *sc;
|
|
||||||
{
|
{
|
||||||
static int id_size = 0;
|
static int id_size = 0;
|
||||||
static char *id = NULL;
|
static char *id = NULL;
|
||||||
|
|
@ -3019,8 +2940,7 @@ operator_name (sc)
|
||||||
symbol structure for the ident. */
|
symbol structure for the ident. */
|
||||||
|
|
||||||
struct sym *
|
struct sym *
|
||||||
parse_qualified_ident_or_type (last_id)
|
parse_qualified_ident_or_type (char **last_id)
|
||||||
char **last_id;
|
|
||||||
{
|
{
|
||||||
struct sym *cls = NULL;
|
struct sym *cls = NULL;
|
||||||
char *id = NULL;
|
char *id = NULL;
|
||||||
|
|
@ -3085,8 +3005,7 @@ parse_qualified_ident_or_type (last_id)
|
||||||
symbol structure for the ident. */
|
symbol structure for the ident. */
|
||||||
|
|
||||||
void
|
void
|
||||||
parse_qualified_param_ident_or_type (last_id)
|
parse_qualified_param_ident_or_type (char **last_id)
|
||||||
char **last_id;
|
|
||||||
{
|
{
|
||||||
struct sym *cls = NULL;
|
struct sym *cls = NULL;
|
||||||
static char *id = NULL;
|
static char *id = NULL;
|
||||||
|
|
@ -3128,11 +3047,7 @@ parse_qualified_param_ident_or_type (last_id)
|
||||||
Current lookahead is the class name. */
|
Current lookahead is the class name. */
|
||||||
|
|
||||||
void
|
void
|
||||||
class_definition (containing, tag, flags, nested)
|
class_definition (struct sym *containing, int tag, int flags, int nested)
|
||||||
struct sym *containing;
|
|
||||||
int tag;
|
|
||||||
int flags;
|
|
||||||
int nested;
|
|
||||||
{
|
{
|
||||||
struct sym *current;
|
struct sym *current;
|
||||||
struct sym *base_class;
|
struct sym *base_class;
|
||||||
|
|
@ -3229,10 +3144,7 @@ class_definition (containing, tag, flags, nested)
|
||||||
information about the member (see the F_* defines). */
|
information about the member (see the F_* defines). */
|
||||||
|
|
||||||
void
|
void
|
||||||
add_declarator (cls, id, flags, sc)
|
add_declarator (struct sym **cls, char **id, int flags, int sc)
|
||||||
struct sym **cls;
|
|
||||||
char **id;
|
|
||||||
int flags, sc;
|
|
||||||
{
|
{
|
||||||
if (LOOKING_AT2 (';', ','))
|
if (LOOKING_AT2 (';', ','))
|
||||||
{
|
{
|
||||||
|
|
@ -3275,8 +3187,7 @@ add_declarator (cls, id, flags, sc)
|
||||||
/* Parse a declaration. */
|
/* Parse a declaration. */
|
||||||
|
|
||||||
void
|
void
|
||||||
declaration (flags)
|
declaration (int flags)
|
||||||
int flags;
|
|
||||||
{
|
{
|
||||||
char *id = NULL;
|
char *id = NULL;
|
||||||
struct sym *cls = NULL;
|
struct sym *cls = NULL;
|
||||||
|
|
@ -3430,8 +3341,7 @@ declaration (flags)
|
||||||
otherwise. */
|
otherwise. */
|
||||||
|
|
||||||
int
|
int
|
||||||
globals (start_flags)
|
globals (int start_flags)
|
||||||
int start_flags;
|
|
||||||
{
|
{
|
||||||
int anonymous;
|
int anonymous;
|
||||||
int class_tk;
|
int class_tk;
|
||||||
|
|
@ -3549,7 +3459,7 @@ globals (start_flags)
|
||||||
/* Parse the current input file. */
|
/* Parse the current input file. */
|
||||||
|
|
||||||
void
|
void
|
||||||
yyparse ()
|
yyparse (void)
|
||||||
{
|
{
|
||||||
while (globals (0) == 0)
|
while (globals (0) == 0)
|
||||||
MATCH_IF ('}');
|
MATCH_IF ('}');
|
||||||
|
|
@ -3565,8 +3475,7 @@ yyparse ()
|
||||||
input files. */
|
input files. */
|
||||||
|
|
||||||
void
|
void
|
||||||
add_search_path (path_list)
|
add_search_path (char *path_list)
|
||||||
char *path_list;
|
|
||||||
{
|
{
|
||||||
while (*path_list)
|
while (*path_list)
|
||||||
{
|
{
|
||||||
|
|
@ -3601,8 +3510,7 @@ add_search_path (path_list)
|
||||||
unchanged file name. */
|
unchanged file name. */
|
||||||
|
|
||||||
FILE *
|
FILE *
|
||||||
open_file (file)
|
open_file (char *file)
|
||||||
char *file;
|
|
||||||
{
|
{
|
||||||
FILE *fp = NULL;
|
FILE *fp = NULL;
|
||||||
static char *buffer;
|
static char *buffer;
|
||||||
|
|
@ -3661,8 +3569,7 @@ Usage: ebrowse [options] {files}\n\
|
||||||
"
|
"
|
||||||
|
|
||||||
void
|
void
|
||||||
usage (error)
|
usage (int error)
|
||||||
int error;
|
|
||||||
{
|
{
|
||||||
puts (USAGE);
|
puts (USAGE);
|
||||||
exit (error ? EXIT_FAILURE : EXIT_SUCCESS);
|
exit (error ? EXIT_FAILURE : EXIT_SUCCESS);
|
||||||
|
|
@ -3677,7 +3584,7 @@ usage (error)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
version ()
|
version (void)
|
||||||
{
|
{
|
||||||
/* Makes it easier to update automatically. */
|
/* Makes it easier to update automatically. */
|
||||||
char emacs_copyright[] = "Copyright (C) 2010 Free Software Foundation, Inc.";
|
char emacs_copyright[] = "Copyright (C) 2010 Free Software Foundation, Inc.";
|
||||||
|
|
@ -3693,8 +3600,7 @@ version ()
|
||||||
table. */
|
table. */
|
||||||
|
|
||||||
void
|
void
|
||||||
process_file (file)
|
process_file (char *file)
|
||||||
char *file;
|
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
|
|
@ -3749,8 +3655,7 @@ process_file (file)
|
||||||
is null when EOF is reached. */
|
is null when EOF is reached. */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
read_line (fp)
|
read_line (FILE *fp)
|
||||||
FILE *fp;
|
|
||||||
{
|
{
|
||||||
static char *buffer;
|
static char *buffer;
|
||||||
static int buffer_size;
|
static int buffer_size;
|
||||||
|
|
@ -3786,9 +3691,7 @@ read_line (fp)
|
||||||
/* Main entry point. */
|
/* Main entry point. */
|
||||||
|
|
||||||
int
|
int
|
||||||
main (argc, argv)
|
main (int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int any_inputfiles = 0;
|
int any_inputfiles = 0;
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
|
||||||
char *getenv (), *getwd ();
|
char *getenv (const char *), *getwd (char *);
|
||||||
char *(getcwd) ();
|
char *(getcwd) ();
|
||||||
|
|
||||||
#ifdef WINDOWSNT
|
#ifdef WINDOWSNT
|
||||||
|
|
@ -157,7 +157,7 @@ char *server_file = NULL;
|
||||||
/* PID of the Emacs server process. */
|
/* PID of the Emacs server process. */
|
||||||
int emacs_pid = 0;
|
int emacs_pid = 0;
|
||||||
|
|
||||||
void print_help_and_exit () NO_RETURN;
|
void print_help_and_exit (void) NO_RETURN;
|
||||||
|
|
||||||
struct option longopts[] =
|
struct option longopts[] =
|
||||||
{
|
{
|
||||||
|
|
@ -184,8 +184,7 @@ struct option longopts[] =
|
||||||
/* Like malloc but get fatal error if memory is exhausted. */
|
/* Like malloc but get fatal error if memory is exhausted. */
|
||||||
|
|
||||||
long *
|
long *
|
||||||
xmalloc (size)
|
xmalloc (unsigned int size)
|
||||||
unsigned int size;
|
|
||||||
{
|
{
|
||||||
long *result = (long *) malloc (size);
|
long *result = (long *) malloc (size);
|
||||||
if (result == NULL)
|
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. */
|
The global variable `optind' will say how many arguments we used up. */
|
||||||
|
|
||||||
void
|
void
|
||||||
decode_options (argc, argv)
|
decode_options (int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
alternate_editor = egetenv ("ALTERNATE_EDITOR");
|
alternate_editor = egetenv ("ALTERNATE_EDITOR");
|
||||||
|
|
||||||
|
|
@ -645,7 +642,7 @@ an empty string");
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
print_help_and_exit ()
|
print_help_and_exit (void)
|
||||||
{
|
{
|
||||||
/* Spaces and tabs are significant in this message; they're chosen so the
|
/* 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.
|
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 AUTH_KEY_LENGTH 64
|
||||||
#define SEND_BUFFER_SIZE 4096
|
#define SEND_BUFFER_SIZE 4096
|
||||||
|
|
||||||
extern char *strerror ();
|
extern char *strerror (int);
|
||||||
|
|
||||||
/* Buffer to accumulate data to send in TCP connections. */
|
/* Buffer to accumulate data to send in TCP connections. */
|
||||||
char send_buffer[SEND_BUFFER_SIZE + 1];
|
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
|
/* On Windows, the socket library was historically separate from the standard
|
||||||
C library, so errors are handled differently. */
|
C library, so errors are handled differently. */
|
||||||
void
|
void
|
||||||
sock_err_message (function_name)
|
sock_err_message (char *function_name)
|
||||||
char *function_name;
|
|
||||||
{
|
{
|
||||||
#ifdef WINDOWSNT
|
#ifdef WINDOWSNT
|
||||||
char* msg = NULL;
|
char* msg = NULL;
|
||||||
|
|
@ -768,9 +764,7 @@ sock_err_message (function_name)
|
||||||
- the buffer is full (but this shouldn't happen)
|
- the buffer is full (but this shouldn't happen)
|
||||||
Otherwise, we just accumulate it. */
|
Otherwise, we just accumulate it. */
|
||||||
void
|
void
|
||||||
send_to_emacs (s, data)
|
send_to_emacs (int s, char *data)
|
||||||
HSOCKET s;
|
|
||||||
char *data;
|
|
||||||
{
|
{
|
||||||
while (data)
|
while (data)
|
||||||
{
|
{
|
||||||
|
|
@ -809,9 +803,7 @@ send_to_emacs (s, data)
|
||||||
|
|
||||||
Does not change the string. Outputs the result to STREAM. */
|
Does not change the string. Outputs the result to STREAM. */
|
||||||
void
|
void
|
||||||
quote_argument (s, str)
|
quote_argument (int s, char *str)
|
||||||
HSOCKET s;
|
|
||||||
char *str;
|
|
||||||
{
|
{
|
||||||
char *copy = (char *) xmalloc (strlen (str) * 2 + 1);
|
char *copy = (char *) xmalloc (strlen (str) * 2 + 1);
|
||||||
char *p, *q;
|
char *p, *q;
|
||||||
|
|
@ -851,8 +843,7 @@ quote_argument (s, str)
|
||||||
modifying the string in place. Returns STR. */
|
modifying the string in place. Returns STR. */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
unquote_argument (str)
|
unquote_argument (char *str)
|
||||||
char *str;
|
|
||||||
{
|
{
|
||||||
char *p, *q;
|
char *p, *q;
|
||||||
|
|
||||||
|
|
@ -883,8 +874,7 @@ unquote_argument (str)
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
file_name_absolute_p (filename)
|
file_name_absolute_p (const unsigned char *filename)
|
||||||
const unsigned char *filename;
|
|
||||||
{
|
{
|
||||||
/* Sanity check, it shouldn't happen. */
|
/* Sanity check, it shouldn't happen. */
|
||||||
if (! filename) return FALSE;
|
if (! filename) return FALSE;
|
||||||
|
|
@ -938,9 +928,7 @@ initialize_sockets ()
|
||||||
* the Emacs server: host, port, pid and authentication string.
|
* the Emacs server: host, port, pid and authentication string.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
get_server_config (server, authentication)
|
get_server_config (struct sockaddr_in *server, char *authentication)
|
||||||
struct sockaddr_in *server;
|
|
||||||
char *authentication;
|
|
||||||
{
|
{
|
||||||
char dotted[32];
|
char dotted[32];
|
||||||
char *port;
|
char *port;
|
||||||
|
|
@ -1005,7 +993,7 @@ get_server_config (server, authentication)
|
||||||
}
|
}
|
||||||
|
|
||||||
HSOCKET
|
HSOCKET
|
||||||
set_tcp_socket ()
|
set_tcp_socket (void)
|
||||||
{
|
{
|
||||||
HSOCKET s;
|
HSOCKET s;
|
||||||
struct sockaddr_in server;
|
struct sockaddr_in server;
|
||||||
|
|
@ -1119,8 +1107,7 @@ find_tty (char **tty_type, char **tty_name, int noabort)
|
||||||
0 - success: none of the above */
|
0 - success: none of the above */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
socket_status (socket_name)
|
socket_status (char *socket_name)
|
||||||
char *socket_name;
|
|
||||||
{
|
{
|
||||||
struct stat statbfr;
|
struct stat statbfr;
|
||||||
|
|
||||||
|
|
@ -1223,7 +1210,7 @@ init_signals (void)
|
||||||
|
|
||||||
|
|
||||||
HSOCKET
|
HSOCKET
|
||||||
set_local_socket ()
|
set_local_socket (void)
|
||||||
{
|
{
|
||||||
HSOCKET s;
|
HSOCKET s;
|
||||||
struct sockaddr_un server;
|
struct sockaddr_un server;
|
||||||
|
|
@ -1526,9 +1513,7 @@ start_daemon_and_retry_set_socket (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (argc, argv)
|
main (int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
int i, rl, needlf = 0;
|
int i, rl, needlf = 0;
|
||||||
char *cwd, *str;
|
char *cwd, *str;
|
||||||
|
|
|
||||||
371
lib-src/etags.c
371
lib-src/etags.c
|
|
@ -848,7 +848,7 @@ static language lang_names [] =
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_language_names ()
|
print_language_names (void)
|
||||||
{
|
{
|
||||||
language *lang;
|
language *lang;
|
||||||
char **name, **ext;
|
char **name, **ext;
|
||||||
|
|
@ -887,7 +887,7 @@ etags --help --lang=ada.");
|
||||||
# define VERSION "17.38.1.4"
|
# define VERSION "17.38.1.4"
|
||||||
#endif
|
#endif
|
||||||
static void
|
static void
|
||||||
print_version ()
|
print_version (void)
|
||||||
{
|
{
|
||||||
/* Makes it easier to update automatically. */
|
/* Makes it easier to update automatically. */
|
||||||
char emacs_copyright[] = "Copyright (C) 2010 Free Software Foundation, Inc.";
|
char emacs_copyright[] = "Copyright (C) 2010 Free Software Foundation, Inc.";
|
||||||
|
|
@ -904,8 +904,7 @@ print_version ()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_help (argbuffer)
|
print_help (argument *argbuffer)
|
||||||
argument *argbuffer;
|
|
||||||
{
|
{
|
||||||
bool help_for_lang = FALSE;
|
bool help_for_lang = FALSE;
|
||||||
|
|
||||||
|
|
@ -1082,9 +1081,7 @@ Relative ones are stored relative to the output file's directory.\n");
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main (argc, argv)
|
main (int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
unsigned int nincluded_files;
|
unsigned int nincluded_files;
|
||||||
|
|
@ -1409,9 +1406,7 @@ main (argc, argv)
|
||||||
* Idea by Vladimir Alexiev <vladimir@cs.ualberta.ca> (1998)
|
* Idea by Vladimir Alexiev <vladimir@cs.ualberta.ca> (1998)
|
||||||
*/
|
*/
|
||||||
static compressor *
|
static compressor *
|
||||||
get_compressor_from_suffix (file, extptr)
|
get_compressor_from_suffix (char *file, char **extptr)
|
||||||
char *file;
|
|
||||||
char **extptr;
|
|
||||||
{
|
{
|
||||||
compressor *compr;
|
compressor *compr;
|
||||||
char *slash, *suffix;
|
char *slash, *suffix;
|
||||||
|
|
@ -1447,8 +1442,7 @@ get_compressor_from_suffix (file, extptr)
|
||||||
* Return a language given the name.
|
* Return a language given the name.
|
||||||
*/
|
*/
|
||||||
static language *
|
static language *
|
||||||
get_language_from_langname (name)
|
get_language_from_langname (const char *name)
|
||||||
const char *name;
|
|
||||||
{
|
{
|
||||||
language *lang;
|
language *lang;
|
||||||
|
|
||||||
|
|
@ -1470,8 +1464,7 @@ get_language_from_langname (name)
|
||||||
* Return a language given the interpreter name.
|
* Return a language given the interpreter name.
|
||||||
*/
|
*/
|
||||||
static language *
|
static language *
|
||||||
get_language_from_interpreter (interpreter)
|
get_language_from_interpreter (char *interpreter)
|
||||||
char *interpreter;
|
|
||||||
{
|
{
|
||||||
language *lang;
|
language *lang;
|
||||||
char **iname;
|
char **iname;
|
||||||
|
|
@ -1493,9 +1486,7 @@ get_language_from_interpreter (interpreter)
|
||||||
* Return a language given the file name.
|
* Return a language given the file name.
|
||||||
*/
|
*/
|
||||||
static language *
|
static language *
|
||||||
get_language_from_filename (file, case_sensitive)
|
get_language_from_filename (char *file, int case_sensitive)
|
||||||
char *file;
|
|
||||||
bool case_sensitive;
|
|
||||||
{
|
{
|
||||||
language *lang;
|
language *lang;
|
||||||
char **name, **ext, *suffix;
|
char **name, **ext, *suffix;
|
||||||
|
|
@ -1529,9 +1520,7 @@ get_language_from_filename (file, case_sensitive)
|
||||||
* This routine is called on each file argument.
|
* This routine is called on each file argument.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
process_file_name (file, lang)
|
process_file_name (char *file, language *lang)
|
||||||
char *file;
|
|
||||||
language *lang;
|
|
||||||
{
|
{
|
||||||
struct stat stat_buf;
|
struct stat stat_buf;
|
||||||
FILE *inf;
|
FILE *inf;
|
||||||
|
|
@ -1653,10 +1642,7 @@ process_file_name (file, lang)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
process_file (fh, fn, lang)
|
process_file (FILE *fh, char *fn, language *lang)
|
||||||
FILE *fh;
|
|
||||||
char *fn;
|
|
||||||
language *lang;
|
|
||||||
{
|
{
|
||||||
static const fdesc emptyfdesc;
|
static const fdesc emptyfdesc;
|
||||||
fdesc *fdp;
|
fdesc *fdp;
|
||||||
|
|
@ -1733,7 +1719,7 @@ process_file (fh, fn, lang)
|
||||||
* of a char is TRUE if it is the string "white", else FALSE.
|
* of a char is TRUE if it is the string "white", else FALSE.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
init ()
|
init (void)
|
||||||
{
|
{
|
||||||
register char *sp;
|
register char *sp;
|
||||||
register int i;
|
register int i;
|
||||||
|
|
@ -1756,8 +1742,7 @@ init ()
|
||||||
* which finds the function and type definitions.
|
* which finds the function and type definitions.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
find_entries (inf)
|
find_entries (FILE *inf)
|
||||||
FILE *inf;
|
|
||||||
{
|
{
|
||||||
char *cp;
|
char *cp;
|
||||||
language *lang = curfdp->lang;
|
language *lang = curfdp->lang;
|
||||||
|
|
@ -1915,14 +1900,14 @@ find_entries (inf)
|
||||||
* etags.el needs to use the same characters that are in NONAM.
|
* etags.el needs to use the same characters that are in NONAM.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
make_tag (name, namelen, is_func, linestart, linelen, lno, cno)
|
make_tag (char *name, int namelen, int is_func, char *linestart, int linelen, int lno, long int cno)
|
||||||
char *name; /* tag name, or NULL if unnamed */
|
/* tag name, or NULL if unnamed */
|
||||||
int namelen; /* tag length */
|
/* tag length */
|
||||||
bool is_func; /* tag is a function */
|
/* tag is a function */
|
||||||
char *linestart; /* start of the line where tag is */
|
/* start of the line where tag is */
|
||||||
int linelen; /* length of the line where tag is */
|
/* length of the line where tag is */
|
||||||
int lno; /* line number */
|
/* line number */
|
||||||
long cno; /* character number */
|
/* character number */
|
||||||
{
|
{
|
||||||
bool named = (name != NULL && namelen > 0);
|
bool named = (name != NULL && namelen > 0);
|
||||||
|
|
||||||
|
|
@ -1958,13 +1943,13 @@ make_tag (name, namelen, is_func, linestart, linelen, lno, cno)
|
||||||
|
|
||||||
/* Record a tag. */
|
/* Record a tag. */
|
||||||
static void
|
static void
|
||||||
pfnote (name, is_func, linestart, linelen, lno, cno)
|
pfnote (char *name, int is_func, char *linestart, int linelen, int lno, long int cno)
|
||||||
char *name; /* tag name, or NULL if unnamed */
|
/* tag name, or NULL if unnamed */
|
||||||
bool is_func; /* tag is a function */
|
/* tag is a function */
|
||||||
char *linestart; /* start of the line where tag is */
|
/* start of the line where tag is */
|
||||||
int linelen; /* length of the line where tag is */
|
/* length of the line where tag is */
|
||||||
int lno; /* line number */
|
/* line number */
|
||||||
long cno; /* character number */
|
/* character number */
|
||||||
{
|
{
|
||||||
register node *np;
|
register node *np;
|
||||||
|
|
||||||
|
|
@ -2018,8 +2003,7 @@ pfnote (name, is_func, linestart, linelen, lno, cno)
|
||||||
* recurse on left children, iterate on right children.
|
* recurse on left children, iterate on right children.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
free_tree (np)
|
free_tree (register node *np)
|
||||||
register node *np;
|
|
||||||
{
|
{
|
||||||
while (np)
|
while (np)
|
||||||
{
|
{
|
||||||
|
|
@ -2037,8 +2021,7 @@ free_tree (np)
|
||||||
* delete a file description
|
* delete a file description
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
free_fdesc (fdp)
|
free_fdesc (register fdesc *fdp)
|
||||||
register fdesc *fdp;
|
|
||||||
{
|
{
|
||||||
free (fdp->infname);
|
free (fdp->infname);
|
||||||
free (fdp->infabsname);
|
free (fdp->infabsname);
|
||||||
|
|
@ -2058,8 +2041,7 @@ free_fdesc (fdp)
|
||||||
* maintain state.
|
* maintain state.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
add_node (np, cur_node_p)
|
add_node (node *np, node **cur_node_p)
|
||||||
node *np, **cur_node_p;
|
|
||||||
{
|
{
|
||||||
register int dif;
|
register int dif;
|
||||||
register node *cur_node = *cur_node_p;
|
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).
|
* given file description (CTAGS case) or free them (ETAGS case).
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
invalidate_nodes (badfdp, npp)
|
invalidate_nodes (fdesc *badfdp, node **npp)
|
||||||
fdesc *badfdp;
|
|
||||||
node **npp;
|
|
||||||
{
|
{
|
||||||
node *np = *npp;
|
node *np = *npp;
|
||||||
|
|
||||||
|
|
@ -2178,8 +2158,7 @@ static int number_len (long);
|
||||||
|
|
||||||
/* Length of a non-negative number's decimal representation. */
|
/* Length of a non-negative number's decimal representation. */
|
||||||
static int
|
static int
|
||||||
number_len (num)
|
number_len (long int num)
|
||||||
long num;
|
|
||||||
{
|
{
|
||||||
int len = 1;
|
int len = 1;
|
||||||
while ((num /= 10) > 0)
|
while ((num /= 10) > 0)
|
||||||
|
|
@ -2194,8 +2173,7 @@ number_len (num)
|
||||||
* but is still supplied for backward compatibility.
|
* but is still supplied for backward compatibility.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
total_size_of_entries (np)
|
total_size_of_entries (register node *np)
|
||||||
register node *np;
|
|
||||||
{
|
{
|
||||||
register int total = 0;
|
register int total = 0;
|
||||||
|
|
||||||
|
|
@ -2215,8 +2193,7 @@ total_size_of_entries (np)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
put_entries (np)
|
put_entries (register node *np)
|
||||||
register node *np;
|
|
||||||
{
|
{
|
||||||
register char *sp;
|
register char *sp;
|
||||||
static fdesc *fdp = NULL;
|
static fdesc *fdp = NULL;
|
||||||
|
|
@ -2395,9 +2372,7 @@ inline
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
static unsigned int
|
static unsigned int
|
||||||
hash (str, len)
|
hash (register const char *str, register unsigned int len)
|
||||||
register const char *str;
|
|
||||||
register unsigned int len;
|
|
||||||
{
|
{
|
||||||
static unsigned char asso_values[] =
|
static unsigned char asso_values[] =
|
||||||
{
|
{
|
||||||
|
|
@ -2443,9 +2418,7 @@ hash (str, len)
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct C_stab_entry *
|
static struct C_stab_entry *
|
||||||
in_word_set (str, len)
|
in_word_set (register const char *str, register unsigned int len)
|
||||||
register const char *str;
|
|
||||||
register unsigned int len;
|
|
||||||
{
|
{
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
|
@ -2511,10 +2484,7 @@ in_word_set (str, len)
|
||||||
/*%>*/
|
/*%>*/
|
||||||
|
|
||||||
static enum sym_type
|
static enum sym_type
|
||||||
C_symtype (str, len, c_ext)
|
C_symtype (char *str, int len, int c_ext)
|
||||||
char *str;
|
|
||||||
int len;
|
|
||||||
int c_ext;
|
|
||||||
{
|
{
|
||||||
register struct C_stab_entry *se = in_word_set (str, len);
|
register struct C_stab_entry *se = in_word_set (str, len);
|
||||||
|
|
||||||
|
|
@ -2658,10 +2628,7 @@ static struct {
|
||||||
&& bracelev == cstack.bracelev[nestlev-1] + 1)
|
&& bracelev == cstack.bracelev[nestlev-1] + 1)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pushclass_above (bracelev, str, len)
|
pushclass_above (int bracelev, char *str, int len)
|
||||||
int bracelev;
|
|
||||||
char *str;
|
|
||||||
int len;
|
|
||||||
{
|
{
|
||||||
int nl;
|
int nl;
|
||||||
|
|
||||||
|
|
@ -2680,8 +2647,7 @@ pushclass_above (bracelev, str, len)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
popclass_above (bracelev)
|
popclass_above (int bracelev)
|
||||||
int bracelev;
|
|
||||||
{
|
{
|
||||||
int nl;
|
int nl;
|
||||||
|
|
||||||
|
|
@ -2695,9 +2661,7 @@ popclass_above (bracelev)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
write_classname (cn, qualifier)
|
write_classname (linebuffer *cn, char *qualifier)
|
||||||
linebuffer *cn;
|
|
||||||
char *qualifier;
|
|
||||||
{
|
{
|
||||||
int i, len;
|
int i, len;
|
||||||
int qlen = strlen (qualifier);
|
int qlen = strlen (qualifier);
|
||||||
|
|
@ -2752,14 +2716,14 @@ static void make_C_tag (bool);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
consider_token (str, len, c, c_extp, bracelev, parlev, is_func_or_var)
|
consider_token (register char *str, register int len, register int c, int *c_extp, int bracelev, int parlev, int *is_func_or_var)
|
||||||
register char *str; /* IN: token pointer */
|
/* IN: token pointer */
|
||||||
register int len; /* IN: token length */
|
/* IN: token length */
|
||||||
register int c; /* IN: first char after the token */
|
/* IN: first char after the token */
|
||||||
int *c_extp; /* IN, OUT: C extensions mask */
|
/* IN, OUT: C extensions mask */
|
||||||
int bracelev; /* IN: brace level */
|
/* IN: brace level */
|
||||||
int parlev; /* IN: parenthesis level */
|
/* IN: parenthesis level */
|
||||||
bool *is_func_or_var; /* OUT: function or variable found */
|
/* OUT: function or variable found */
|
||||||
{
|
{
|
||||||
/* When structdef is stagseen, scolonseen, or snone with bracelev > 0,
|
/* When structdef is stagseen, scolonseen, or snone with bracelev > 0,
|
||||||
structtype is the type of the preceding struct-like keyword, and
|
structtype is the type of the preceding struct-like keyword, and
|
||||||
|
|
@ -3093,8 +3057,7 @@ do { \
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
make_C_tag (isfun)
|
make_C_tag (int isfun)
|
||||||
bool isfun;
|
|
||||||
{
|
{
|
||||||
/* This function is never called when token.valid is FALSE, but
|
/* This function is never called when token.valid is FALSE, but
|
||||||
we must protect against invalid input or internal errors. */
|
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.
|
* C syntax and adds them to the list.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
C_entries (c_ext, inf)
|
C_entries (int c_ext, FILE *inf)
|
||||||
int c_ext; /* extension of C */
|
/* extension of C */
|
||||||
FILE *inf; /* input file */
|
/* input file */
|
||||||
{
|
{
|
||||||
register char c; /* latest char read; '\0' for end of line */
|
register char c; /* latest char read; '\0' for end of line */
|
||||||
register char *lp; /* pointer one beyond the character `c' */
|
register char *lp; /* pointer one beyond the character `c' */
|
||||||
|
|
@ -3952,48 +3915,42 @@ C_entries (c_ext, inf)
|
||||||
* of a global flag.
|
* of a global flag.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
default_C_entries (inf)
|
default_C_entries (FILE *inf)
|
||||||
FILE *inf;
|
|
||||||
{
|
{
|
||||||
C_entries (cplusplus ? C_PLPL : C_AUTO, inf);
|
C_entries (cplusplus ? C_PLPL : C_AUTO, inf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Always do plain C. */
|
/* Always do plain C. */
|
||||||
static void
|
static void
|
||||||
plain_C_entries (inf)
|
plain_C_entries (FILE *inf)
|
||||||
FILE *inf;
|
|
||||||
{
|
{
|
||||||
C_entries (0, inf);
|
C_entries (0, inf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Always do C++. */
|
/* Always do C++. */
|
||||||
static void
|
static void
|
||||||
Cplusplus_entries (inf)
|
Cplusplus_entries (FILE *inf)
|
||||||
FILE *inf;
|
|
||||||
{
|
{
|
||||||
C_entries (C_PLPL, inf);
|
C_entries (C_PLPL, inf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Always do Java. */
|
/* Always do Java. */
|
||||||
static void
|
static void
|
||||||
Cjava_entries (inf)
|
Cjava_entries (FILE *inf)
|
||||||
FILE *inf;
|
|
||||||
{
|
{
|
||||||
C_entries (C_JAVA, inf);
|
C_entries (C_JAVA, inf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Always do C*. */
|
/* Always do C*. */
|
||||||
static void
|
static void
|
||||||
Cstar_entries (inf)
|
Cstar_entries (FILE *inf)
|
||||||
FILE *inf;
|
|
||||||
{
|
{
|
||||||
C_entries (C_STAR, inf);
|
C_entries (C_STAR, inf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Always do Yacc. */
|
/* Always do Yacc. */
|
||||||
static void
|
static void
|
||||||
Yacc_entries (inf)
|
Yacc_entries (FILE *inf)
|
||||||
FILE *inf;
|
|
||||||
{
|
{
|
||||||
C_entries (YACC, inf);
|
C_entries (YACC, inf);
|
||||||
}
|
}
|
||||||
|
|
@ -4026,8 +3983,7 @@ Yacc_entries (inf)
|
||||||
* matching on files that have no language defined.
|
* matching on files that have no language defined.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
just_read_file (inf)
|
just_read_file (FILE *inf)
|
||||||
FILE *inf;
|
|
||||||
{
|
{
|
||||||
register char *dummy;
|
register char *dummy;
|
||||||
|
|
||||||
|
|
@ -4042,7 +3998,7 @@ static void F_takeprec (void);
|
||||||
static void F_getit (FILE *);
|
static void F_getit (FILE *);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
F_takeprec ()
|
F_takeprec (void)
|
||||||
{
|
{
|
||||||
dbp = skip_spaces (dbp);
|
dbp = skip_spaces (dbp);
|
||||||
if (*dbp != '*')
|
if (*dbp != '*')
|
||||||
|
|
@ -4065,8 +4021,7 @@ F_takeprec ()
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
F_getit (inf)
|
F_getit (FILE *inf)
|
||||||
FILE *inf;
|
|
||||||
{
|
{
|
||||||
register char *cp;
|
register char *cp;
|
||||||
|
|
||||||
|
|
@ -4090,8 +4045,7 @@ F_getit (inf)
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
Fortran_functions (inf)
|
Fortran_functions (FILE *inf)
|
||||||
FILE *inf;
|
|
||||||
{
|
{
|
||||||
LOOP_ON_INPUT_LINES (inf, lb, dbp)
|
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
|
/* Once we are positioned after an "interesting" keyword, let's get
|
||||||
the real tag value necessary. */
|
the real tag value necessary. */
|
||||||
static void
|
static void
|
||||||
Ada_getit (inf, name_qualifier)
|
Ada_getit (FILE *inf, char *name_qualifier)
|
||||||
FILE *inf;
|
|
||||||
char *name_qualifier;
|
|
||||||
{
|
{
|
||||||
register char *cp;
|
register char *cp;
|
||||||
char *name;
|
char *name;
|
||||||
|
|
@ -4243,8 +4195,7 @@ Ada_getit (inf, name_qualifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
Ada_funcs (inf)
|
Ada_funcs (FILE *inf)
|
||||||
FILE *inf;
|
|
||||||
{
|
{
|
||||||
bool inquote = FALSE;
|
bool inquote = FALSE;
|
||||||
bool skip_till_semicolumn = FALSE;
|
bool skip_till_semicolumn = FALSE;
|
||||||
|
|
@ -4357,8 +4308,7 @@ Ada_funcs (inf)
|
||||||
* Idea by Bob Weiner, Motorola Inc. (1994)
|
* Idea by Bob Weiner, Motorola Inc. (1994)
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
Asm_labels (inf)
|
Asm_labels (FILE *inf)
|
||||||
FILE *inf;
|
|
||||||
{
|
{
|
||||||
register char *cp;
|
register char *cp;
|
||||||
|
|
||||||
|
|
@ -4390,8 +4340,7 @@ Asm_labels (inf)
|
||||||
* Ideas by Kai Großjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE> (2001)
|
* Ideas by Kai Großjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE> (2001)
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
Perl_functions (inf)
|
Perl_functions (FILE *inf)
|
||||||
FILE *inf;
|
|
||||||
{
|
{
|
||||||
char *package = savestr ("main"); /* current package name */
|
char *package = savestr ("main"); /* current package name */
|
||||||
register char *cp;
|
register char *cp;
|
||||||
|
|
@ -4473,8 +4422,7 @@ Perl_functions (inf)
|
||||||
* More ideas by seb bacon <seb@jamkit.com> (2002)
|
* More ideas by seb bacon <seb@jamkit.com> (2002)
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
Python_functions (inf)
|
Python_functions (FILE *inf)
|
||||||
FILE *inf;
|
|
||||||
{
|
{
|
||||||
register char *cp;
|
register char *cp;
|
||||||
|
|
||||||
|
|
@ -4504,8 +4452,7 @@ Python_functions (inf)
|
||||||
* Idea by Diez B. Roggisch (2001)
|
* Idea by Diez B. Roggisch (2001)
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
PHP_functions (inf)
|
PHP_functions (FILE *inf)
|
||||||
FILE *inf;
|
|
||||||
{
|
{
|
||||||
register char *cp, *name;
|
register char *cp, *name;
|
||||||
bool search_identifier = FALSE;
|
bool search_identifier = FALSE;
|
||||||
|
|
@ -4584,8 +4531,7 @@ PHP_functions (inf)
|
||||||
* Idea by Corny de Souza (1993)
|
* Idea by Corny de Souza (1993)
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
Cobol_paragraphs (inf)
|
Cobol_paragraphs (FILE *inf)
|
||||||
FILE *inf;
|
|
||||||
{
|
{
|
||||||
register char *bp, *ep;
|
register char *bp, *ep;
|
||||||
|
|
||||||
|
|
@ -4613,8 +4559,7 @@ Cobol_paragraphs (inf)
|
||||||
* Ideas by Assar Westerlund <assar@sics.se> (2001)
|
* Ideas by Assar Westerlund <assar@sics.se> (2001)
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
Makefile_targets (inf)
|
Makefile_targets (FILE *inf)
|
||||||
FILE *inf;
|
|
||||||
{
|
{
|
||||||
register char *bp;
|
register char *bp;
|
||||||
|
|
||||||
|
|
@ -4649,8 +4594,7 @@ Makefile_targets (inf)
|
||||||
* the tag is skipped.
|
* the tag is skipped.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
Pascal_functions (inf)
|
Pascal_functions (FILE *inf)
|
||||||
FILE *inf;
|
|
||||||
{
|
{
|
||||||
linebuffer tline; /* mostly copied from C_entries */
|
linebuffer tline; /* mostly copied from C_entries */
|
||||||
long save_lcno;
|
long save_lcno;
|
||||||
|
|
@ -4830,7 +4774,7 @@ Pascal_functions (inf)
|
||||||
static void L_getit (void);
|
static void L_getit (void);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
L_getit ()
|
L_getit (void)
|
||||||
{
|
{
|
||||||
if (*dbp == '\'') /* Skip prefix quote */
|
if (*dbp == '\'') /* Skip prefix quote */
|
||||||
dbp++;
|
dbp++;
|
||||||
|
|
@ -4846,8 +4790,7 @@ L_getit ()
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
Lisp_functions (inf)
|
Lisp_functions (FILE *inf)
|
||||||
FILE *inf;
|
|
||||||
{
|
{
|
||||||
LOOP_ON_INPUT_LINES (inf, lb, dbp)
|
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.
|
* "function" and "local function" are tags if they start at column 1.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
Lua_functions (inf)
|
Lua_functions (FILE *inf)
|
||||||
FILE *inf;
|
|
||||||
{
|
{
|
||||||
register char *bp;
|
register char *bp;
|
||||||
|
|
||||||
|
|
@ -4918,8 +4860,7 @@ Lua_functions (inf)
|
||||||
* Masatake Yamato <masata-y@is.aist-nara.ac.jp> (1999)
|
* Masatake Yamato <masata-y@is.aist-nara.ac.jp> (1999)
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
PS_functions (inf)
|
PS_functions (FILE *inf)
|
||||||
FILE *inf;
|
|
||||||
{
|
{
|
||||||
register char *bp, *ep;
|
register char *bp, *ep;
|
||||||
|
|
||||||
|
|
@ -4949,8 +4890,7 @@ PS_functions (inf)
|
||||||
* Ideas by Eduardo Horvath <eeh@netbsd.org> (2004)
|
* Ideas by Eduardo Horvath <eeh@netbsd.org> (2004)
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
Forth_words (inf)
|
Forth_words (FILE *inf)
|
||||||
FILE *inf;
|
|
||||||
{
|
{
|
||||||
register char *bp;
|
register char *bp;
|
||||||
|
|
||||||
|
|
@ -4986,8 +4926,7 @@ Forth_words (inf)
|
||||||
* Original code by Ken Haase (1985?)
|
* Original code by Ken Haase (1985?)
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
Scheme_functions (inf)
|
Scheme_functions (FILE *inf)
|
||||||
FILE *inf;
|
|
||||||
{
|
{
|
||||||
register char *bp;
|
register char *bp;
|
||||||
|
|
||||||
|
|
@ -5038,8 +4977,7 @@ static char TEX_clgrp = '}';
|
||||||
* TeX/LaTeX scanning loop.
|
* TeX/LaTeX scanning loop.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
TeX_commands (inf)
|
TeX_commands (FILE *inf)
|
||||||
FILE *inf;
|
|
||||||
{
|
{
|
||||||
char *cp;
|
char *cp;
|
||||||
linebuffer *key;
|
linebuffer *key;
|
||||||
|
|
@ -5103,8 +5041,7 @@ TeX_commands (inf)
|
||||||
/* Figure out whether TeX's escapechar is '\\' or '!' and set grouping
|
/* Figure out whether TeX's escapechar is '\\' or '!' and set grouping
|
||||||
chars accordingly. */
|
chars accordingly. */
|
||||||
static void
|
static void
|
||||||
TEX_mode (inf)
|
TEX_mode (FILE *inf)
|
||||||
FILE *inf;
|
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
|
|
@ -5138,9 +5075,7 @@ TEX_mode (inf)
|
||||||
/* Read environment and prepend it to the default string.
|
/* Read environment and prepend it to the default string.
|
||||||
Build token table. */
|
Build token table. */
|
||||||
static void
|
static void
|
||||||
TEX_decode_env (evarname, defenv)
|
TEX_decode_env (char *evarname, char *defenv)
|
||||||
char *evarname;
|
|
||||||
char *defenv;
|
|
||||||
{
|
{
|
||||||
register char *env, *p;
|
register char *env, *p;
|
||||||
int i, len;
|
int i, len;
|
||||||
|
|
@ -5188,8 +5123,7 @@ TEX_decode_env (evarname, defenv)
|
||||||
|
|
||||||
/* Texinfo support. Dave Love, Mar. 2000. */
|
/* Texinfo support. Dave Love, Mar. 2000. */
|
||||||
static void
|
static void
|
||||||
Texinfo_nodes (inf)
|
Texinfo_nodes (FILE *inf)
|
||||||
FILE * inf;
|
|
||||||
{
|
{
|
||||||
char *cp, *start;
|
char *cp, *start;
|
||||||
LOOP_ON_INPUT_LINES (inf, lb, cp)
|
LOOP_ON_INPUT_LINES (inf, lb, cp)
|
||||||
|
|
@ -5212,8 +5146,7 @@ Texinfo_nodes (inf)
|
||||||
* Francesco Potortì, 2002.
|
* Francesco Potortì, 2002.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
HTML_labels (inf)
|
HTML_labels (FILE *inf)
|
||||||
FILE * inf;
|
|
||||||
{
|
{
|
||||||
bool getnext = FALSE; /* next text outside of HTML tags is a tag */
|
bool getnext = FALSE; /* next text outside of HTML tags is a tag */
|
||||||
bool skiptag = FALSE; /* skip to the end of the current HTML 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 int prolog_atom (char *, int);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
Prolog_functions (inf)
|
Prolog_functions (FILE *inf)
|
||||||
FILE *inf;
|
|
||||||
{
|
{
|
||||||
char *cp, *last;
|
char *cp, *last;
|
||||||
int len;
|
int len;
|
||||||
|
|
@ -5375,9 +5307,7 @@ Prolog_functions (inf)
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
prolog_skip_comment (plb, inf)
|
prolog_skip_comment (linebuffer *plb, FILE *inf)
|
||||||
linebuffer *plb;
|
|
||||||
FILE *inf;
|
|
||||||
{
|
{
|
||||||
char *cp;
|
char *cp;
|
||||||
|
|
||||||
|
|
@ -5403,9 +5333,9 @@ prolog_skip_comment (plb, inf)
|
||||||
* header was found.
|
* header was found.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
prolog_pr (s, last)
|
prolog_pr (char *s, char *last)
|
||||||
char *s;
|
|
||||||
char *last; /* Name of last clause. */
|
/* Name of last clause. */
|
||||||
{
|
{
|
||||||
int pos;
|
int pos;
|
||||||
int len;
|
int len;
|
||||||
|
|
@ -5441,9 +5371,7 @@ prolog_pr (s, last)
|
||||||
* Backslash quotes everything.
|
* Backslash quotes everything.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
prolog_atom (s, pos)
|
prolog_atom (char *s, int pos)
|
||||||
char *s;
|
|
||||||
int pos;
|
|
||||||
{
|
{
|
||||||
int origpos;
|
int origpos;
|
||||||
|
|
||||||
|
|
@ -5503,8 +5431,7 @@ static void erlang_attribute (char *);
|
||||||
static int erlang_atom (char *);
|
static int erlang_atom (char *);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
Erlang_functions (inf)
|
Erlang_functions (FILE *inf)
|
||||||
FILE *inf;
|
|
||||||
{
|
{
|
||||||
char *cp, *last;
|
char *cp, *last;
|
||||||
int len;
|
int len;
|
||||||
|
|
@ -5563,9 +5490,9 @@ Erlang_functions (inf)
|
||||||
* was found.
|
* was found.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
erlang_func (s, last)
|
erlang_func (char *s, char *last)
|
||||||
char *s;
|
|
||||||
char *last; /* Name of last clause. */
|
/* Name of last clause. */
|
||||||
{
|
{
|
||||||
int pos;
|
int pos;
|
||||||
int len;
|
int len;
|
||||||
|
|
@ -5601,8 +5528,7 @@ erlang_func (s, last)
|
||||||
* -record(graph, {vtab = notable, cyclic = true}).
|
* -record(graph, {vtab = notable, cyclic = true}).
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
erlang_attribute (s)
|
erlang_attribute (char *s)
|
||||||
char *s;
|
|
||||||
{
|
{
|
||||||
char *cp = s;
|
char *cp = s;
|
||||||
|
|
||||||
|
|
@ -5622,8 +5548,7 @@ erlang_attribute (s)
|
||||||
* Return the number of bytes consumed, or -1 if there was an error.
|
* Return the number of bytes consumed, or -1 if there was an error.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
erlang_atom (s)
|
erlang_atom (char *s)
|
||||||
char *s;
|
|
||||||
{
|
{
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
|
||||||
|
|
@ -5661,8 +5586,7 @@ static char *substitute (char *, char *, struct re_registers *);
|
||||||
* unterminated regexps.
|
* unterminated regexps.
|
||||||
*/
|
*/
|
||||||
static char *
|
static char *
|
||||||
scan_separators (name)
|
scan_separators (char *name)
|
||||||
char *name;
|
|
||||||
{
|
{
|
||||||
char sep = name[0];
|
char sep = name[0];
|
||||||
char *copyto = name;
|
char *copyto = name;
|
||||||
|
|
@ -5714,8 +5638,7 @@ scan_separators (name)
|
||||||
/* Look at the argument of --regex or --no-regex and do the right
|
/* Look at the argument of --regex or --no-regex and do the right
|
||||||
thing. Same for each line of a regexp file. */
|
thing. Same for each line of a regexp file. */
|
||||||
static void
|
static void
|
||||||
analyse_regex (regex_arg)
|
analyse_regex (char *regex_arg)
|
||||||
char *regex_arg;
|
|
||||||
{
|
{
|
||||||
if (regex_arg == NULL)
|
if (regex_arg == NULL)
|
||||||
{
|
{
|
||||||
|
|
@ -5786,9 +5709,7 @@ analyse_regex (regex_arg)
|
||||||
/* Separate the regexp pattern, compile it,
|
/* Separate the regexp pattern, compile it,
|
||||||
and care for optional name and modifiers. */
|
and care for optional name and modifiers. */
|
||||||
static void
|
static void
|
||||||
add_regex (regexp_pattern, lang)
|
add_regex (char *regexp_pattern, language *lang)
|
||||||
char *regexp_pattern;
|
|
||||||
language *lang;
|
|
||||||
{
|
{
|
||||||
static struct re_pattern_buffer zeropattern;
|
static struct re_pattern_buffer zeropattern;
|
||||||
char sep, *pat, *name, *modifiers;
|
char sep, *pat, *name, *modifiers;
|
||||||
|
|
@ -5905,9 +5826,7 @@ add_regex (regexp_pattern, lang)
|
||||||
* arguments.
|
* arguments.
|
||||||
*/
|
*/
|
||||||
static char *
|
static char *
|
||||||
substitute (in, out, regs)
|
substitute (char *in, char *out, struct re_registers *regs)
|
||||||
char *in, *out;
|
|
||||||
struct re_registers *regs;
|
|
||||||
{
|
{
|
||||||
char *result, *t;
|
char *result, *t;
|
||||||
int size, dig, diglen;
|
int size, dig, diglen;
|
||||||
|
|
@ -5954,7 +5873,7 @@ substitute (in, out, regs)
|
||||||
|
|
||||||
/* Deallocate all regexps. */
|
/* Deallocate all regexps. */
|
||||||
static void
|
static void
|
||||||
free_regexps ()
|
free_regexps (void)
|
||||||
{
|
{
|
||||||
regexp *rp;
|
regexp *rp;
|
||||||
while (p_head != NULL)
|
while (p_head != NULL)
|
||||||
|
|
@ -5976,7 +5895,7 @@ free_regexps ()
|
||||||
* Idea by Ben Wing <ben@666.com> (2002).
|
* Idea by Ben Wing <ben@666.com> (2002).
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
regex_tag_multiline ()
|
regex_tag_multiline (void)
|
||||||
{
|
{
|
||||||
char *buffer = filebuf.buffer;
|
char *buffer = filebuf.buffer;
|
||||||
regexp *rp;
|
regexp *rp;
|
||||||
|
|
@ -6053,8 +5972,7 @@ regex_tag_multiline ()
|
||||||
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
nocase_tail (cp)
|
nocase_tail (char *cp)
|
||||||
char *cp;
|
|
||||||
{
|
{
|
||||||
register int len = 0;
|
register int len = 0;
|
||||||
|
|
||||||
|
|
@ -6069,9 +5987,7 @@ nocase_tail (cp)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
get_tag (bp, namepp)
|
get_tag (register char *bp, char **namepp)
|
||||||
register char *bp;
|
|
||||||
char **namepp;
|
|
||||||
{
|
{
|
||||||
register char *cp = bp;
|
register char *cp = bp;
|
||||||
|
|
||||||
|
|
@ -6102,9 +6018,7 @@ get_tag (bp, namepp)
|
||||||
* appended to `filebuf'.
|
* appended to `filebuf'.
|
||||||
*/
|
*/
|
||||||
static long
|
static long
|
||||||
readline_internal (lbp, stream)
|
readline_internal (linebuffer *lbp, register FILE *stream)
|
||||||
linebuffer *lbp;
|
|
||||||
register FILE *stream;
|
|
||||||
{
|
{
|
||||||
char *buffer = lbp->buffer;
|
char *buffer = lbp->buffer;
|
||||||
register char *p = lbp->buffer;
|
register char *p = lbp->buffer;
|
||||||
|
|
@ -6182,9 +6096,7 @@ readline_internal (lbp, stream)
|
||||||
* directives.
|
* directives.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
readline (lbp, stream)
|
readline (linebuffer *lbp, FILE *stream)
|
||||||
linebuffer *lbp;
|
|
||||||
FILE *stream;
|
|
||||||
{
|
{
|
||||||
long result;
|
long result;
|
||||||
|
|
||||||
|
|
@ -6377,8 +6289,7 @@ readline (lbp, stream)
|
||||||
* with xnew where the string CP has been copied.
|
* with xnew where the string CP has been copied.
|
||||||
*/
|
*/
|
||||||
static char *
|
static char *
|
||||||
savestr (cp)
|
savestr (char *cp)
|
||||||
char *cp;
|
|
||||||
{
|
{
|
||||||
return savenstr (cp, strlen (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.
|
* the string CP has been copied for at most the first LEN characters.
|
||||||
*/
|
*/
|
||||||
static char *
|
static char *
|
||||||
savenstr (cp, len)
|
savenstr (char *cp, int len)
|
||||||
char *cp;
|
|
||||||
int len;
|
|
||||||
{
|
{
|
||||||
register char *dp;
|
register char *dp;
|
||||||
|
|
||||||
|
|
@ -6407,9 +6316,7 @@ savenstr (cp, len)
|
||||||
* Identical to POSIX strrchr, included for portability.
|
* Identical to POSIX strrchr, included for portability.
|
||||||
*/
|
*/
|
||||||
static char *
|
static char *
|
||||||
etags_strrchr (sp, c)
|
etags_strrchr (register const char *sp, register int c)
|
||||||
register const char *sp;
|
|
||||||
register int c;
|
|
||||||
{
|
{
|
||||||
register const char *r;
|
register const char *r;
|
||||||
|
|
||||||
|
|
@ -6429,9 +6336,7 @@ etags_strrchr (sp, c)
|
||||||
* Identical to POSIX strchr, included for portability.
|
* Identical to POSIX strchr, included for portability.
|
||||||
*/
|
*/
|
||||||
static char *
|
static char *
|
||||||
etags_strchr (sp, c)
|
etags_strchr (register const char *sp, register int c)
|
||||||
register const char *sp;
|
|
||||||
register int c;
|
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|
@ -6447,9 +6352,7 @@ etags_strchr (sp, c)
|
||||||
* Same as BSD's strcasecmp, included for portability.
|
* Same as BSD's strcasecmp, included for portability.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
etags_strcasecmp (s1, s2)
|
etags_strcasecmp (register const char *s1, register const char *s2)
|
||||||
register const char *s1;
|
|
||||||
register const char *s2;
|
|
||||||
{
|
{
|
||||||
while (*s1 != '\0'
|
while (*s1 != '\0'
|
||||||
&& (ISALPHA (*s1) && ISALPHA (*s2)
|
&& (ISALPHA (*s1) && ISALPHA (*s2)
|
||||||
|
|
@ -6469,10 +6372,7 @@ etags_strcasecmp (s1, s2)
|
||||||
* Same as BSD's strncasecmp, included for portability.
|
* Same as BSD's strncasecmp, included for portability.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
etags_strncasecmp (s1, s2, n)
|
etags_strncasecmp (register const char *s1, register const char *s2, register int n)
|
||||||
register const char *s1;
|
|
||||||
register const char *s2;
|
|
||||||
register int n;
|
|
||||||
{
|
{
|
||||||
while (*s1 != '\0' && n-- > 0
|
while (*s1 != '\0' && n-- > 0
|
||||||
&& (ISALPHA (*s1) && ISALPHA (*s2)
|
&& (ISALPHA (*s1) && ISALPHA (*s2)
|
||||||
|
|
@ -6490,8 +6390,7 @@ etags_strncasecmp (s1, s2, n)
|
||||||
|
|
||||||
/* Skip spaces (end of string is not space), return new pointer. */
|
/* Skip spaces (end of string is not space), return new pointer. */
|
||||||
static char *
|
static char *
|
||||||
skip_spaces (cp)
|
skip_spaces (char *cp)
|
||||||
char *cp;
|
|
||||||
{
|
{
|
||||||
while (iswhite (*cp))
|
while (iswhite (*cp))
|
||||||
cp++;
|
cp++;
|
||||||
|
|
@ -6500,8 +6399,7 @@ skip_spaces (cp)
|
||||||
|
|
||||||
/* Skip non spaces, except end of string, return new pointer. */
|
/* Skip non spaces, except end of string, return new pointer. */
|
||||||
static char *
|
static char *
|
||||||
skip_non_spaces (cp)
|
skip_non_spaces (char *cp)
|
||||||
char *cp;
|
|
||||||
{
|
{
|
||||||
while (*cp != '\0' && !iswhite (*cp))
|
while (*cp != '\0' && !iswhite (*cp))
|
||||||
cp++;
|
cp++;
|
||||||
|
|
@ -6510,23 +6408,21 @@ skip_non_spaces (cp)
|
||||||
|
|
||||||
/* Print error message and exit. */
|
/* Print error message and exit. */
|
||||||
void
|
void
|
||||||
fatal (s1, s2)
|
fatal (char *s1, char *s2)
|
||||||
char *s1, *s2;
|
|
||||||
{
|
{
|
||||||
error (s1, s2);
|
error (s1, s2);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pfatal (s1)
|
pfatal (char *s1)
|
||||||
char *s1;
|
|
||||||
{
|
{
|
||||||
perror (s1);
|
perror (s1);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
suggest_asking_for_help ()
|
suggest_asking_for_help (void)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "\tTry `%s %s' for a complete list of options.\n",
|
fprintf (stderr, "\tTry `%s %s' for a complete list of options.\n",
|
||||||
progname, NO_LONG_OPTIONS ? "-h" : "--help");
|
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. */
|
/* Print error message. `s1' is printf control string, `s2' is arg for it. */
|
||||||
static void
|
static void
|
||||||
error (s1, s2)
|
error (const char *s1, const char *s2)
|
||||||
const char *s1, *s2;
|
|
||||||
{
|
{
|
||||||
fprintf (stderr, "%s: ", progname);
|
fprintf (stderr, "%s: ", progname);
|
||||||
fprintf (stderr, s1, s2);
|
fprintf (stderr, s1, s2);
|
||||||
|
|
@ -6546,8 +6441,7 @@ error (s1, s2)
|
||||||
/* Return a newly-allocated string whose contents
|
/* Return a newly-allocated string whose contents
|
||||||
concatenate those of s1, s2, s3. */
|
concatenate those of s1, s2, s3. */
|
||||||
static char *
|
static char *
|
||||||
concat (s1, s2, s3)
|
concat (char *s1, char *s2, char *s3)
|
||||||
char *s1, *s2, *s3;
|
|
||||||
{
|
{
|
||||||
int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
|
int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
|
||||||
char *result = xnew (len1 + len2 + len3 + 1, char);
|
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
|
/* Does the same work as the system V getcwd, but does not need to
|
||||||
guess the buffer size in advance. */
|
guess the buffer size in advance. */
|
||||||
static char *
|
static char *
|
||||||
etags_getcwd ()
|
etags_getcwd (void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_GETCWD
|
#ifdef HAVE_GETCWD
|
||||||
int bufsize = 200;
|
int bufsize = 200;
|
||||||
|
|
@ -6614,8 +6508,7 @@ etags_getcwd ()
|
||||||
/* Return a newly allocated string containing the file name of FILE
|
/* Return a newly allocated string containing the file name of FILE
|
||||||
relative to the absolute directory DIR (which should end with a slash). */
|
relative to the absolute directory DIR (which should end with a slash). */
|
||||||
static char *
|
static char *
|
||||||
relative_filename (file, dir)
|
relative_filename (char *file, char *dir)
|
||||||
char *file, *dir;
|
|
||||||
{
|
{
|
||||||
char *fp, *dp, *afn, *res;
|
char *fp, *dp, *afn, *res;
|
||||||
int i;
|
int i;
|
||||||
|
|
@ -6654,8 +6547,7 @@ relative_filename (file, dir)
|
||||||
/* Return a newly allocated string containing the absolute file name
|
/* Return a newly allocated string containing the absolute file name
|
||||||
of FILE given DIR (which should end with a slash). */
|
of FILE given DIR (which should end with a slash). */
|
||||||
static char *
|
static char *
|
||||||
absolute_filename (file, dir)
|
absolute_filename (char *file, char *dir)
|
||||||
char *file, *dir;
|
|
||||||
{
|
{
|
||||||
char *slashp, *cp, *res;
|
char *slashp, *cp, *res;
|
||||||
|
|
||||||
|
|
@ -6728,8 +6620,7 @@ absolute_filename (file, dir)
|
||||||
file name of dir where FILE resides given DIR (which should
|
file name of dir where FILE resides given DIR (which should
|
||||||
end with a slash). */
|
end with a slash). */
|
||||||
static char *
|
static char *
|
||||||
absolute_dirname (file, dir)
|
absolute_dirname (char *file, char *dir)
|
||||||
char *file, *dir;
|
|
||||||
{
|
{
|
||||||
char *slashp, *res;
|
char *slashp, *res;
|
||||||
char save;
|
char save;
|
||||||
|
|
@ -6748,8 +6639,7 @@ absolute_dirname (file, dir)
|
||||||
/* Whether the argument string is an absolute file name. The argument
|
/* Whether the argument string is an absolute file name. The argument
|
||||||
string must have been canonicalized with canonicalize_filename. */
|
string must have been canonicalized with canonicalize_filename. */
|
||||||
static bool
|
static bool
|
||||||
filename_is_absolute (fn)
|
filename_is_absolute (char *fn)
|
||||||
char *fn;
|
|
||||||
{
|
{
|
||||||
return (fn[0] == '/'
|
return (fn[0] == '/'
|
||||||
#ifdef DOS_NT
|
#ifdef DOS_NT
|
||||||
|
|
@ -6761,8 +6651,7 @@ filename_is_absolute (fn)
|
||||||
/* Upcase DOS drive letter and collapse separators into single slashes.
|
/* Upcase DOS drive letter and collapse separators into single slashes.
|
||||||
Works in place. */
|
Works in place. */
|
||||||
static void
|
static void
|
||||||
canonicalize_filename (fn)
|
canonicalize_filename (register char *fn)
|
||||||
register char *fn;
|
|
||||||
{
|
{
|
||||||
register char* cp;
|
register char* cp;
|
||||||
char sep = '/';
|
char sep = '/';
|
||||||
|
|
@ -6791,8 +6680,7 @@ canonicalize_filename (fn)
|
||||||
|
|
||||||
/* Initialize a linebuffer for use. */
|
/* Initialize a linebuffer for use. */
|
||||||
static void
|
static void
|
||||||
linebuffer_init (lbp)
|
linebuffer_init (linebuffer *lbp)
|
||||||
linebuffer *lbp;
|
|
||||||
{
|
{
|
||||||
lbp->size = (DEBUG) ? 3 : 200;
|
lbp->size = (DEBUG) ? 3 : 200;
|
||||||
lbp->buffer = xnew (lbp->size, char);
|
lbp->buffer = xnew (lbp->size, char);
|
||||||
|
|
@ -6802,9 +6690,7 @@ linebuffer_init (lbp)
|
||||||
|
|
||||||
/* Set the minimum size of a string contained in a linebuffer. */
|
/* Set the minimum size of a string contained in a linebuffer. */
|
||||||
static void
|
static void
|
||||||
linebuffer_setlen (lbp, toksize)
|
linebuffer_setlen (linebuffer *lbp, int toksize)
|
||||||
linebuffer *lbp;
|
|
||||||
int toksize;
|
|
||||||
{
|
{
|
||||||
while (lbp->size <= toksize)
|
while (lbp->size <= toksize)
|
||||||
{
|
{
|
||||||
|
|
@ -6816,8 +6702,7 @@ linebuffer_setlen (lbp, toksize)
|
||||||
|
|
||||||
/* Like malloc but get fatal error if memory is exhausted. */
|
/* Like malloc but get fatal error if memory is exhausted. */
|
||||||
static PTR
|
static PTR
|
||||||
xmalloc (size)
|
xmalloc (unsigned int size)
|
||||||
unsigned int size;
|
|
||||||
{
|
{
|
||||||
PTR result = (PTR) malloc (size);
|
PTR result = (PTR) malloc (size);
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
|
|
@ -6826,9 +6711,7 @@ xmalloc (size)
|
||||||
}
|
}
|
||||||
|
|
||||||
static PTR
|
static PTR
|
||||||
xrealloc (ptr, size)
|
xrealloc (char *ptr, unsigned int size)
|
||||||
char *ptr;
|
|
||||||
unsigned int size;
|
|
||||||
{
|
{
|
||||||
PTR result = (PTR) realloc (ptr, size);
|
PTR result = (PTR) realloc (ptr, size);
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
|
|
|
||||||
|
|
@ -147,8 +147,8 @@ static line_list file_preface;
|
||||||
static stream_list the_streams;
|
static stream_list the_streams;
|
||||||
static boolean no_problems = true;
|
static boolean no_problems = true;
|
||||||
|
|
||||||
extern FILE *popen ();
|
extern FILE *popen (const char *, const char *);
|
||||||
extern int fclose (), pclose ();
|
extern int fclose (FILE *), pclose (FILE *);
|
||||||
|
|
||||||
#ifdef CURRENT_USER
|
#ifdef CURRENT_USER
|
||||||
extern struct passwd *getpwuid ();
|
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. */
|
/* Print error message. `s1' is printf control string, `s2' is arg for it. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
error (s1, s2)
|
error (char *s1, char *s2)
|
||||||
char *s1, *s2;
|
|
||||||
{
|
{
|
||||||
printf ("%s: ", my_name);
|
printf ("%s: ", my_name);
|
||||||
printf (s1, s2);
|
printf (s1, s2);
|
||||||
|
|
@ -176,8 +175,7 @@ error (s1, s2)
|
||||||
/* Print error message and exit. */
|
/* Print error message and exit. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fatal (s1)
|
fatal (char *s1)
|
||||||
char *s1;
|
|
||||||
{
|
{
|
||||||
error ("%s", s1);
|
error ("%s", s1);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
|
|
@ -186,8 +184,7 @@ fatal (s1)
|
||||||
/* Like malloc but get fatal error if memory is exhausted. */
|
/* Like malloc but get fatal error if memory is exhausted. */
|
||||||
|
|
||||||
static long *
|
static long *
|
||||||
xmalloc (size)
|
xmalloc (int size)
|
||||||
int size;
|
|
||||||
{
|
{
|
||||||
long *result = (long *) malloc (((unsigned) size));
|
long *result = (long *) malloc (((unsigned) size));
|
||||||
if (result == ((long *) NULL))
|
if (result == ((long *) NULL))
|
||||||
|
|
@ -196,9 +193,7 @@ xmalloc (size)
|
||||||
}
|
}
|
||||||
|
|
||||||
static long *
|
static long *
|
||||||
xrealloc (ptr, size)
|
xrealloc (long int *ptr, int size)
|
||||||
long *ptr;
|
|
||||||
int size;
|
|
||||||
{
|
{
|
||||||
long *result = (long *) realloc (ptr, ((unsigned) size));
|
long *result = (long *) realloc (ptr, ((unsigned) size));
|
||||||
if (result == ((long *) NULL))
|
if (result == ((long *) NULL))
|
||||||
|
|
@ -209,8 +204,7 @@ xrealloc (ptr, size)
|
||||||
/* Initialize a linebuffer for use */
|
/* Initialize a linebuffer for use */
|
||||||
|
|
||||||
void
|
void
|
||||||
init_linebuffer (linebuffer)
|
init_linebuffer (struct linebuffer *linebuffer)
|
||||||
struct linebuffer *linebuffer;
|
|
||||||
{
|
{
|
||||||
linebuffer->size = INITIAL_LINE_SIZE;
|
linebuffer->size = INITIAL_LINE_SIZE;
|
||||||
linebuffer->buffer = ((char *) xmalloc (INITIAL_LINE_SIZE));
|
linebuffer->buffer = ((char *) xmalloc (INITIAL_LINE_SIZE));
|
||||||
|
|
@ -220,9 +214,7 @@ init_linebuffer (linebuffer)
|
||||||
Return the length of the line. */
|
Return the length of the line. */
|
||||||
|
|
||||||
long
|
long
|
||||||
readline (linebuffer, stream)
|
readline (struct linebuffer *linebuffer, FILE *stream)
|
||||||
struct linebuffer *linebuffer;
|
|
||||||
FILE *stream;
|
|
||||||
{
|
{
|
||||||
char *buffer = linebuffer->buffer;
|
char *buffer = linebuffer->buffer;
|
||||||
char *p = 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. */
|
If there is no keyword, return NULL and don't alter *REST. */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
get_keyword (field, rest)
|
get_keyword (register char *field, char **rest)
|
||||||
register char *field;
|
|
||||||
char **rest;
|
|
||||||
{
|
{
|
||||||
static char keyword[KEYWORD_SIZE];
|
static char keyword[KEYWORD_SIZE];
|
||||||
register char *ptr;
|
register char *ptr;
|
||||||
|
|
@ -284,8 +274,7 @@ get_keyword (field, rest)
|
||||||
/* Nonzero if the string FIELD starts with a colon-terminated keyword. */
|
/* Nonzero if the string FIELD starts with a colon-terminated keyword. */
|
||||||
|
|
||||||
boolean
|
boolean
|
||||||
has_keyword (field)
|
has_keyword (char *field)
|
||||||
char *field;
|
|
||||||
{
|
{
|
||||||
char *ignored;
|
char *ignored;
|
||||||
return (get_keyword (field, &ignored) != ((char *) NULL));
|
return (get_keyword (field, &ignored) != ((char *) NULL));
|
||||||
|
|
@ -302,9 +291,7 @@ has_keyword (field)
|
||||||
the caller has to make it big enough. */
|
the caller has to make it big enough. */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
add_field (the_list, field, where)
|
add_field (line_list the_list, register char *field, register char *where)
|
||||||
line_list the_list;
|
|
||||||
register char *field, *where;
|
|
||||||
{
|
{
|
||||||
register char c;
|
register char c;
|
||||||
while (true)
|
while (true)
|
||||||
|
|
@ -360,7 +347,7 @@ add_field (the_list, field, where)
|
||||||
}
|
}
|
||||||
|
|
||||||
line_list
|
line_list
|
||||||
make_file_preface ()
|
make_file_preface (void)
|
||||||
{
|
{
|
||||||
char *the_string, *temp;
|
char *the_string, *temp;
|
||||||
long idiotic_interface;
|
long idiotic_interface;
|
||||||
|
|
@ -404,9 +391,7 @@ make_file_preface ()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
write_line_list (the_list, the_stream)
|
write_line_list (register line_list the_list, FILE *the_stream)
|
||||||
register line_list the_list;
|
|
||||||
FILE *the_stream;
|
|
||||||
{
|
{
|
||||||
for ( ;
|
for ( ;
|
||||||
the_list != ((line_list) NULL) ;
|
the_list != ((line_list) NULL) ;
|
||||||
|
|
@ -419,7 +404,7 @@ write_line_list (the_list, the_stream)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
close_the_streams ()
|
close_the_streams (void)
|
||||||
{
|
{
|
||||||
register stream_list rem;
|
register stream_list rem;
|
||||||
for (rem = the_streams;
|
for (rem = the_streams;
|
||||||
|
|
@ -432,9 +417,7 @@ close_the_streams ()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
add_a_stream (the_stream, closing_action)
|
add_a_stream (FILE *the_stream, int (*closing_action) (/* ??? */))
|
||||||
FILE *the_stream;
|
|
||||||
int (*closing_action)();
|
|
||||||
{
|
{
|
||||||
stream_list old = the_streams;
|
stream_list old = the_streams;
|
||||||
the_streams = new_stream ();
|
the_streams = new_stream ();
|
||||||
|
|
@ -445,8 +428,7 @@ add_a_stream (the_stream, closing_action)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
my_fclose (the_file)
|
my_fclose (FILE *the_file)
|
||||||
FILE *the_file;
|
|
||||||
{
|
{
|
||||||
putc ('\n', the_file);
|
putc ('\n', the_file);
|
||||||
fflush (the_file);
|
fflush (the_file);
|
||||||
|
|
@ -454,8 +436,7 @@ my_fclose (the_file)
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean
|
boolean
|
||||||
open_a_file (name)
|
open_a_file (char *name)
|
||||||
char *name;
|
|
||||||
{
|
{
|
||||||
FILE *the_stream = fopen (name, "a");
|
FILE *the_stream = fopen (name, "a");
|
||||||
if (the_stream != ((FILE *) NULL))
|
if (the_stream != ((FILE *) NULL))
|
||||||
|
|
@ -470,8 +451,7 @@ open_a_file (name)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
put_string (s)
|
put_string (char *s)
|
||||||
char *s;
|
|
||||||
{
|
{
|
||||||
register stream_list rem;
|
register stream_list rem;
|
||||||
for (rem = the_streams;
|
for (rem = the_streams;
|
||||||
|
|
@ -482,8 +462,7 @@ put_string (s)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
put_line (string)
|
put_line (char *string)
|
||||||
char *string;
|
|
||||||
{
|
{
|
||||||
register stream_list rem;
|
register stream_list rem;
|
||||||
for (rem = the_streams;
|
for (rem = the_streams;
|
||||||
|
|
@ -543,9 +522,7 @@ put_line (string)
|
||||||
Call open_a_file for each file. */
|
Call open_a_file for each file. */
|
||||||
|
|
||||||
void
|
void
|
||||||
setup_files (the_list, field)
|
setup_files (register line_list the_list, register char *field)
|
||||||
register line_list the_list;
|
|
||||||
register char *field;
|
|
||||||
{
|
{
|
||||||
register char *start;
|
register char *start;
|
||||||
register char c;
|
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. */
|
The result says how big to make the buffer to pass to parse_header. */
|
||||||
|
|
||||||
int
|
int
|
||||||
args_size (the_header)
|
args_size (header the_header)
|
||||||
header the_header;
|
|
||||||
{
|
{
|
||||||
register header old = the_header;
|
register header old = the_header;
|
||||||
register line_list rem;
|
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. */
|
Also, if the header has any FCC fields, call setup_files for each one. */
|
||||||
|
|
||||||
void
|
void
|
||||||
parse_header (the_header, where)
|
parse_header (header the_header, register char *where)
|
||||||
header the_header;
|
|
||||||
register char *where;
|
|
||||||
{
|
{
|
||||||
register header old = the_header;
|
register header old = the_header;
|
||||||
do
|
do
|
||||||
|
|
@ -647,7 +621,7 @@ parse_header (the_header, where)
|
||||||
Continuation lines are grouped in the headers they continue. */
|
Continuation lines are grouped in the headers they continue. */
|
||||||
|
|
||||||
header
|
header
|
||||||
read_header ()
|
read_header (void)
|
||||||
{
|
{
|
||||||
register header the_header = ((header) NULL);
|
register header the_header = ((header) NULL);
|
||||||
register line_list *next_line = ((line_list *) NULL);
|
register line_list *next_line = ((line_list *) NULL);
|
||||||
|
|
@ -701,8 +675,7 @@ read_header ()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
write_header (the_header)
|
write_header (header the_header)
|
||||||
header the_header;
|
|
||||||
{
|
{
|
||||||
register header old = the_header;
|
register header old = the_header;
|
||||||
do
|
do
|
||||||
|
|
@ -719,9 +692,7 @@ write_header (the_header)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (argc, argv)
|
main (int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
char *command_line;
|
char *command_line;
|
||||||
header the_header;
|
header the_header;
|
||||||
|
|
@ -731,7 +702,7 @@ main (argc, argv)
|
||||||
register int size;
|
register int size;
|
||||||
FILE *the_pipe;
|
FILE *the_pipe;
|
||||||
|
|
||||||
extern char *getenv ();
|
extern char *getenv (const char *);
|
||||||
|
|
||||||
mail_program_name = getenv ("FAKEMAILER");
|
mail_program_name = getenv ("FAKEMAILER");
|
||||||
if (!(mail_program_name && *mail_program_name))
|
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;
|
int group_by = DEFAULT_GROUPING;
|
||||||
char *progname;
|
char *progname;
|
||||||
|
|
||||||
void usage();
|
void usage(void);
|
||||||
|
|
||||||
int
|
int
|
||||||
main (argc, argv)
|
main (int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
register long address;
|
register long address;
|
||||||
char string[18];
|
char string[18];
|
||||||
|
|
@ -278,7 +276,7 @@ main (argc, argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
usage ()
|
usage (void)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "usage: %s [-de] [-iso]\n", progname);
|
fprintf (stderr, "usage: %s [-de] [-iso]\n", progname);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
|
|
|
||||||
|
|
@ -91,8 +91,7 @@ char *progname;
|
||||||
|
|
||||||
/* VARARGS1 */
|
/* VARARGS1 */
|
||||||
void
|
void
|
||||||
error (s1, s2)
|
error (char *s1, char *s2)
|
||||||
char *s1, *s2;
|
|
||||||
{
|
{
|
||||||
fprintf (stderr, "%s: ", progname);
|
fprintf (stderr, "%s: ", progname);
|
||||||
fprintf (stderr, s1, s2);
|
fprintf (stderr, s1, s2);
|
||||||
|
|
@ -103,8 +102,7 @@ error (s1, s2)
|
||||||
|
|
||||||
/* VARARGS1 */
|
/* VARARGS1 */
|
||||||
void
|
void
|
||||||
fatal (s1, s2)
|
fatal (char *s1, char *s2)
|
||||||
char *s1, *s2;
|
|
||||||
{
|
{
|
||||||
error (s1, s2);
|
error (s1, s2);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
|
|
@ -113,8 +111,7 @@ fatal (s1, s2)
|
||||||
/* Like malloc but get fatal error if memory is exhausted. */
|
/* Like malloc but get fatal error if memory is exhausted. */
|
||||||
|
|
||||||
void *
|
void *
|
||||||
xmalloc (size)
|
xmalloc (unsigned int size)
|
||||||
unsigned int size;
|
|
||||||
{
|
{
|
||||||
void *result = (void *) malloc (size);
|
void *result = (void *) malloc (size);
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
|
|
@ -123,9 +120,7 @@ xmalloc (size)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (argc, argv)
|
main (int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int err_count = 0;
|
int err_count = 0;
|
||||||
|
|
@ -187,8 +182,7 @@ main (argc, argv)
|
||||||
|
|
||||||
/* Add a source file name boundary marker in the output file. */
|
/* Add a source file name boundary marker in the output file. */
|
||||||
void
|
void
|
||||||
put_filename (filename)
|
put_filename (char *filename)
|
||||||
char *filename;
|
|
||||||
{
|
{
|
||||||
char *tmp;
|
char *tmp;
|
||||||
|
|
||||||
|
|
@ -207,8 +201,7 @@ put_filename (filename)
|
||||||
/* Return 1 if file is not found, 0 if it is found. */
|
/* Return 1 if file is not found, 0 if it is found. */
|
||||||
|
|
||||||
int
|
int
|
||||||
scan_file (filename)
|
scan_file (char *filename)
|
||||||
char *filename;
|
|
||||||
{
|
{
|
||||||
int len = strlen (filename);
|
int len = strlen (filename);
|
||||||
|
|
||||||
|
|
@ -251,9 +244,7 @@ struct rcsoc_state
|
||||||
spaces are output first. */
|
spaces are output first. */
|
||||||
|
|
||||||
static INLINE void
|
static INLINE void
|
||||||
put_char (ch, state)
|
put_char (int ch, struct rcsoc_state *state)
|
||||||
int ch;
|
|
||||||
struct rcsoc_state *state;
|
|
||||||
{
|
{
|
||||||
int out_ch;
|
int out_ch;
|
||||||
do
|
do
|
||||||
|
|
@ -286,9 +277,7 @@ put_char (ch, state)
|
||||||
keyword, but were in fact not. */
|
keyword, but were in fact not. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
scan_keyword_or_put_char (ch, state)
|
scan_keyword_or_put_char (int ch, struct rcsoc_state *state)
|
||||||
int ch;
|
|
||||||
struct rcsoc_state *state;
|
|
||||||
{
|
{
|
||||||
if (state->keyword
|
if (state->keyword
|
||||||
&& *state->cur_keyword_ptr == ch
|
&& *state->cur_keyword_ptr == ch
|
||||||
|
|
@ -359,11 +348,7 @@ scan_keyword_or_put_char (ch, state)
|
||||||
true if any were encountered. */
|
true if any were encountered. */
|
||||||
|
|
||||||
int
|
int
|
||||||
read_c_string_or_comment (infile, printflag, comment, saw_usage)
|
read_c_string_or_comment (FILE *infile, int printflag, int comment, int *saw_usage)
|
||||||
FILE *infile;
|
|
||||||
int printflag;
|
|
||||||
int *saw_usage;
|
|
||||||
int comment;
|
|
||||||
{
|
{
|
||||||
register int c;
|
register int c;
|
||||||
struct rcsoc_state state;
|
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. */
|
MINARGS and MAXARGS are the minimum and maximum number of arguments. */
|
||||||
|
|
||||||
void
|
void
|
||||||
write_c_args (out, func, buf, minargs, maxargs)
|
write_c_args (FILE *out, char *func, char *buf, int minargs, int maxargs)
|
||||||
FILE *out;
|
|
||||||
char *func, *buf;
|
|
||||||
int minargs, maxargs;
|
|
||||||
{
|
{
|
||||||
register char *p;
|
register char *p;
|
||||||
int in_ident = 0;
|
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. */
|
Accepts any word starting DEF... so it finds DEFSIMPLE and DEFPRED. */
|
||||||
|
|
||||||
int
|
int
|
||||||
scan_c_file (filename, mode)
|
scan_c_file (char *filename, char *mode)
|
||||||
char *filename, *mode;
|
|
||||||
{
|
{
|
||||||
FILE *infile;
|
FILE *infile;
|
||||||
register int c;
|
register int c;
|
||||||
|
|
@ -815,8 +796,7 @@ scan_c_file (filename, mode)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
skip_white (infile)
|
skip_white (FILE *infile)
|
||||||
FILE *infile;
|
|
||||||
{
|
{
|
||||||
char c = ' ';
|
char c = ' ';
|
||||||
while (c == ' ' || c == '\t' || c == '\n' || c == '\r')
|
while (c == ' ' || c == '\t' || c == '\n' || c == '\r')
|
||||||
|
|
@ -825,9 +805,7 @@ skip_white (infile)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
read_lisp_symbol (infile, buffer)
|
read_lisp_symbol (FILE *infile, char *buffer)
|
||||||
FILE *infile;
|
|
||||||
char *buffer;
|
|
||||||
{
|
{
|
||||||
char c;
|
char c;
|
||||||
char *fillp = buffer;
|
char *fillp = buffer;
|
||||||
|
|
@ -855,8 +833,7 @@ read_lisp_symbol (infile, buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
scan_lisp_file (filename, mode)
|
scan_lisp_file (char *filename, char *mode)
|
||||||
char *filename, *mode;
|
|
||||||
{
|
{
|
||||||
FILE *infile;
|
FILE *infile;
|
||||||
register int c;
|
register int c;
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@ static char *mail_spool_name ();
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char *strerror ();
|
char *strerror (int);
|
||||||
#ifdef HAVE_INDEX
|
#ifdef HAVE_INDEX
|
||||||
extern char *index (const char *, int);
|
extern char *index (const char *, int);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -148,25 +148,23 @@ extern char *index (const char *, int);
|
||||||
extern char *rindex (const char *, int);
|
extern char *rindex (const char *, int);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void fatal ();
|
void fatal (char *s1, char *s2, char *s3);
|
||||||
void error ();
|
void error (char *s1, char *s2, char *s3);
|
||||||
void pfatal_with_name ();
|
void pfatal_with_name (char *name);
|
||||||
void pfatal_and_delete ();
|
void pfatal_and_delete (char *name);
|
||||||
char *concat ();
|
char *concat (char *s1, char *s2, char *s3);
|
||||||
long *xmalloc ();
|
long *xmalloc (unsigned int size);
|
||||||
int popmail ();
|
int popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse_order);
|
||||||
int pop_retr ();
|
int pop_retr (popserver server, int msgno, FILE *arg);
|
||||||
int mbx_write ();
|
int mbx_write (char *line, int len, FILE *mbf);
|
||||||
int mbx_delimit_begin ();
|
int mbx_delimit_begin (FILE *mbf);
|
||||||
int mbx_delimit_end ();
|
int mbx_delimit_end (FILE *mbf);
|
||||||
|
|
||||||
/* Nonzero means this is name of a lock file to delete on fatal error. */
|
/* Nonzero means this is name of a lock file to delete on fatal error. */
|
||||||
char *delete_lockname;
|
char *delete_lockname;
|
||||||
|
|
||||||
int
|
int
|
||||||
main (argc, argv)
|
main (int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
char *inname, *outname;
|
char *inname, *outname;
|
||||||
int indesc, outdesc;
|
int indesc, outdesc;
|
||||||
|
|
@ -590,8 +588,7 @@ mail_spool_name (inname)
|
||||||
/* Print error message and exit. */
|
/* Print error message and exit. */
|
||||||
|
|
||||||
void
|
void
|
||||||
fatal (s1, s2, s3)
|
fatal (char *s1, char *s2, char *s3)
|
||||||
char *s1, *s2, *s3;
|
|
||||||
{
|
{
|
||||||
if (delete_lockname)
|
if (delete_lockname)
|
||||||
unlink (delete_lockname);
|
unlink (delete_lockname);
|
||||||
|
|
@ -603,8 +600,7 @@ fatal (s1, s2, s3)
|
||||||
are args for it or null. */
|
are args for it or null. */
|
||||||
|
|
||||||
void
|
void
|
||||||
error (s1, s2, s3)
|
error (char *s1, char *s2, char *s3)
|
||||||
char *s1, *s2, *s3;
|
|
||||||
{
|
{
|
||||||
fprintf (stderr, "movemail: ");
|
fprintf (stderr, "movemail: ");
|
||||||
if (s3)
|
if (s3)
|
||||||
|
|
@ -617,15 +613,13 @@ error (s1, s2, s3)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
pfatal_with_name (name)
|
pfatal_with_name (char *name)
|
||||||
char *name;
|
|
||||||
{
|
{
|
||||||
fatal ("%s for %s", strerror (errno), name);
|
fatal ("%s for %s", strerror (errno), name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
pfatal_and_delete (name)
|
pfatal_and_delete (char *name)
|
||||||
char *name;
|
|
||||||
{
|
{
|
||||||
char *s = strerror (errno);
|
char *s = strerror (errno);
|
||||||
unlink (name);
|
unlink (name);
|
||||||
|
|
@ -635,8 +629,7 @@ pfatal_and_delete (name)
|
||||||
/* Return a newly-allocated string whose contents concatenate those of s1, s2, s3. */
|
/* Return a newly-allocated string whose contents concatenate those of s1, s2, s3. */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
concat (s1, s2, s3)
|
concat (char *s1, char *s2, char *s3)
|
||||||
char *s1, *s2, *s3;
|
|
||||||
{
|
{
|
||||||
int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
|
int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
|
||||||
char *result = (char *) xmalloc (len1 + len2 + len3 + 1);
|
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. */
|
/* Like malloc but get fatal error if memory is exhausted. */
|
||||||
|
|
||||||
long *
|
long *
|
||||||
xmalloc (size)
|
xmalloc (unsigned int size)
|
||||||
unsigned size;
|
|
||||||
{
|
{
|
||||||
long *result = (long *) malloc (size);
|
long *result = (long *) malloc (size);
|
||||||
if (!result)
|
if (!result)
|
||||||
|
|
@ -703,18 +695,13 @@ char Errmsg[200]; /* POP errors, at least, can exceed
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
popmail (mailbox, outfile, preserve, password, reverse_order)
|
popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse_order)
|
||||||
char *mailbox;
|
|
||||||
char *outfile;
|
|
||||||
int preserve;
|
|
||||||
char *password;
|
|
||||||
int reverse_order;
|
|
||||||
{
|
{
|
||||||
int nmsgs, nbytes;
|
int nmsgs, nbytes;
|
||||||
register int i;
|
register int i;
|
||||||
int mbfi;
|
int mbfi;
|
||||||
FILE *mbf;
|
FILE *mbf;
|
||||||
char *getenv ();
|
char *getenv (const char *);
|
||||||
popserver server;
|
popserver server;
|
||||||
int start, end, increment;
|
int start, end, increment;
|
||||||
char *user, *hostname;
|
char *user, *hostname;
|
||||||
|
|
@ -834,12 +821,9 @@ popmail (mailbox, outfile, preserve, password, reverse_order)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
pop_retr (server, msgno, arg)
|
pop_retr (popserver server, int msgno, FILE *arg)
|
||||||
popserver server;
|
|
||||||
int msgno;
|
|
||||||
FILE *arg;
|
|
||||||
{
|
{
|
||||||
extern char *strerror ();
|
extern char *strerror (int);
|
||||||
char *line;
|
char *line;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
|
@ -885,10 +869,7 @@ pop_retr (server, msgno, arg)
|
||||||
&& (a[4] == ' '))
|
&& (a[4] == ' '))
|
||||||
|
|
||||||
int
|
int
|
||||||
mbx_write (line, len, mbf)
|
mbx_write (char *line, int len, FILE *mbf)
|
||||||
char *line;
|
|
||||||
int len;
|
|
||||||
FILE *mbf;
|
|
||||||
{
|
{
|
||||||
#ifdef MOVEMAIL_QUOTE_POP_FROM_LINES
|
#ifdef MOVEMAIL_QUOTE_POP_FROM_LINES
|
||||||
if (IS_FROM_LINE (line))
|
if (IS_FROM_LINE (line))
|
||||||
|
|
@ -912,8 +893,7 @@ mbx_write (line, len, mbf)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
mbx_delimit_begin (mbf)
|
mbx_delimit_begin (FILE *mbf)
|
||||||
FILE *mbf;
|
|
||||||
{
|
{
|
||||||
time_t now;
|
time_t now;
|
||||||
struct tm *ltime;
|
struct tm *ltime;
|
||||||
|
|
@ -930,8 +910,7 @@ mbx_delimit_begin (mbf)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
mbx_delimit_end (mbf)
|
mbx_delimit_end (FILE *mbf)
|
||||||
FILE *mbf;
|
|
||||||
{
|
{
|
||||||
if (putc ('\n', mbf) == EOF)
|
if (putc ('\n', mbf) == EOF)
|
||||||
return (NOTOK);
|
return (NOTOK);
|
||||||
|
|
|
||||||
105
lib-src/pop.c
105
lib-src/pop.c
|
|
@ -166,11 +166,7 @@ int pop_debug = 0;
|
||||||
* explanation of the error.
|
* explanation of the error.
|
||||||
*/
|
*/
|
||||||
popserver
|
popserver
|
||||||
pop_open (host, username, password, flags)
|
pop_open (char *host, char *username, char *password, int flags)
|
||||||
char *host;
|
|
||||||
char *username;
|
|
||||||
char *password;
|
|
||||||
int flags;
|
|
||||||
{
|
{
|
||||||
int sock;
|
int sock;
|
||||||
popserver server;
|
popserver server;
|
||||||
|
|
@ -337,10 +333,7 @@ pop_open (host, username, password, flags)
|
||||||
* connection impossible.
|
* connection impossible.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
pop_stat (server, count, size)
|
pop_stat (popserver server, int *count, int *size)
|
||||||
popserver server;
|
|
||||||
int *count;
|
|
||||||
int *size;
|
|
||||||
{
|
{
|
||||||
char *fromserver;
|
char *fromserver;
|
||||||
char *end_ptr;
|
char *end_ptr;
|
||||||
|
|
@ -413,11 +406,7 @@ pop_stat (server, count, size)
|
||||||
* connection impossible.
|
* connection impossible.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
pop_list (server, message, IDs, sizes)
|
pop_list (popserver server, int message, int **IDs, int **sizes)
|
||||||
popserver server;
|
|
||||||
int message;
|
|
||||||
int **IDs;
|
|
||||||
int **sizes;
|
|
||||||
{
|
{
|
||||||
int how_many, i;
|
int how_many, i;
|
||||||
char *fromserver;
|
char *fromserver;
|
||||||
|
|
@ -559,11 +548,7 @@ pop_list (server, message, IDs, sizes)
|
||||||
* Side effects: May kill connection on error.
|
* Side effects: May kill connection on error.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
pop_retrieve (server, message, markfrom, msg_buf)
|
pop_retrieve (popserver server, int message, int markfrom, char **msg_buf)
|
||||||
popserver server;
|
|
||||||
int message;
|
|
||||||
int markfrom;
|
|
||||||
char **msg_buf;
|
|
||||||
{
|
{
|
||||||
int *IDs, *sizes, bufsize, fromcount = 0, cp = 0;
|
int *IDs, *sizes, bufsize, fromcount = 0, cp = 0;
|
||||||
char *ptr, *fromserver;
|
char *ptr, *fromserver;
|
||||||
|
|
@ -637,10 +622,7 @@ pop_retrieve (server, message, markfrom, msg_buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
pop_retrieve_first (server, message, response)
|
pop_retrieve_first (popserver server, int message, char **response)
|
||||||
popserver server;
|
|
||||||
int message;
|
|
||||||
char **response;
|
|
||||||
{
|
{
|
||||||
sprintf (pop_error, "RETR %d", message);
|
sprintf (pop_error, "RETR %d", message);
|
||||||
return (pop_multi_first (server, pop_error, response));
|
return (pop_multi_first (server, pop_error, response));
|
||||||
|
|
@ -655,25 +637,19 @@ pop_retrieve_first (server, message, response)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
pop_retrieve_next (server, line)
|
pop_retrieve_next (popserver server, char **line)
|
||||||
popserver server;
|
|
||||||
char **line;
|
|
||||||
{
|
{
|
||||||
return (pop_multi_next (server, line));
|
return (pop_multi_next (server, line));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
pop_retrieve_flush (server)
|
pop_retrieve_flush (popserver server)
|
||||||
popserver server;
|
|
||||||
{
|
{
|
||||||
return (pop_multi_flush (server));
|
return (pop_multi_flush (server));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
pop_top_first (server, message, lines, response)
|
pop_top_first (popserver server, int message, int lines, char **response)
|
||||||
popserver server;
|
|
||||||
int message, lines;
|
|
||||||
char **response;
|
|
||||||
{
|
{
|
||||||
sprintf (pop_error, "TOP %d %d", message, lines);
|
sprintf (pop_error, "TOP %d %d", message, lines);
|
||||||
return (pop_multi_first (server, pop_error, response));
|
return (pop_multi_first (server, pop_error, response));
|
||||||
|
|
@ -688,25 +664,19 @@ pop_top_first (server, message, lines, response)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
pop_top_next (server, line)
|
pop_top_next (popserver server, char **line)
|
||||||
popserver server;
|
|
||||||
char **line;
|
|
||||||
{
|
{
|
||||||
return (pop_multi_next (server, line));
|
return (pop_multi_next (server, line));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
pop_top_flush (server)
|
pop_top_flush (popserver server)
|
||||||
popserver server;
|
|
||||||
{
|
{
|
||||||
return (pop_multi_flush (server));
|
return (pop_multi_flush (server));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
pop_multi_first (server, command, response)
|
pop_multi_first (popserver server, char *command, char **response)
|
||||||
popserver server;
|
|
||||||
char *command;
|
|
||||||
char **response;
|
|
||||||
{
|
{
|
||||||
if (server->in_multi)
|
if (server->in_multi)
|
||||||
{
|
{
|
||||||
|
|
@ -749,9 +719,7 @@ pop_multi_first (server, command, response)
|
||||||
0, LINE is set to null. */
|
0, LINE is set to null. */
|
||||||
|
|
||||||
int
|
int
|
||||||
pop_multi_next (server, line)
|
pop_multi_next (popserver server, char **line)
|
||||||
popserver server;
|
|
||||||
char **line;
|
|
||||||
{
|
{
|
||||||
char *fromserver;
|
char *fromserver;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
@ -789,8 +757,7 @@ pop_multi_next (server, line)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
pop_multi_flush (server)
|
pop_multi_flush (popserver server)
|
||||||
popserver server;
|
|
||||||
{
|
{
|
||||||
char *line;
|
char *line;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
@ -821,9 +788,7 @@ pop_multi_flush (server)
|
||||||
* otherwise.
|
* otherwise.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
pop_delete (server, message)
|
pop_delete (popserver server, int message)
|
||||||
popserver server;
|
|
||||||
int message;
|
|
||||||
{
|
{
|
||||||
if (server->in_multi)
|
if (server->in_multi)
|
||||||
{
|
{
|
||||||
|
|
@ -853,8 +818,7 @@ pop_delete (server, message)
|
||||||
* Side effects: Closes connection on error.
|
* Side effects: Closes connection on error.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
pop_noop (server)
|
pop_noop (popserver server)
|
||||||
popserver server;
|
|
||||||
{
|
{
|
||||||
if (server->in_multi)
|
if (server->in_multi)
|
||||||
{
|
{
|
||||||
|
|
@ -883,8 +847,7 @@ pop_noop (server)
|
||||||
* Side effects: Closes the connection on error.
|
* Side effects: Closes the connection on error.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
pop_last (server)
|
pop_last (popserver server)
|
||||||
popserver server;
|
|
||||||
{
|
{
|
||||||
char *fromserver;
|
char *fromserver;
|
||||||
|
|
||||||
|
|
@ -941,8 +904,7 @@ pop_last (server)
|
||||||
* Side effects: Closes the connection on error.
|
* Side effects: Closes the connection on error.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
pop_reset (server)
|
pop_reset (popserver server)
|
||||||
popserver server;
|
|
||||||
{
|
{
|
||||||
if (pop_retrieve_flush (server))
|
if (pop_retrieve_flush (server))
|
||||||
{
|
{
|
||||||
|
|
@ -970,8 +932,7 @@ pop_reset (server)
|
||||||
* function is called, even if an error occurs.
|
* function is called, even if an error occurs.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
pop_quit (server)
|
pop_quit (popserver server)
|
||||||
popserver server;
|
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
|
@ -1015,9 +976,7 @@ static int have_winsock = 0;
|
||||||
* into pop_error.
|
* into pop_error.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
socket_connection (host, flags)
|
socket_connection (char *host, int flags)
|
||||||
char *host;
|
|
||||||
int flags;
|
|
||||||
{
|
{
|
||||||
#ifdef HAVE_GETADDRINFO
|
#ifdef HAVE_GETADDRINFO
|
||||||
struct addrinfo *res, *it;
|
struct addrinfo *res, *it;
|
||||||
|
|
@ -1327,9 +1286,7 @@ socket_connection (host, flags)
|
||||||
* THE RETURNED LINE MAY CONTAIN EMBEDDED NULLS!
|
* THE RETURNED LINE MAY CONTAIN EMBEDDED NULLS!
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
pop_getline (server, line)
|
pop_getline (popserver server, char **line)
|
||||||
popserver server;
|
|
||||||
char **line;
|
|
||||||
{
|
{
|
||||||
#define GETLINE_ERROR "Error reading from server: "
|
#define GETLINE_ERROR "Error reading from server: "
|
||||||
|
|
||||||
|
|
@ -1459,9 +1416,7 @@ pop_getline (server, line)
|
||||||
* Side effects: Closes the connection on error.
|
* Side effects: Closes the connection on error.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
sendline (server, line)
|
sendline (popserver server, char *line)
|
||||||
popserver server;
|
|
||||||
char *line;
|
|
||||||
{
|
{
|
||||||
#define SENDLINE_ERROR "Error writing to POP server: "
|
#define SENDLINE_ERROR "Error writing to POP server: "
|
||||||
int ret;
|
int ret;
|
||||||
|
|
@ -1508,10 +1463,7 @@ sendline (server, line)
|
||||||
* Return value: Same as write. Pop_error is not set.
|
* Return value: Same as write. Pop_error is not set.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
fullwrite (fd, buf, nbytes)
|
fullwrite (int fd, char *buf, int nbytes)
|
||||||
int fd;
|
|
||||||
char *buf;
|
|
||||||
int nbytes;
|
|
||||||
{
|
{
|
||||||
char *cp;
|
char *cp;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
@ -1541,8 +1493,7 @@ fullwrite (fd, buf, nbytes)
|
||||||
* Side effects: On failure, may make the connection unusable.
|
* Side effects: On failure, may make the connection unusable.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
getok (server)
|
getok (popserver server)
|
||||||
popserver server;
|
|
||||||
{
|
{
|
||||||
char *fromline;
|
char *fromline;
|
||||||
|
|
||||||
|
|
@ -1613,8 +1564,7 @@ gettermination (server)
|
||||||
* since the last pop_reset) may be lost.
|
* since the last pop_reset) may be lost.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pop_close (server)
|
pop_close (popserver server)
|
||||||
popserver server;
|
|
||||||
{
|
{
|
||||||
pop_trash (server);
|
pop_trash (server);
|
||||||
free ((char *) server);
|
free ((char *) server);
|
||||||
|
|
@ -1630,8 +1580,7 @@ pop_close (server)
|
||||||
* pop_close or pop_quit after this function has been called.
|
* pop_close or pop_quit after this function has been called.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pop_trash (server)
|
pop_trash (popserver server)
|
||||||
popserver server;
|
|
||||||
{
|
{
|
||||||
if (server->file >= 0)
|
if (server->file >= 0)
|
||||||
{
|
{
|
||||||
|
|
@ -1663,9 +1612,7 @@ pop_trash (server)
|
||||||
null, or 0 if it does not contain one. */
|
null, or 0 if it does not contain one. */
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
find_crlf (in_string, len)
|
find_crlf (char *in_string, int len)
|
||||||
char *in_string;
|
|
||||||
int len;
|
|
||||||
{
|
{
|
||||||
while (len--)
|
while (len--)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ static char time_string[30];
|
||||||
/* Reset the stopwatch to zero. */
|
/* Reset the stopwatch to zero. */
|
||||||
|
|
||||||
void
|
void
|
||||||
reset_watch ()
|
reset_watch (void)
|
||||||
{
|
{
|
||||||
EMACS_GET_TIME (TV1);
|
EMACS_GET_TIME (TV1);
|
||||||
watch_not_started = 0;
|
watch_not_started = 0;
|
||||||
|
|
@ -51,7 +51,7 @@ reset_watch ()
|
||||||
If reset_watch was not called yet, exit. */
|
If reset_watch was not called yet, exit. */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
get_time ()
|
get_time (void)
|
||||||
{
|
{
|
||||||
if (watch_not_started)
|
if (watch_not_started)
|
||||||
exit (EXIT_FAILURE); /* call reset_watch first ! */
|
exit (EXIT_FAILURE); /* call reset_watch first ! */
|
||||||
|
|
@ -79,7 +79,7 @@ gettimeofday (tp, tzp)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
main ()
|
main (void)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
while ((c = getchar ()) != EOF)
|
while ((c = getchar ()) != EOF)
|
||||||
|
|
|
||||||
|
|
@ -65,8 +65,7 @@ struct docstr /* Allocated thing for an entry. */
|
||||||
/* Print error message. `s1' is printf control string, `s2' is arg for it. */
|
/* Print error message. `s1' is printf control string, `s2' is arg for it. */
|
||||||
|
|
||||||
void
|
void
|
||||||
error (s1, s2)
|
error (char *s1, char *s2)
|
||||||
char *s1, *s2;
|
|
||||||
{
|
{
|
||||||
fprintf (stderr, "sorted-doc: ");
|
fprintf (stderr, "sorted-doc: ");
|
||||||
fprintf (stderr, s1, s2);
|
fprintf (stderr, s1, s2);
|
||||||
|
|
@ -76,8 +75,7 @@ error (s1, s2)
|
||||||
/* Print error message and exit. */
|
/* Print error message and exit. */
|
||||||
|
|
||||||
void
|
void
|
||||||
fatal (s1, s2)
|
fatal (char *s1, char *s2)
|
||||||
char *s1, *s2;
|
|
||||||
{
|
{
|
||||||
error (s1, s2);
|
error (s1, s2);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
|
|
@ -86,8 +84,7 @@ fatal (s1, s2)
|
||||||
/* Like malloc but get fatal error if memory is exhausted. */
|
/* Like malloc but get fatal error if memory is exhausted. */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
xmalloc (size)
|
xmalloc (int size)
|
||||||
int size;
|
|
||||||
{
|
{
|
||||||
char *result = malloc ((unsigned)size);
|
char *result = malloc ((unsigned)size);
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
|
|
@ -96,8 +93,7 @@ xmalloc (size)
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
xstrdup (str)
|
xstrdup (char *str)
|
||||||
char * str;
|
|
||||||
{
|
{
|
||||||
char *buf = xmalloc (strlen (str) + 1);
|
char *buf = xmalloc (strlen (str) + 1);
|
||||||
(void) strcpy (buf, str);
|
(void) strcpy (buf, str);
|
||||||
|
|
@ -107,9 +103,7 @@ xstrdup (str)
|
||||||
/* Comparison function for qsort to call. */
|
/* Comparison function for qsort to call. */
|
||||||
|
|
||||||
int
|
int
|
||||||
cmpdoc (a, b)
|
cmpdoc (DOCSTR **a, DOCSTR **b)
|
||||||
DOCSTR **a;
|
|
||||||
DOCSTR **b;
|
|
||||||
{
|
{
|
||||||
register int val = strcmp ((*a)->name, (*b)->name);
|
register int val = strcmp ((*a)->name, (*b)->name);
|
||||||
if (val) return val;
|
if (val) return val;
|
||||||
|
|
@ -128,7 +122,7 @@ char *states[] =
|
||||||
};
|
};
|
||||||
|
|
||||||
int
|
int
|
||||||
main ()
|
main (void)
|
||||||
{
|
{
|
||||||
register DOCSTR *dp = NULL; /* allocated DOCSTR */
|
register DOCSTR *dp = NULL; /* allocated DOCSTR */
|
||||||
register LINE *lp = NULL; /* allocated line */
|
register LINE *lp = NULL; /* allocated line */
|
||||||
|
|
|
||||||
|
|
@ -77,8 +77,7 @@ extern int optind, opterr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
usage (err)
|
usage (int err)
|
||||||
int err;
|
|
||||||
{
|
{
|
||||||
fprintf (stdout, "Usage: update-game-score [-m MAX ] [ -r ] game/scorefile SCORE DATA\n");
|
fprintf (stdout, "Usage: update-game-score [-m MAX ] [ -r ] game/scorefile SCORE DATA\n");
|
||||||
fprintf (stdout, " update-game-score -h\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 (const char *msg) NO_RETURN;
|
||||||
|
|
||||||
void
|
void
|
||||||
lose (msg)
|
lose (const char *msg)
|
||||||
const char *msg;
|
|
||||||
{
|
{
|
||||||
fprintf (stderr, "%s\n", msg);
|
fprintf (stderr, "%s\n", msg);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
|
|
@ -137,8 +135,7 @@ strerror (errnum)
|
||||||
#endif /* ! HAVE_STRERROR */
|
#endif /* ! HAVE_STRERROR */
|
||||||
|
|
||||||
void
|
void
|
||||||
lose_syserr (msg)
|
lose_syserr (const char *msg)
|
||||||
const char *msg;
|
|
||||||
{
|
{
|
||||||
fprintf (stderr, "%s: %s\n", msg, strerror (errno));
|
fprintf (stderr, "%s: %s\n", msg, strerror (errno));
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
|
|
@ -166,9 +163,7 @@ get_user_id (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
get_prefix (running_suid, user_prefix)
|
get_prefix (int running_suid, char *user_prefix)
|
||||||
int running_suid;
|
|
||||||
char *user_prefix;
|
|
||||||
{
|
{
|
||||||
if (!running_suid && user_prefix == NULL)
|
if (!running_suid && user_prefix == NULL)
|
||||||
lose ("Not using a shared game directory, and no prefix given.");
|
lose ("Not using a shared game directory, and no prefix given.");
|
||||||
|
|
@ -184,9 +179,7 @@ get_prefix (running_suid, user_prefix)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (argc, argv)
|
main (int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
int c, running_suid;
|
int c, running_suid;
|
||||||
void *lockstate;
|
void *lockstate;
|
||||||
|
|
@ -273,9 +266,7 @@ main (argc, argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
read_score (f, score)
|
read_score (FILE *f, struct score_entry *score)
|
||||||
FILE *f;
|
|
||||||
struct score_entry *score;
|
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
if (feof (f))
|
if (feof (f))
|
||||||
|
|
@ -359,10 +350,7 @@ read_score (f, score)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
read_scores (filename, scores, count)
|
read_scores (const char *filename, struct score_entry **scores, int *count)
|
||||||
const char *filename;
|
|
||||||
struct score_entry **scores;
|
|
||||||
int *count;
|
|
||||||
{
|
{
|
||||||
int readval, scorecount, cursize;
|
int readval, scorecount, cursize;
|
||||||
struct score_entry *ret;
|
struct score_entry *ret;
|
||||||
|
|
@ -395,9 +383,7 @@ read_scores (filename, scores, count)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
score_compare (a, b)
|
score_compare (const void *a, const void *b)
|
||||||
const void *a;
|
|
||||||
const void *b;
|
|
||||||
{
|
{
|
||||||
const struct score_entry *sa = (const struct score_entry *) a;
|
const struct score_entry *sa = (const struct score_entry *) a;
|
||||||
const struct score_entry *sb = (const struct score_entry *) b;
|
const struct score_entry *sb = (const struct score_entry *) b;
|
||||||
|
|
@ -405,9 +391,7 @@ score_compare (a, b)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
score_compare_reverse (a, b)
|
score_compare_reverse (const void *a, const void *b)
|
||||||
const void *a;
|
|
||||||
const void *b;
|
|
||||||
{
|
{
|
||||||
const struct score_entry *sa = (const struct score_entry *) a;
|
const struct score_entry *sa = (const struct score_entry *) a;
|
||||||
const struct score_entry *sb = (const struct score_entry *) b;
|
const struct score_entry *sb = (const struct score_entry *) b;
|
||||||
|
|
@ -415,11 +399,7 @@ score_compare_reverse (a, b)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
push_score (scores, count, newscore, username, newdata)
|
push_score (struct score_entry **scores, int *count, int newscore, char *username, char *newdata)
|
||||||
struct score_entry **scores;
|
|
||||||
int *count; int newscore;
|
|
||||||
char *username;
|
|
||||||
char *newdata;
|
|
||||||
{
|
{
|
||||||
struct score_entry *newscores
|
struct score_entry *newscores
|
||||||
= (struct score_entry *) realloc (*scores,
|
= (struct score_entry *) realloc (*scores,
|
||||||
|
|
@ -435,20 +415,14 @@ push_score (scores, count, newscore, username, newdata)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sort_scores (scores, count, reverse)
|
sort_scores (struct score_entry *scores, int count, int reverse)
|
||||||
struct score_entry *scores;
|
|
||||||
int count;
|
|
||||||
int reverse;
|
|
||||||
{
|
{
|
||||||
qsort (scores, count, sizeof (struct score_entry),
|
qsort (scores, count, sizeof (struct score_entry),
|
||||||
reverse ? score_compare_reverse : score_compare);
|
reverse ? score_compare_reverse : score_compare);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
write_scores (filename, scores, count)
|
write_scores (const char *filename, const struct score_entry *scores, int count)
|
||||||
const char *filename;
|
|
||||||
const struct score_entry * scores;
|
|
||||||
int count;
|
|
||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
int i;
|
int i;
|
||||||
|
|
@ -477,9 +451,7 @@ write_scores (filename, scores, count)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
lock_file (filename, state)
|
lock_file (const char *filename, void **state)
|
||||||
const char *filename;
|
|
||||||
void **state;
|
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
|
|
@ -520,9 +492,7 @@ lock_file (filename, state)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
unlock_file (filename, state)
|
unlock_file (const char *filename, void *state)
|
||||||
const char *filename;
|
|
||||||
void *state;
|
|
||||||
{
|
{
|
||||||
char *lockpath = (char *) state;
|
char *lockpath = (char *) state;
|
||||||
int ret = unlink (lockpath);
|
int ret = unlink (lockpath);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue