···11+#include <stddef.h>
22+#include "string.h"
33+#include "strmemccpy.h"
44+/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
55+ Written by James Clark (jjc@jclark.com)
66+77+This file was part of groff.
88+99+groff is free software; you can redistribute it and/or modify it under
1010+the terms of the GNU General Public License as published by the Free
1111+Software Foundation; either version 2, or (at your option) any later
1212+version.
1313+1414+groff is distributed in the hope that it will be useful, but WITHOUT ANY
1515+WARRANTY; without even the implied warranty of MERCHANTABILITY or
1616+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1717+for more details.
1818+1919+You should have received a copy of the GNU General Public License along
2020+with groff; see the file COPYING. If not, write to the Free Software
2121+Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
2222+2323+#define INT_DIGITS 19 /* enough for 64 bit integer */
2424+2525+char *itoa(char *buf, size_t bufsz, long int i)
2626+{
2727+ /* Room for INT_DIGITS digits, - and '\0' */
2828+ static char intbuf[INT_DIGITS + 2];
2929+ char *p = intbuf + INT_DIGITS + 1; /* points to terminating '\0' */
3030+ if (i >= 0) {
3131+ do {
3232+ *--p = '0' + (i % 10);
3333+ i /= 10;
3434+ } while (i != 0);
3535+ }
3636+ else { /* i < 0 */
3737+ do {
3838+ *--p = '0' - (i % 10);
3939+ i /= 10;
4040+ } while (i != 0);
4141+ *--p = '-';
4242+ }
4343+ strmemccpy(buf, p, bufsz);
4444+ return buf;
4545+}
+2
firmware/include/string-extra.h
···7070 strmemdupa(__s, MIN(__n, __len)); })
7171#endif /* strndupa */
72727373+char *itoa(char *buf, size_t bufsz, long int i); /* Not std */
7474+7375#endif /* STRING_EXTRA_H */