static void print_confline (const char *, int, const char *);
static void handle_confline (char *);
static void makedoc (FILE *, FILE *);
-static void pretty_default (char *, size_t, const char *, int);
static int sgml_fputc (int);
static int sgml_fputs (const char *);
static void add_var (const char *);
DT_RX,
DT_MAGIC,
DT_SYN,
- DT_ADDR
+ DT_ADDR,
+ DT_SYS
};
struct {
"DT_MAGIC", "folder magic"}, {
"DT_SYN", NULL}, {
"DT_ADDR", "e-mail address"}, {
+ "DT_SYS", "system property"}, {
NULL, NULL}
};
{
char varname[BUFFSIZE];
char buff[BUFFSIZE];
- char tmp[BUFFSIZE];
int type;
char val[BUFFSIZE];
return;
}
- memset (tmp, 0, sizeof (tmp));
+ memset (val, 0, sizeof (val));
do {
if (!strcmp (buff, "}"))
break;
- strncpy (tmp + STRLEN (tmp), buff, sizeof (tmp) - STRLEN (tmp));
+ strncpy (val + STRLEN (val), buff, sizeof (val) - STRLEN (val));
}
while ((s = get_token (buff, sizeof (buff), s)));
- pretty_default (val, sizeof (val), tmp, type);
add_var (varname);
print_confline (varname, type, val);
}
-static void pretty_default (char *t, size_t l, const char *s, int type)
-{
- memset (t, 0, l);
- l--;
-
- switch (type) {
- case DT_QUAD:
- {
- if (!strcasecmp (s, "M_YES"))
- strncpy (t, "yes", l);
- else if (!strcasecmp (s, "M_NO"))
- strncpy (t, "no", l);
- else if (!strcasecmp (s, "M_ASKYES"))
- strncpy (t, "ask-yes", l);
- else if (!strcasecmp (s, "M_ASKNO"))
- strncpy (t, "ask-no", l);
- break;
- }
- case DT_BOOL:
- {
- if (atoi (s))
- strncpy (t, "yes", l);
- else
- strncpy (t, "no", l);
- break;
- }
- case DT_SORT:
- {
- /* heuristic! */
- strncpy (t, s + 5, l);
- for (; *t; t++)
- *t = tolower ((unsigned char) *t);
- break;
- }
- case DT_MAGIC:
- {
- /* heuristic! */
- strncpy (t, s + 2, l);
- for (; *t; t++)
- *t = tolower ((unsigned char) *t);
- break;
- }
- case DT_STR:
- case DT_RX:
- case DT_ADDR:
- case DT_PATH:
- {
- if (!strcmp (s, "0"))
- break;
- /* fallthrough */
- }
- default:
- {
- strncpy (t, s, l);
- break;
- }
- }
-}
-
static void char_to_escape (char *dest, unsigned int c)
{
switch (c) {
/* configuration file */
case F_CONF:
{
+ if (type == DT_SYS) {
+ add_s ("\n# set ?");
+ add_s (varname);
+ add_s (" prints ");
+ add_s (val);
+ break;
+ }
if (type == DT_STR || type == DT_RX || type == DT_ADDR
|| type == DT_PATH) {
add_s ("\n# set ");
add_s ("\\(rq\n");
}
else {
- add_s ("Default: ");
+ add_s (type == DT_SYS ? "Value: " : "Default: ");
add_s (val);
add_c ('\n');
}
add_s ("&dquot;</tt>");
}
else {
- add_s ("<p>\nDefault: <tt>");
+ add_s ("<p>\n");
+ add_s (type == DT_SYS ? "Value: " : "Default: ");
+ add_s ("<tt>");
add_s (val);
add_s ("</tt>");
}