c_locale_dummy.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  1. /*
  2. * Copyright (c) 1999
  3. * Silicon Graphics Computer Systems, Inc.
  4. *
  5. * Copyright (c) 1999
  6. * Boris Fomitchev
  7. *
  8. * This material is provided "as is", with absolutely no warranty expressed
  9. * or implied. Any use is at your own risk.
  10. *
  11. * Permission to use or copy this software for any purpose is hereby granted
  12. * without fee, provided the above notices are retained on all copies.
  13. * Permission to modify the code and to distribute modified code is granted,
  14. * provided the above notices are retained, and a notice that the code was
  15. * modified is included with the above copyright notice.
  16. *
  17. */
  18. /* This is a "stub" implementation of the "c_locale.h" interface,
  19. intended for operating systems where we have not yet written
  20. a real implementation. A C++ library using this stub implementation
  21. is still standard-conforming, since the C++ standard does not require
  22. that any locales other than "C" be supported.
  23. */
  24. #include <string.h>
  25. #include <wchar.h>
  26. #include <ctype.h>
  27. #include <wctype.h>
  28. #include <limits.h>
  29. #if defined (_STLP_USE_SAFE_STRING_FUNCTIONS)
  30. # define _STLP_STRNCPY(D, DS, S, C) strncpy_s(D, DS, S, C)
  31. # if !defined (_STLP_NO_WCHAR_T)
  32. # define _STLP_WCSNCPY(D, DS, S, C) wcsncpy_s(D, DS, S, C)
  33. # endif
  34. #else
  35. # define _STLP_STRNCPY(D, DS, S, C) strncpy(D, S, C)
  36. # if !defined (_STLP_NO_WCHAR_T)
  37. # define _STLP_WCSNCPY(D, DS, S, C) wcsncpy(D, S, C)
  38. # endif
  39. #endif
  40. static const char *_C_name = "C";
  41. static const char *_empty_str = "";
  42. #ifndef _STLP_NO_WCHAR_T
  43. static const wchar_t *_empty_wstr = L"";
  44. #endif
  45. static _Locale_mask_t ctable[256];
  46. /* Framework functions */
  47. void _Locale_init(void) {
  48. /* Ctype table for the ASCII character set. */
  49. char c;
  50. /* We might never reach 128 when char is signed. */
  51. for (c = 0; /* c != 128 */; ++c) {
  52. if (isalpha(c)) ctable[(unsigned char)c] |= _Locale_ALPHA;
  53. if (iscntrl(c)) ctable[(unsigned char)c] |= _Locale_CNTRL;
  54. if (isdigit(c)) ctable[(unsigned char)c] |= _Locale_DIGIT;
  55. if (isprint(c)) ctable[(unsigned char)c] |= _Locale_PRINT;
  56. if (ispunct(c)) ctable[(unsigned char)c] |= _Locale_PUNCT;
  57. if (isspace(c)) ctable[(unsigned char)c] |= _Locale_SPACE;
  58. if (isxdigit(c)) ctable[(unsigned char)c] |= _Locale_XDIGIT;
  59. if (isupper(c)) ctable[(unsigned char)c] |= _Locale_UPPER;
  60. if (islower(c)) ctable[(unsigned char)c] |= _Locale_LOWER;
  61. if (c == 127) break;
  62. }
  63. /* ASCII is a 7-bit code, so everything else is non-ASCII. */
  64. memset(&(ctable[128]), 0, 128 * sizeof(_Locale_mask_t));
  65. }
  66. void _Locale_final(void)
  67. {}
  68. void* _Locale_create(const char* name, int *__err_code) {
  69. if (name[0] == 'C' && name[1] == 0)
  70. { return (void*)0x1; }
  71. *__err_code = _STLP_LOC_NO_PLATFORM_SUPPORT; return 0;
  72. }
  73. struct _Locale_ctype* _Locale_ctype_create(const char *name,
  74. struct _Locale_name_hint* hint, int *__err_code)
  75. { return (struct _Locale_ctype*)_Locale_create(name, __err_code); }
  76. struct _Locale_codecvt* _Locale_codecvt_create(const char *name,
  77. struct _Locale_name_hint* hint, int *__err_code)
  78. { return (struct _Locale_codecvt*)_Locale_create(name, __err_code); }
  79. struct _Locale_numeric* _Locale_numeric_create(const char *name,
  80. struct _Locale_name_hint* hint, int *__err_code)
  81. { return (struct _Locale_numeric*)_Locale_create(name, __err_code); }
  82. struct _Locale_time* _Locale_time_create(const char *name,
  83. struct _Locale_name_hint* hint, int *__err_code)
  84. { return (struct _Locale_time*)_Locale_create(name, __err_code); }
  85. struct _Locale_collate* _Locale_collate_create(const char *name,
  86. struct _Locale_name_hint* hint, int *__err_code)
  87. { return (struct _Locale_collate*)_Locale_create(name, __err_code); }
  88. struct _Locale_monetary* _Locale_monetary_create(const char *name,
  89. struct _Locale_name_hint* hint, int *__err_code)
  90. { return (struct _Locale_monetary*)_Locale_create(name, __err_code); }
  91. struct _Locale_messages* _Locale_messages_create(const char *name,
  92. struct _Locale_name_hint* hint, int *__err_code)
  93. { return (struct _Locale_messages*)_Locale_create(name, __err_code); }
  94. const char *_Locale_ctype_default(char* buf) { return _C_name; }
  95. const char *_Locale_numeric_default(char * buf) { return _C_name; }
  96. const char *_Locale_time_default(char* buf) { return _C_name; }
  97. const char *_Locale_collate_default(char* buf) { return _C_name; }
  98. const char *_Locale_monetary_default(char* buf) { return _C_name; }
  99. const char *_Locale_messages_default(char* buf) { return _C_name; }
  100. char const* _Locale_ctype_name(const struct _Locale_ctype *lctype, char* buf)
  101. { return _C_name; }
  102. char const* _Locale_codecvt_name(const struct _Locale_codecvt *lcodecvt, char* buf)
  103. { return _C_name; }
  104. char const* _Locale_numeric_name(const struct _Locale_numeric *lnum, char* buf)
  105. { return _C_name; }
  106. char const* _Locale_time_name(const struct _Locale_time *ltime, char* buf)
  107. { return _C_name; }
  108. char const* _Locale_collate_name(const struct _Locale_collate *lcol, char* buf)
  109. { return _C_name; }
  110. char const* _Locale_monetary_name(const struct _Locale_monetary *lmon, char* buf)
  111. { return _C_name; }
  112. char const* _Locale_messages_name(const struct _Locale_messages *lmes, char* buf)
  113. { return _C_name; }
  114. void _Locale_ctype_destroy(struct _Locale_ctype *lctype) {}
  115. void _Locale_codecvt_destroy(struct _Locale_codecvt *lcodecvt) {}
  116. void _Locale_numeric_destroy(struct _Locale_numeric *lnum) {}
  117. void _Locale_time_destroy(struct _Locale_time *ltime) {}
  118. void _Locale_collate_destroy(struct _Locale_collate *lcol) {}
  119. void _Locale_monetary_destroy(struct _Locale_monetary *lmon) {}
  120. void _Locale_messages_destroy(struct _Locale_messages *lmes) {}
  121. static char const* _Locale_extract_name(const char* name, int *__err_code) {
  122. // When the request is the default locale or the "C" locale we answer "C".
  123. if (name[0] == 0 ||
  124. (name[0] == 'C' && name[1] == 0))
  125. { return _C_name; }
  126. *__err_code = _STLP_LOC_NO_PLATFORM_SUPPORT; return 0;
  127. }
  128. char const* _Locale_extract_ctype_name(const char *name, char *buf,
  129. struct _Locale_name_hint* hint, int *__err_code)
  130. { return _Locale_extract_name(name, __err_code); }
  131. char const* _Locale_extract_numeric_name(const char *name, char *buf,
  132. struct _Locale_name_hint* hint, int *__err_code)
  133. { return _Locale_extract_name(name, __err_code); }
  134. char const* _Locale_extract_time_name(const char*name, char *buf,
  135. struct _Locale_name_hint* hint, int *__err_code)
  136. { return _Locale_extract_name(name, __err_code); }
  137. char const* _Locale_extract_collate_name(const char *name, char *buf,
  138. struct _Locale_name_hint* hint, int *__err_code)
  139. { return _Locale_extract_name(name, __err_code); }
  140. char const* _Locale_extract_monetary_name(const char *name, char *buf,
  141. struct _Locale_name_hint* hint, int *__err_code)
  142. { return _Locale_extract_name(name, __err_code); }
  143. char const* _Locale_extract_messages_name(const char *name, char *buf,
  144. struct _Locale_name_hint* hint, int *__err_code)
  145. { return _Locale_extract_name(name, __err_code); }
  146. struct _Locale_name_hint* _Locale_get_ctype_hint(struct _Locale_ctype* ctype)
  147. { return 0; }
  148. struct _Locale_name_hint* _Locale_get_numeric_hint(struct _Locale_numeric* numeric)
  149. { return 0; }
  150. struct _Locale_name_hint* _Locale_get_time_hint(struct _Locale_time* time)
  151. { return 0; }
  152. struct _Locale_name_hint* _Locale_get_collate_hint(struct _Locale_collate* collate)
  153. { return 0; }
  154. struct _Locale_name_hint* _Locale_get_monetary_hint(struct _Locale_monetary* monetary)
  155. { return 0; }
  156. struct _Locale_name_hint* _Locale_get_messages_hint(struct _Locale_messages* messages)
  157. { return 0; }
  158. /* ctype */
  159. const _Locale_mask_t* _Locale_ctype_table(struct _Locale_ctype* lctype) {
  160. _STLP_MARK_PARAMETER_AS_UNUSED(lctype)
  161. return ctable;
  162. }
  163. int _Locale_toupper(struct _Locale_ctype*lctype, int c)
  164. { return toupper(c); }
  165. int _Locale_tolower(struct _Locale_ctype*lctype, int c)
  166. { return tolower(c); }
  167. #ifndef _STLP_NO_WCHAR_T
  168. _Locale_mask_t _WLocale_ctype(struct _Locale_ctype *lctype, wint_t wc, _Locale_mask_t mask) {
  169. _Locale_mask_t ret = 0;
  170. if ((mask & _Locale_ALPHA) != 0 && iswalpha(wc))
  171. ret |= _Locale_ALPHA;
  172. if ((mask & _Locale_CNTRL) != 0 && iswcntrl(wc))
  173. ret |= _Locale_CNTRL;
  174. if ((mask & _Locale_DIGIT) != 0 && iswdigit(wc))
  175. ret |= _Locale_DIGIT;
  176. if ((mask & _Locale_PRINT) != 0 && iswprint(wc))
  177. ret |= _Locale_PRINT;
  178. if ((mask & _Locale_PUNCT) != 0 && iswpunct(wc))
  179. ret |= _Locale_PUNCT;
  180. if ((mask & _Locale_SPACE) != 0 && iswspace(wc))
  181. ret |= _Locale_SPACE;
  182. if ((mask & _Locale_XDIGIT) != 0 && iswxdigit(wc))
  183. ret |= _Locale_XDIGIT;
  184. if ((mask & _Locale_UPPER) != 0 && iswupper(wc))
  185. ret |= _Locale_UPPER;
  186. if ((mask & _Locale_LOWER) != 0 && iswlower(wc))
  187. ret |= _Locale_LOWER;
  188. return ret;
  189. }
  190. wint_t _WLocale_tolower(struct _Locale_ctype *lctype, wint_t wc)
  191. { return towlower(wc); }
  192. wint_t _WLocale_toupper(struct _Locale_ctype *lctype, wint_t wc)
  193. { return towupper(wc); }
  194. int _WLocale_mb_cur_max (struct _Locale_codecvt *lcodecvt) { return 1; }
  195. int _WLocale_mb_cur_min (struct _Locale_codecvt *lcodecvt) { return 1; }
  196. int _WLocale_is_stateless (struct _Locale_codecvt *lcodecvt) { return 1; }
  197. size_t _WLocale_mbtowc(struct _Locale_codecvt *lcodecvt,
  198. wchar_t *to,
  199. const char *from, size_t n,
  200. mbstate_t *st)
  201. { *to = *from; return 1; }
  202. size_t _WLocale_wctomb(struct _Locale_codecvt *lcodecvt,
  203. char *to, size_t n,
  204. const wchar_t c,
  205. mbstate_t *st)
  206. { *to = (char)c; return 1; }
  207. size_t _WLocale_unshift(struct _Locale_codecvt *lcodecvt,
  208. mbstate_t *st,
  209. char *buf, size_t n, char ** next)
  210. { *next = buf; return 0; }
  211. #endif
  212. /* Collate */
  213. int _Locale_strcmp(struct _Locale_collate* lcol,
  214. const char* s1, size_t n1, const char* s2, size_t n2) {
  215. int ret = 0;
  216. char buf1[64], buf2[64];
  217. while (n1 > 0 || n2 > 0) {
  218. size_t bufsize1 = n1 < 63 ? n1 : 63;
  219. size_t bufsize2 = n2 < 63 ? n2 : 63;
  220. _STLP_STRNCPY(buf1, 64, s1, bufsize1); buf1[bufsize1] = 0;
  221. _STLP_STRNCPY(buf2, 64, s2, bufsize2); buf2[bufsize2] = 0;
  222. ret = strcmp(buf1, buf2);
  223. if (ret != 0) return ret < 0 ? -1 : 1;
  224. s1 += bufsize1; n1 -= bufsize1;
  225. s2 += bufsize2; n2 -= bufsize2;
  226. }
  227. return ret == 0 ? 0 : (ret < 0 ? -1 : 1);
  228. }
  229. #ifndef _STLP_NO_WCHAR_T
  230. int _WLocale_strcmp(struct _Locale_collate* lcol,
  231. const wchar_t* s1, size_t n1, const wchar_t* s2, size_t n2) {
  232. int ret = 0;
  233. wchar_t buf1[64], buf2[64];
  234. while (n1 > 0 || n2 > 0) {
  235. size_t bufsize1 = n1 < 63 ? n1 : 63;
  236. size_t bufsize2 = n2 < 63 ? n2 : 63;
  237. _STLP_WCSNCPY(buf1, 64, s1, bufsize1); buf1[bufsize1] = 0;
  238. _STLP_WCSNCPY(buf2, 64, s2, bufsize2); buf2[bufsize2] = 0;
  239. ret = wcscmp(buf1, buf2);
  240. if (ret != 0) return ret < 0 ? -1 : 1;
  241. s1 += bufsize1; n1 -= bufsize1;
  242. s2 += bufsize2; n2 -= bufsize2;
  243. }
  244. return ret == 0 ? 0 : (ret < 0 ? -1 : 1);
  245. }
  246. #endif
  247. size_t _Locale_strxfrm(struct _Locale_collate* lcol,
  248. char* dest, size_t dest_n,
  249. const char* src, size_t src_n) {
  250. if (dest != 0) {
  251. _STLP_STRNCPY(dest, dest_n, src, dest_n - 1); dest[dest_n - 1] = 0;
  252. }
  253. return src_n;
  254. }
  255. #ifndef _STLP_NO_WCHAR_T
  256. size_t _WLocale_strxfrm(struct _Locale_collate* lcol,
  257. wchar_t* dest, size_t dest_n,
  258. const wchar_t* src, size_t src_n) {
  259. if (dest != 0) {
  260. _STLP_WCSNCPY(dest, dest_n, src, dest_n - 1); dest[dest_n - 1] = 0;
  261. }
  262. return src_n;
  263. }
  264. #endif
  265. /* Numeric */
  266. char _Locale_decimal_point(struct _Locale_numeric* lnum)
  267. { return '.'; }
  268. char _Locale_thousands_sep(struct _Locale_numeric* lnum)
  269. { return ','; }
  270. const char* _Locale_grouping(struct _Locale_numeric * lnum)
  271. { return _empty_str; }
  272. const char * _Locale_true(struct _Locale_numeric * lnum)
  273. { return "true"; }
  274. const char * _Locale_false(struct _Locale_numeric * lnum)
  275. { return "false"; }
  276. #ifndef _STLP_NO_WCHAR_T
  277. wchar_t _WLocale_decimal_point(struct _Locale_numeric* lnum)
  278. { return L'.'; }
  279. wchar_t _WLocale_thousands_sep(struct _Locale_numeric* lnum)
  280. { return L','; }
  281. const wchar_t * _WLocale_true(struct _Locale_numeric* lnum, wchar_t* buf, size_t bufSize)
  282. { return L"true"; }
  283. const wchar_t * _WLocale_false(struct _Locale_numeric* lnum, wchar_t* buf, size_t bufSize)
  284. { return L"false"; }
  285. #endif
  286. /* Monetary */
  287. const char* _Locale_int_curr_symbol(struct _Locale_monetary * lmon)
  288. { return _empty_str; }
  289. const char* _Locale_currency_symbol(struct _Locale_monetary * lmon)
  290. { return _empty_str; }
  291. char _Locale_mon_decimal_point(struct _Locale_monetary * lmon)
  292. { return '.'; }
  293. char _Locale_mon_thousands_sep(struct _Locale_monetary * lmon)
  294. { return ','; }
  295. const char* _Locale_mon_grouping(struct _Locale_monetary * lmon)
  296. { return _empty_str; }
  297. const char* _Locale_positive_sign(struct _Locale_monetary * lmon)
  298. { return _empty_str; }
  299. const char* _Locale_negative_sign(struct _Locale_monetary * lmon)
  300. { return _empty_str; }
  301. char _Locale_int_frac_digits(struct _Locale_monetary * lmon)
  302. { return 0; }
  303. char _Locale_frac_digits(struct _Locale_monetary * lmon)
  304. { return 0; }
  305. int _Locale_p_cs_precedes(struct _Locale_monetary * lmon)
  306. { return CHAR_MAX; }
  307. int _Locale_p_sep_by_space(struct _Locale_monetary * lmon)
  308. { return CHAR_MAX; }
  309. int _Locale_p_sign_posn(struct _Locale_monetary * lmon)
  310. { return CHAR_MAX; }
  311. int _Locale_n_cs_precedes(struct _Locale_monetary * lmon)
  312. { return CHAR_MAX; }
  313. int _Locale_n_sep_by_space(struct _Locale_monetary * lmon)
  314. { return CHAR_MAX; }
  315. int _Locale_n_sign_posn(struct _Locale_monetary * lmon)
  316. { return CHAR_MAX; }
  317. #ifndef _STLP_NO_WCHAR_T
  318. const wchar_t* _WLocale_int_curr_symbol(struct _Locale_monetary * lmon,
  319. wchar_t* buf, size_t bufSize)
  320. { return _empty_wstr; }
  321. const wchar_t* _WLocale_currency_symbol(struct _Locale_monetary * lmon,
  322. wchar_t* buf, size_t bufSize)
  323. { return _empty_wstr; }
  324. wchar_t _WLocale_mon_decimal_point(struct _Locale_monetary * lmon)
  325. { return L'.'; }
  326. wchar_t _WLocale_mon_thousands_sep(struct _Locale_monetary * lmon)
  327. { return L','; }
  328. const wchar_t* _WLocale_positive_sign(struct _Locale_monetary * lmon,
  329. wchar_t* buf, size_t bufSize)
  330. { return _empty_wstr; }
  331. const wchar_t* _WLocale_negative_sign(struct _Locale_monetary * lmon,
  332. wchar_t* buf, size_t bufSize)
  333. { return _empty_wstr; }
  334. #endif
  335. /* Time */
  336. static const char* full_monthname[] =
  337. { "January", "February", "March", "April", "May", "June",
  338. "July", "August", "September", "October", "November", "December" };
  339. const char * _Locale_full_monthname(struct _Locale_time * ltime, int n)
  340. { return full_monthname[n]; }
  341. static const char* abbrev_monthname[] =
  342. { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
  343. "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
  344. const char * _Locale_abbrev_monthname(struct _Locale_time * ltime, int n)
  345. { return abbrev_monthname[n]; }
  346. static const char* full_dayname[] =
  347. { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };
  348. const char * _Locale_full_dayofweek(struct _Locale_time * ltime, int n)
  349. { return full_dayname[n]; }
  350. static const char* abbrev_dayname[] =
  351. { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
  352. const char * _Locale_abbrev_dayofweek(struct _Locale_time * ltime, int n)
  353. { return abbrev_dayname[n]; }
  354. const char* _Locale_d_t_fmt(struct _Locale_time* ltime)
  355. { return "%m/%d/%y"; }
  356. const char* _Locale_d_fmt(struct _Locale_time* ltime)
  357. { return "%m/%d/%y"; }
  358. const char* _Locale_t_fmt(struct _Locale_time* ltime)
  359. { return "%H:%M:%S"; }
  360. const char* _Locale_long_d_t_fmt(struct _Locale_time* ltime)
  361. { return _empty_str; }
  362. const char* _Locale_long_d_fmt(struct _Locale_time* ltime)
  363. { return _empty_str; }
  364. const char* _Locale_am_str(struct _Locale_time* ltime)
  365. { return "AM"; }
  366. const char* _Locale_pm_str(struct _Locale_time* ltime)
  367. { return "PM"; }
  368. #ifndef _STLP_NO_WCHAR_T
  369. static const wchar_t* full_wmonthname[] =
  370. { L"January", L"February", L"March", L"April", L"May", L"June",
  371. L"July", L"August", L"September", L"October", L"November", L"December" };
  372. const wchar_t * _WLocale_full_monthname(struct _Locale_time * ltime, int n,
  373. wchar_t* buf, size_t bufSize)
  374. { return full_wmonthname[n]; }
  375. static const wchar_t* abbrev_wmonthname[] =
  376. { L"Jan", L"Feb", L"Mar", L"Apr", L"May", L"Jun",
  377. L"Jul", L"Aug", L"Sep", L"Oct", L"Nov", L"Dec" };
  378. const wchar_t * _WLocale_abbrev_monthname(struct _Locale_time * ltime, int n,
  379. wchar_t* buf, size_t bufSize)
  380. { return abbrev_wmonthname[n]; }
  381. static const wchar_t* full_wdayname[] =
  382. { L"Sunday", L"Monday", L"Tuesday", L"Wednesday", L"Thursday", L"Friday", L"Saturday" };
  383. const wchar_t * _WLocale_full_dayofweek(struct _Locale_time * ltime, int n,
  384. wchar_t* buf, size_t bufSize)
  385. { return full_wdayname[n]; }
  386. static const wchar_t* abbrev_wdayname[] =
  387. { L"Sun", L"Mon", L"Tue", L"Wed", L"Thu", L"Fri", L"Sat" };
  388. const wchar_t * _WLocale_abbrev_dayofweek(struct _Locale_time * ltime, int n,
  389. wchar_t* buf, size_t bufSize)
  390. { return abbrev_wdayname[n]; }
  391. const wchar_t* _WLocale_am_str(struct _Locale_time* ltime,
  392. wchar_t* buf, size_t bufSize)
  393. { return L"AM"; }
  394. const wchar_t* _WLocale_pm_str(struct _Locale_time* ltime,
  395. wchar_t* buf, size_t bufSize)
  396. { return L"PM"; }
  397. #endif
  398. /* Messages */
  399. nl_catd_type _Locale_catopen(struct _Locale_messages* lmes, const char* name)
  400. { return -1; }
  401. void _Locale_catclose(struct _Locale_messages* lmes, nl_catd_type cat) {}
  402. const char* _Locale_catgets(struct _Locale_messages* lmes, nl_catd_type cat,
  403. int setid, int msgid, const char *dfault)
  404. { return dfault; }