vsprintf.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694
  1. /*
  2. * linux/lib/vsprintf.c
  3. *
  4. * Copyright (C) 1991, 1992 Linus Torvalds
  5. */
  6. /* vsprintf.c -- Lars Wirzenius & Linus Torvalds. */
  7. /*
  8. * Wirzenius wrote this portably, Torvalds fucked it up :-)
  9. */
  10. #include <stdarg.h>
  11. #include <linux/types.h>
  12. #include <linux/string.h>
  13. #include <linux/ctype.h>
  14. #include <common.h>
  15. #if !defined (CONFIG_PANIC_HANG)
  16. #include <command.h>
  17. /*cmd_boot.c*/
  18. extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
  19. #endif
  20. #ifdef CONFIG_SYS_64BIT_VSPRINTF
  21. # define NUM_TYPE long long
  22. #else
  23. # define NUM_TYPE long
  24. #endif
  25. #define noinline __attribute__((noinline))
  26. #define do_div(n, base) ({ \
  27. unsigned int __res; \
  28. __res = ((unsigned NUM_TYPE) n) % base; \
  29. n = ((unsigned NUM_TYPE) n) / base; \
  30. __res; \
  31. })
  32. const char hex_asc[] = "0123456789abcdef";
  33. #define hex_asc_lo(x) hex_asc[((x) & 0x0f)]
  34. #define hex_asc_hi(x) hex_asc[((x) & 0xf0) >> 4]
  35. static inline char *pack_hex_byte(char *buf, u8 byte)
  36. {
  37. *buf++ = hex_asc_hi(byte);
  38. *buf++ = hex_asc_lo(byte);
  39. return buf;
  40. }
  41. unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base)
  42. {
  43. unsigned long result = 0,value;
  44. if (*cp == '0') {
  45. cp++;
  46. if ((*cp == 'x') && isxdigit(cp[1])) {
  47. base = 16;
  48. cp++;
  49. }
  50. if (!base) {
  51. base = 8;
  52. }
  53. }
  54. if (!base) {
  55. base = 10;
  56. }
  57. while (isxdigit(*cp) && (value = isdigit(*cp) ? *cp-'0' : (islower(*cp)
  58. ? toupper(*cp) : *cp)-'A'+10) < base) {
  59. result = result*base + value;
  60. cp++;
  61. }
  62. if (endp)
  63. *endp = (char *)cp;
  64. return result;
  65. }
  66. long simple_strtol(const char *cp,char **endp,unsigned int base)
  67. {
  68. if(*cp=='-')
  69. return -simple_strtoul(cp+1,endp,base);
  70. return simple_strtoul(cp,endp,base);
  71. }
  72. int ustrtoul(const char *cp, char **endp, unsigned int base)
  73. {
  74. unsigned long result = simple_strtoul(cp, endp, base);
  75. switch (**endp) {
  76. case 'G' :
  77. result *= 1024;
  78. /* fall through */
  79. case 'M':
  80. result *= 1024;
  81. /* fall through */
  82. case 'K':
  83. case 'k':
  84. result *= 1024;
  85. if ((*endp)[1] == 'i') {
  86. if ((*endp)[2] == 'B')
  87. (*endp) += 3;
  88. else
  89. (*endp) += 2;
  90. }
  91. }
  92. return result;
  93. }
  94. #ifdef CONFIG_SYS_64BIT_STRTOUL
  95. unsigned long long simple_strtoull (const char *cp, char **endp, unsigned int base)
  96. {
  97. unsigned long long result = 0, value;
  98. if (*cp == '0') {
  99. cp++;
  100. if ((*cp == 'x') && isxdigit (cp[1])) {
  101. base = 16;
  102. cp++;
  103. }
  104. if (!base) {
  105. base = 8;
  106. }
  107. }
  108. if (!base) {
  109. base = 10;
  110. }
  111. while (isxdigit (*cp) && (value = isdigit (*cp)
  112. ? *cp - '0'
  113. : (islower (*cp) ? toupper (*cp) : *cp) - 'A' + 10) < base) {
  114. result = result * base + value;
  115. cp++;
  116. }
  117. if (endp)
  118. *endp = (char *) cp;
  119. return result;
  120. }
  121. #endif /* CONFIG_SYS_64BIT_STRTOUL */
  122. /* we use this so that we can do without the ctype library */
  123. #define is_digit(c) ((c) >= '0' && (c) <= '9')
  124. static int skip_atoi(const char **s)
  125. {
  126. int i=0;
  127. while (is_digit(**s))
  128. i = i*10 + *((*s)++) - '0';
  129. return i;
  130. }
  131. /* Decimal conversion is by far the most typical, and is used
  132. * for /proc and /sys data. This directly impacts e.g. top performance
  133. * with many processes running. We optimize it for speed
  134. * using code from
  135. * http://www.cs.uiowa.edu/~jones/bcd/decimal.html
  136. * (with permission from the author, Douglas W. Jones). */
  137. /* Formats correctly any integer in [0,99999].
  138. * Outputs from one to five digits depending on input.
  139. * On i386 gcc 4.1.2 -O2: ~250 bytes of code. */
  140. static char* put_dec_trunc(char *buf, unsigned q)
  141. {
  142. unsigned d3, d2, d1, d0;
  143. d1 = (q>>4) & 0xf;
  144. d2 = (q>>8) & 0xf;
  145. d3 = (q>>12);
  146. d0 = 6*(d3 + d2 + d1) + (q & 0xf);
  147. q = (d0 * 0xcd) >> 11;
  148. d0 = d0 - 10*q;
  149. *buf++ = d0 + '0'; /* least significant digit */
  150. d1 = q + 9*d3 + 5*d2 + d1;
  151. if (d1 != 0) {
  152. q = (d1 * 0xcd) >> 11;
  153. d1 = d1 - 10*q;
  154. *buf++ = d1 + '0'; /* next digit */
  155. d2 = q + 2*d2;
  156. if ((d2 != 0) || (d3 != 0)) {
  157. q = (d2 * 0xd) >> 7;
  158. d2 = d2 - 10*q;
  159. *buf++ = d2 + '0'; /* next digit */
  160. d3 = q + 4*d3;
  161. if (d3 != 0) {
  162. q = (d3 * 0xcd) >> 11;
  163. d3 = d3 - 10*q;
  164. *buf++ = d3 + '0'; /* next digit */
  165. if (q != 0)
  166. *buf++ = q + '0'; /* most sign. digit */
  167. }
  168. }
  169. }
  170. return buf;
  171. }
  172. /* Same with if's removed. Always emits five digits */
  173. static char* put_dec_full(char *buf, unsigned q)
  174. {
  175. /* BTW, if q is in [0,9999], 8-bit ints will be enough, */
  176. /* but anyway, gcc produces better code with full-sized ints */
  177. unsigned d3, d2, d1, d0;
  178. d1 = (q>>4) & 0xf;
  179. d2 = (q>>8) & 0xf;
  180. d3 = (q>>12);
  181. /* Possible ways to approx. divide by 10 */
  182. /* gcc -O2 replaces multiply with shifts and adds */
  183. // (x * 0xcd) >> 11: 11001101 - shorter code than * 0x67 (on i386)
  184. // (x * 0x67) >> 10: 1100111
  185. // (x * 0x34) >> 9: 110100 - same
  186. // (x * 0x1a) >> 8: 11010 - same
  187. // (x * 0x0d) >> 7: 1101 - same, shortest code (on i386)
  188. d0 = 6*(d3 + d2 + d1) + (q & 0xf);
  189. q = (d0 * 0xcd) >> 11;
  190. d0 = d0 - 10*q;
  191. *buf++ = d0 + '0';
  192. d1 = q + 9*d3 + 5*d2 + d1;
  193. q = (d1 * 0xcd) >> 11;
  194. d1 = d1 - 10*q;
  195. *buf++ = d1 + '0';
  196. d2 = q + 2*d2;
  197. q = (d2 * 0xd) >> 7;
  198. d2 = d2 - 10*q;
  199. *buf++ = d2 + '0';
  200. d3 = q + 4*d3;
  201. q = (d3 * 0xcd) >> 11; /* - shorter code */
  202. /* q = (d3 * 0x67) >> 10; - would also work */
  203. d3 = d3 - 10*q;
  204. *buf++ = d3 + '0';
  205. *buf++ = q + '0';
  206. return buf;
  207. }
  208. /* No inlining helps gcc to use registers better */
  209. static noinline char* put_dec(char *buf, unsigned NUM_TYPE num)
  210. {
  211. while (1) {
  212. unsigned rem;
  213. if (num < 100000)
  214. return put_dec_trunc(buf, num);
  215. rem = do_div(num, 100000);
  216. buf = put_dec_full(buf, rem);
  217. }
  218. }
  219. #define ZEROPAD 1 /* pad with zero */
  220. #define SIGN 2 /* unsigned/signed long */
  221. #define PLUS 4 /* show plus */
  222. #define SPACE 8 /* space if plus */
  223. #define LEFT 16 /* left justified */
  224. #define SMALL 32 /* Must be 32 == 0x20 */
  225. #define SPECIAL 64 /* 0x */
  226. static char *number(char *buf, unsigned NUM_TYPE num, int base, int size, int precision, int type)
  227. {
  228. /* we are called with base 8, 10 or 16, only, thus don't need "G..." */
  229. static const char digits[16] = "0123456789ABCDEF"; /* "GHIJKLMNOPQRSTUVWXYZ"; */
  230. char tmp[66];
  231. char sign;
  232. char locase;
  233. int need_pfx = ((type & SPECIAL) && base != 10);
  234. int i;
  235. /* locase = 0 or 0x20. ORing digits or letters with 'locase'
  236. * produces same digits or (maybe lowercased) letters */
  237. locase = (type & SMALL);
  238. if (type & LEFT)
  239. type &= ~ZEROPAD;
  240. sign = 0;
  241. if (type & SIGN) {
  242. if ((signed NUM_TYPE) num < 0) {
  243. sign = '-';
  244. num = - (signed NUM_TYPE) num;
  245. size--;
  246. } else if (type & PLUS) {
  247. sign = '+';
  248. size--;
  249. } else if (type & SPACE) {
  250. sign = ' ';
  251. size--;
  252. }
  253. }
  254. if (need_pfx) {
  255. size--;
  256. if (base == 16)
  257. size--;
  258. }
  259. /* generate full string in tmp[], in reverse order */
  260. i = 0;
  261. if (num == 0)
  262. tmp[i++] = '0';
  263. /* Generic code, for any base:
  264. else do {
  265. tmp[i++] = (digits[do_div(num,base)] | locase);
  266. } while (num != 0);
  267. */
  268. else if (base != 10) { /* 8 or 16 */
  269. int mask = base - 1;
  270. int shift = 3;
  271. if (base == 16) shift = 4;
  272. do {
  273. tmp[i++] = (digits[((unsigned char)num) & mask] | locase);
  274. num >>= shift;
  275. } while (num);
  276. } else { /* base 10 */
  277. i = put_dec(tmp, num) - tmp;
  278. }
  279. /* printing 100 using %2d gives "100", not "00" */
  280. if (i > precision)
  281. precision = i;
  282. /* leading space padding */
  283. size -= precision;
  284. if (!(type & (ZEROPAD+LEFT)))
  285. while(--size >= 0)
  286. *buf++ = ' ';
  287. /* sign */
  288. if (sign)
  289. *buf++ = sign;
  290. /* "0x" / "0" prefix */
  291. if (need_pfx) {
  292. *buf++ = '0';
  293. if (base == 16)
  294. *buf++ = ('X' | locase);
  295. }
  296. /* zero or space padding */
  297. if (!(type & LEFT)) {
  298. char c = (type & ZEROPAD) ? '0' : ' ';
  299. while (--size >= 0)
  300. *buf++ = c;
  301. }
  302. /* hmm even more zero padding? */
  303. while (i <= --precision)
  304. *buf++ = '0';
  305. /* actual digits of result */
  306. while (--i >= 0)
  307. *buf++ = tmp[i];
  308. /* trailing space padding */
  309. while (--size >= 0)
  310. *buf++ = ' ';
  311. return buf;
  312. }
  313. static char *string(char *buf, char *s, int field_width, int precision, int flags)
  314. {
  315. int len, i;
  316. if (s == 0)
  317. s = "<NULL>";
  318. len = strnlen(s, precision);
  319. if (!(flags & LEFT))
  320. while (len < field_width--)
  321. *buf++ = ' ';
  322. for (i = 0; i < len; ++i)
  323. *buf++ = *s++;
  324. while (len < field_width--)
  325. *buf++ = ' ';
  326. return buf;
  327. }
  328. #ifdef CONFIG_CMD_NET
  329. static char *mac_address_string(char *buf, u8 *addr, int field_width,
  330. int precision, int flags)
  331. {
  332. char mac_addr[6 * 3]; /* (6 * 2 hex digits), 5 colons and trailing zero */
  333. char *p = mac_addr;
  334. int i;
  335. for (i = 0; i < 6; i++) {
  336. p = pack_hex_byte(p, addr[i]);
  337. if (!(flags & SPECIAL) && i != 5)
  338. *p++ = ':';
  339. }
  340. *p = '\0';
  341. return string(buf, mac_addr, field_width, precision, flags & ~SPECIAL);
  342. }
  343. static char *ip6_addr_string(char *buf, u8 *addr, int field_width,
  344. int precision, int flags)
  345. {
  346. char ip6_addr[8 * 5]; /* (8 * 4 hex digits), 7 colons and trailing zero */
  347. char *p = ip6_addr;
  348. int i;
  349. for (i = 0; i < 8; i++) {
  350. p = pack_hex_byte(p, addr[2 * i]);
  351. p = pack_hex_byte(p, addr[2 * i + 1]);
  352. if (!(flags & SPECIAL) && i != 7)
  353. *p++ = ':';
  354. }
  355. *p = '\0';
  356. return string(buf, ip6_addr, field_width, precision, flags & ~SPECIAL);
  357. }
  358. static char *ip4_addr_string(char *buf, u8 *addr, int field_width,
  359. int precision, int flags)
  360. {
  361. char ip4_addr[4 * 4]; /* (4 * 3 decimal digits), 3 dots and trailing zero */
  362. char temp[3]; /* hold each IP quad in reverse order */
  363. char *p = ip4_addr;
  364. int i, digits;
  365. for (i = 0; i < 4; i++) {
  366. digits = put_dec_trunc(temp, addr[i]) - temp;
  367. /* reverse the digits in the quad */
  368. while (digits--)
  369. *p++ = temp[digits];
  370. if (i != 3)
  371. *p++ = '.';
  372. }
  373. *p = '\0';
  374. return string(buf, ip4_addr, field_width, precision, flags & ~SPECIAL);
  375. }
  376. #endif
  377. /*
  378. * Show a '%p' thing. A kernel extension is that the '%p' is followed
  379. * by an extra set of alphanumeric characters that are extended format
  380. * specifiers.
  381. *
  382. * Right now we handle:
  383. *
  384. * - 'M' For a 6-byte MAC address, it prints the address in the
  385. * usual colon-separated hex notation
  386. * - 'I' [46] for IPv4/IPv6 addresses printed in the usual way (dot-separated
  387. * decimal for v4 and colon separated network-order 16 bit hex for v6)
  388. * - 'i' [46] for 'raw' IPv4/IPv6 addresses, IPv6 omits the colons, IPv4 is
  389. * currently the same
  390. *
  391. * Note: The difference between 'S' and 'F' is that on ia64 and ppc64
  392. * function pointers are really function descriptors, which contain a
  393. * pointer to the real address.
  394. */
  395. static char *pointer(const char *fmt, char *buf, void *ptr, int field_width, int precision, int flags)
  396. {
  397. if (!ptr)
  398. return string(buf, "(null)", field_width, precision, flags);
  399. #ifdef CONFIG_CMD_NET
  400. switch (*fmt) {
  401. case 'm':
  402. flags |= SPECIAL;
  403. /* Fallthrough */
  404. case 'M':
  405. return mac_address_string(buf, ptr, field_width, precision, flags);
  406. case 'i':
  407. flags |= SPECIAL;
  408. /* Fallthrough */
  409. case 'I':
  410. if (fmt[1] == '6')
  411. return ip6_addr_string(buf, ptr, field_width, precision, flags);
  412. if (fmt[1] == '4')
  413. return ip4_addr_string(buf, ptr, field_width, precision, flags);
  414. flags &= ~SPECIAL;
  415. break;
  416. }
  417. #endif
  418. flags |= SMALL;
  419. if (field_width == -1) {
  420. field_width = 2*sizeof(void *);
  421. flags |= ZEROPAD;
  422. }
  423. return number(buf, (unsigned long) ptr, 16, field_width, precision, flags);
  424. }
  425. /**
  426. * vsprintf - Format a string and place it in a buffer
  427. * @buf: The buffer to place the result into
  428. * @fmt: The format string to use
  429. * @args: Arguments for the format string
  430. *
  431. * This function follows C99 vsprintf, but has some extensions:
  432. * %pS output the name of a text symbol
  433. * %pF output the name of a function pointer
  434. * %pR output the address range in a struct resource
  435. *
  436. * The function returns the number of characters written
  437. * into @buf.
  438. *
  439. * Call this function if you are already dealing with a va_list.
  440. * You probably want sprintf() instead.
  441. */
  442. int vsprintf(char *buf, const char *fmt, va_list args)
  443. {
  444. unsigned NUM_TYPE num;
  445. int base;
  446. char *str;
  447. int flags; /* flags to number() */
  448. int field_width; /* width of output field */
  449. int precision; /* min. # of digits for integers; max
  450. number of chars for from string */
  451. int qualifier; /* 'h', 'l', or 'L' for integer fields */
  452. /* 'z' support added 23/7/1999 S.H. */
  453. /* 'z' changed to 'Z' --davidm 1/25/99 */
  454. /* 't' added for ptrdiff_t */
  455. str = buf;
  456. for (; *fmt ; ++fmt) {
  457. if (*fmt != '%') {
  458. *str++ = *fmt;
  459. continue;
  460. }
  461. /* process flags */
  462. flags = 0;
  463. repeat:
  464. ++fmt; /* this also skips first '%' */
  465. switch (*fmt) {
  466. case '-': flags |= LEFT; goto repeat;
  467. case '+': flags |= PLUS; goto repeat;
  468. case ' ': flags |= SPACE; goto repeat;
  469. case '#': flags |= SPECIAL; goto repeat;
  470. case '0': flags |= ZEROPAD; goto repeat;
  471. }
  472. /* get field width */
  473. field_width = -1;
  474. if (is_digit(*fmt))
  475. field_width = skip_atoi(&fmt);
  476. else if (*fmt == '*') {
  477. ++fmt;
  478. /* it's the next argument */
  479. field_width = va_arg(args, int);
  480. if (field_width < 0) {
  481. field_width = -field_width;
  482. flags |= LEFT;
  483. }
  484. }
  485. /* get the precision */
  486. precision = -1;
  487. if (*fmt == '.') {
  488. ++fmt;
  489. if (is_digit(*fmt))
  490. precision = skip_atoi(&fmt);
  491. else if (*fmt == '*') {
  492. ++fmt;
  493. /* it's the next argument */
  494. precision = va_arg(args, int);
  495. }
  496. if (precision < 0)
  497. precision = 0;
  498. }
  499. /* get the conversion qualifier */
  500. qualifier = -1;
  501. if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' ||
  502. *fmt == 'Z' || *fmt == 'z' || *fmt == 't') {
  503. qualifier = *fmt;
  504. ++fmt;
  505. if (qualifier == 'l' && *fmt == 'l') {
  506. qualifier = 'L';
  507. ++fmt;
  508. }
  509. }
  510. /* default base */
  511. base = 10;
  512. switch (*fmt) {
  513. case 'c':
  514. if (!(flags & LEFT))
  515. while (--field_width > 0)
  516. *str++ = ' ';
  517. *str++ = (unsigned char) va_arg(args, int);
  518. while (--field_width > 0)
  519. *str++ = ' ';
  520. continue;
  521. case 's':
  522. str = string(str, va_arg(args, char *), field_width, precision, flags);
  523. continue;
  524. case 'p':
  525. str = pointer(fmt+1, str,
  526. va_arg(args, void *),
  527. field_width, precision, flags);
  528. /* Skip all alphanumeric pointer suffixes */
  529. while (isalnum(fmt[1]))
  530. fmt++;
  531. continue;
  532. case 'n':
  533. if (qualifier == 'l') {
  534. long * ip = va_arg(args, long *);
  535. *ip = (str - buf);
  536. } else {
  537. int * ip = va_arg(args, int *);
  538. *ip = (str - buf);
  539. }
  540. continue;
  541. case '%':
  542. *str++ = '%';
  543. continue;
  544. /* integer number formats - set up the flags and "break" */
  545. case 'o':
  546. base = 8;
  547. break;
  548. case 'x':
  549. flags |= SMALL;
  550. case 'X':
  551. base = 16;
  552. break;
  553. case 'd':
  554. case 'i':
  555. flags |= SIGN;
  556. case 'u':
  557. break;
  558. default:
  559. *str++ = '%';
  560. if (*fmt)
  561. *str++ = *fmt;
  562. else
  563. --fmt;
  564. continue;
  565. }
  566. #ifdef CONFIG_SYS_64BIT_VSPRINTF
  567. if (qualifier == 'L') /* "quad" for 64 bit variables */
  568. num = va_arg(args, unsigned long long);
  569. else
  570. #endif
  571. if (qualifier == 'l') {
  572. num = va_arg(args, unsigned long);
  573. if (flags & SIGN)
  574. num = (signed long) num;
  575. } else if (qualifier == 'Z' || qualifier == 'z') {
  576. num = va_arg(args, size_t);
  577. } else if (qualifier == 't') {
  578. num = va_arg(args, ptrdiff_t);
  579. } else if (qualifier == 'h') {
  580. num = (unsigned short) va_arg(args, int);
  581. if (flags & SIGN)
  582. num = (signed short) num;
  583. } else {
  584. num = va_arg(args, unsigned int);
  585. if (flags & SIGN)
  586. num = (signed int) num;
  587. }
  588. str = number(str, num, base, field_width, precision, flags);
  589. }
  590. *str = '\0';
  591. return str-buf;
  592. }
  593. /**
  594. * sprintf - Format a string and place it in a buffer
  595. * @buf: The buffer to place the result into
  596. * @fmt: The format string to use
  597. * @...: Arguments for the format string
  598. *
  599. * The function returns the number of characters written
  600. * into @buf.
  601. *
  602. * See the vsprintf() documentation for format string extensions over C99.
  603. */
  604. int sprintf(char * buf, const char *fmt, ...)
  605. {
  606. va_list args;
  607. int i;
  608. va_start(args, fmt);
  609. i=vsprintf(buf,fmt,args);
  610. va_end(args);
  611. return i;
  612. }
  613. void panic(const char *fmt, ...)
  614. {
  615. va_list args;
  616. va_start(args, fmt);
  617. vprintf(fmt, args);
  618. putc('\n');
  619. va_end(args);
  620. #if defined (CONFIG_PANIC_HANG)
  621. hang();
  622. #else
  623. udelay (100000); /* allow messages to go out */
  624. do_reset (NULL, 0, 0, NULL);
  625. #endif
  626. }