**
**/
-#if HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-
-#include <errno.h>
-#include <lib-lib/str.h>
-
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
+#include <lib-lib/lib-lib.h>
#ifdef HAVE_GETOPT_H
# include <getopt.h>
enum output_formats_t OutputFormat = F_NONE;
char *Progname;
-short Debug = 0;
static char *get_token (char *, size_t, char *);
static char *skip_ws (char *);
case 's':
OutputFormat = F_SGML;
break;
- case 'd':
- Debug++;
- break;
default:
{
fprintf (stderr, "%s: bad command line parameter.\n", Progname);
}
if (f != stdin)
- fclose (f);
+ m_fclose(&f);
exit (1);
}
if (!(p = get_token (token, sizeof (token), buffer)))
continue;
- if (Debug) {
- fprintf (stderr, "%s: line %d. first token: \"%s\".\n",
- Progname, line, token);
- }
-
if (!strcmp (token, "/*++*/"))
active = 1;
else if (!strcmp (token, "/*--*/")) {
short is_quoted = 0;
char *dd = d;
- if (Debug)
- fprintf (stderr, "%s: get_token called for `%s'.\n", Progname, s);
-
s = skip_ws (s);
- if (Debug > 1)
- fprintf (stderr, "%s: argumet after skip_ws(): `%s'.\n", Progname, s);
-
if (!*s) {
- if (Debug)
- fprintf (stderr, "%s: no more tokens on this line.\n", Progname);
return NULL;
}
if (strchr (single_char_tokens, *s)) {
- if (Debug) {
- fprintf (stderr, "%s: found single character token `%c'.\n",
- Progname, *s);
- }
d[0] = *s++;
d[1] = 0;
return s;
}
if (*s == '"') {
- if (Debug) {
- fprintf (stderr, "%s: found quote character.\n", Progname);
- }
-
s++;
is_quoted = 1;
}
*d = '\0';
- if (Debug) {
- fprintf (stderr, "%s: Got %stoken: `%s'.\n",
- Progname, is_quoted ? "quoted " : "", dd);
- fprintf (stderr, "%s: Remainder: `%s'.\n", Progname, t);
- }
-
return t;
}
return;
if (!strcmp (buff, "|")) {
- if (Debug)
- fprintf (stderr, "%s: Expecting <subtype> <comma>.\n", Progname);
/* ignore subtype and comma */
if (!(s = get_token (buff, sizeof (buff), s)))
return;
if (!(s = get_token (buff, sizeof (buff), s)))
return;
- if (Debug)
- fprintf (stderr, "%s: Expecting default value.\n", Progname);
-
/* <default value> or UL <default value> */
if (!(s = get_token (buff, sizeof (buff), s)))
return;
if (!strcmp (buff, "UL")) {
- if (Debug)
- fprintf (stderr, "%s: Skipping UL.\n", Progname);
if (!(s = get_token (buff, sizeof (buff), s)))
return;
}
l = skip_ws (l);
- if (Debug)
- fprintf (stderr, "%s: handle_docline `%s'\n", Progname, l);
-
if (!strncmp (l, ".pp", 3))
return print_it (SP_NEWPAR, NULL, docstat);
else if (!strncmp (l, ".ts", 3))