- 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)
- {
- case '\r': strcpy (dest, "\\r"); break; /* __STRCPY_CHECKED__ */
- case '\n': strcpy (dest, "\\n"); break; /* __STRCPY_CHECKED__ */
- case '\t': strcpy (dest, "\\t"); break; /* __STRCPY_CHECKED__ */
- case '\f': strcpy (dest, "\\f"); break; /* __STRCPY_CHECKED__ */
- default: sprintf (dest, "\\%03o", c); break;
+ switch (c) {
+ case '\r':
+ m_strcpy(dest, len, "\\r");
+ break;
+ case '\n':
+ m_strcpy(dest, len, "\\n");
+ break;
+ case '\t':
+ m_strcpy(dest, len, "\\t");
+ break;
+ case '\f':
+ m_strcpy(dest, len, "\\f");
+ break;
+ default:
+ sprintf (dest, len, "\\%03o", c);
+ break;