X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=makedoc.c;h=69df277978a543bdb1f97f93e3242fb01d03ff9c;hp=004d68b77a10c8c84c475b31012805d5202bbccb;hb=408bb2f4e5bd18dc15627f1cd5dc6ffb741a08b6;hpb=81efbf8081bad2eed7ad07209b301ca35fe183e8 diff --git a/makedoc.c b/makedoc.c index 004d68b..69df277 100644 --- a/makedoc.c +++ b/makedoc.c @@ -27,21 +27,6 @@ # include #endif -#ifndef HAVE_STRERROR -#ifndef STDC_HEADERS -extern int sys_nerr; -extern char *sys_errlist[]; -#endif - -#define strerror(x) ((x) > 0 && (x) < sys_nerr) ? sys_errlist[(x)] : 0 -#endif /* !HAVE_STRERROR */ - -extern int optind; - -#define BUFFSIZE 2048 - -#define STRLEN(s) (s ? strlen(s) : 0) - typedef struct { short seen; char *name; @@ -180,7 +165,7 @@ static void add_var (const char *name) static int add_s (const char *s) { - size_t lnew = STRLEN (s), lold = STRLEN (outbuf[outcount - 1].descr); + size_t lnew = m_strlen(s), lold = m_strlen(outbuf[outcount - 1].descr); if (lnew == 0) return (0); @@ -210,8 +195,8 @@ static int add_c (int c) static void makedoc (FILE * in, FILE * out) { - char buffer[BUFFSIZE]; - char token[BUFFSIZE]; + char buffer[BUFSIZ]; + char token[BUFSIZ]; char *p; int active = 0; int line = 0; @@ -274,7 +259,6 @@ static char *get_token (char *d, size_t l, char *s) { char *t; short is_quoted = 0; - char *dd = d; s = skip_ws (s); @@ -363,26 +347,24 @@ enum { }; struct { - char *machine; - char *human; + const char *machine; + const char *human; } types[] = { - { - "DT_NONE", "-none-"}, { - "DT_BOOL", "boolean"}, { - "DT_NUM", "number"}, { - "DT_STR", "string"}, { - "DT_PATH", "path"}, { - "DT_QUAD", "quadoption"}, { - "DT_SORT", "sort order"}, { - "DT_RX", "regular expression"}, { - "DT_MAGIC", "folder magic"}, { - "DT_SYN", NULL}, { - "DT_ADDR", "e-mail address"}, { - "DT_SYS", "system property"}, { - NULL, NULL} + {"DT_NONE", "-none-"}, + {"DT_BOOL", "boolean"}, + {"DT_NUM", "number"}, + {"DT_STR", "string"}, + {"DT_PATH", "path"}, + {"DT_QUAD", "quadoption"}, + {"DT_SORT", "sort order"}, + {"DT_RX", "regular expression"}, + {"DT_MAGIC", "folder magic"}, + {"DT_SYN", NULL}, + {"DT_ADDR", "e-mail address"}, + {"DT_SYS", "system property"}, + {NULL, NULL} }; - static int buff2type (const char *s) { int type; @@ -400,11 +382,11 @@ static const char *type2human (int type) } static void handle_confline (char *s) { - char varname[BUFFSIZE]; - char buff[BUFFSIZE]; + char varname[BUFSIZ]; + char buff[BUFSIZ]; int type; - char val[BUFFSIZE]; + char val[BUFSIZ]; /* xxx - put this into an actual state machine? */ @@ -557,28 +539,8 @@ static int sgml_fputc (int c) return add_s ("<"); case '>': return add_s (">"); -#if 0 - case '$': - return add_s ("$"); - case '_': - return add_s ("_"); - case '%': - return add_s ("%"); -#endif case '&': return add_s ("&"); -#if 0 - case '\\': - return add_s ("\"); - case '"': - return add_s ("""); - case '[': - return add_s ("["); - case ']': - return add_s ("]"); - case '~': - return add_s ("˜"); -#endif default: return add_c (c); } @@ -873,7 +835,7 @@ static int print_it (int special, char *str, int docstat) if (docstat & D_DT) { int i; - for (i = STRLEN (str); i < 8; i++) + for (i = m_strlen(str); i < 8; i++) add_c (' '); docstat &= ~D_DT; docstat |= D_NL; @@ -1134,7 +1096,7 @@ static int print_it (int special, char *str, int docstat) return docstat; } -void print_ref (int output_dollar, const char *ref) +static void print_ref (int output_dollar, const char *ref) { switch (OutputFormat) { case F_CONF: @@ -1172,7 +1134,7 @@ static int commit_buff (char *buff, char **d, int docstat) static int handle_docline (char *l, int docstat) { - char buff[BUFFSIZE]; + char buff[BUFSIZ]; char *s, *d; l = skip_ws (l);