mirror of
https://github.com/fosslinux/live-bootstrap.git
synced 2026-03-17 08:45:23 +01:00
Add mes and mescc-tools-extra
mescc-tools-extra contains two important tools: - cp - chmod mes first builds itself from a mes 0.21 seed as used by guix, and then builds a mes 0.22 and then mes 0.22 using that created mes 0.22. It does /not/ use bootstrap.sh as we don't have a proper shell at this point, it has been manually adapted for kaem.
This commit is contained in:
parent
2706e07556
commit
649d7b68dc
1029 changed files with 120985 additions and 18 deletions
32
sysa/mes-0.22/lib/mes/__assert_fail.c
Normal file
32
sysa/mes-0.22/lib/mes/__assert_fail.c
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* This file is part of GNU Mes.
|
||||
*
|
||||
* GNU Mes is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* GNU Mes is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <mes/lib.h>
|
||||
|
||||
void
|
||||
__assert_fail (char *s)
|
||||
{
|
||||
eputs ("assert fail: ");
|
||||
eputs (s);
|
||||
eputs ("\n");
|
||||
char *fail = s;
|
||||
fail = 0;
|
||||
*fail = 0;
|
||||
}
|
||||
109
sysa/mes-0.22/lib/mes/__buffered_read.c
Normal file
109
sysa/mes-0.22/lib/mes/__buffered_read.c
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* This file is part of GNU Mes.
|
||||
*
|
||||
* GNU Mes is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* GNU Mes is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <mes/lib.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if !__MESC__
|
||||
#define __READ_BUFFER_MAX 128
|
||||
int __read_buffer_max;
|
||||
#else /* FIXME: We want bin/mes-mescc's x86-linux sha256sum to stay the same. */
|
||||
#define __READ_BUFFER_MAX 100
|
||||
#define __read_buffer_max 100
|
||||
#endif
|
||||
|
||||
struct __read_buffer
|
||||
{
|
||||
ssize_t size;
|
||||
char string[__READ_BUFFER_MAX];
|
||||
};
|
||||
|
||||
struct __read_buffer *__read_cache = 0;
|
||||
|
||||
void
|
||||
__buffered_read_init (int filedes)
|
||||
{
|
||||
if (!__read_cache)
|
||||
{
|
||||
__read_cache = (struct __read_buffer *) malloc (sizeof (struct __read_buffer) * __FILEDES_MAX);
|
||||
#if !__MESC__
|
||||
__read_buffer_max = __READ_BUFFER_MAX;
|
||||
char *p = getenv ("MES_READ_BUFFER");
|
||||
if (p)
|
||||
{
|
||||
__read_buffer_max = atoi (p);
|
||||
if (__read_buffer_max < 0)
|
||||
__read_buffer_max = 0;
|
||||
if (__read_buffer_max > __READ_BUFFER_MAX)
|
||||
__read_buffer_max = __READ_BUFFER_MAX;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
size_t
|
||||
__buffered_read_clear (int filedes)
|
||||
{
|
||||
__buffered_read_init (filedes);
|
||||
size_t size = __read_cache[filedes].size;
|
||||
__read_cache[filedes].size = 0;
|
||||
return size;
|
||||
}
|
||||
|
||||
ssize_t
|
||||
__buffered_read (int filedes, void *buffer, size_t size)
|
||||
{
|
||||
size_t todo = size;
|
||||
__buffered_read_init (filedes);
|
||||
struct __read_buffer *cache = &__read_cache[filedes];
|
||||
char *p = buffer;
|
||||
if (!cache->size && size > __read_buffer_max)
|
||||
return _read (filedes, buffer, size);
|
||||
while (cache->size > 0 && todo)
|
||||
{
|
||||
todo--;
|
||||
*p++ = cache->string[__read_buffer_max - cache->size--];
|
||||
}
|
||||
if (todo)
|
||||
{
|
||||
#if !__MESC__
|
||||
if (todo > __read_buffer_max)
|
||||
return size - todo + _read (filedes, p, todo);
|
||||
if (__mes_debug () > 4)
|
||||
{
|
||||
eputs ("__buffered_read: ");
|
||||
eputs (itoa (__read_buffer_max));
|
||||
eputs ("\n");
|
||||
}
|
||||
#endif
|
||||
ssize_t bytes = _read (filedes, cache->string, __read_buffer_max);
|
||||
if (bytes < 0)
|
||||
return -1;
|
||||
if (bytes)
|
||||
{
|
||||
cache->size = bytes;
|
||||
if (bytes < __read_buffer_max)
|
||||
memmove (cache->string + __read_buffer_max - bytes, cache->string, bytes);
|
||||
return size - todo + __buffered_read (filedes, p, todo);
|
||||
}
|
||||
}
|
||||
return size - todo;
|
||||
}
|
||||
36
sysa/mes-0.22/lib/mes/__mes_debug.c
Normal file
36
sysa/mes-0.22/lib/mes/__mes_debug.c
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* This file is part of GNU Mes.
|
||||
*
|
||||
* GNU Mes is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* GNU Mes is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "mes/lib.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
||||
|
||||
int
|
||||
__mes_debug ()
|
||||
{
|
||||
static int __mes_debug = -1;
|
||||
if (__mes_debug == -1)
|
||||
{
|
||||
char *p = getenv ("MES_DEBUG");
|
||||
__mes_debug = p ? MAX (atoi (p), 1) : 0;
|
||||
}
|
||||
return __mes_debug;
|
||||
}
|
||||
53
sysa/mes-0.22/lib/mes/abtod.c
Normal file
53
sysa/mes-0.22/lib/mes/abtod.c
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* This file is part of GNU Mes.
|
||||
*
|
||||
* GNU Mes is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* GNU Mes is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <mes/lib.h>
|
||||
|
||||
double
|
||||
abtod (char const **p, int base)
|
||||
{
|
||||
char const *s = *p;
|
||||
double d = 0;
|
||||
int sign_p = 0;
|
||||
if (!base)
|
||||
base = 10;
|
||||
double dbase = base;
|
||||
long i = abtol (&s, base);
|
||||
long f = 0;
|
||||
long e = 0;
|
||||
if (*s == '.')
|
||||
{
|
||||
s++;
|
||||
f = abtol (&s, base);
|
||||
}
|
||||
if (*s == 'e')
|
||||
{
|
||||
s++;
|
||||
e = abtol (&s, base);
|
||||
}
|
||||
d = i + f / dbase;
|
||||
if (e < 0)
|
||||
while (e++)
|
||||
d = d / dbase;
|
||||
while (e--)
|
||||
d = d * dbase;
|
||||
*p = s;
|
||||
return sign_p ? -d : d;
|
||||
}
|
||||
50
sysa/mes-0.22/lib/mes/abtol.c
Normal file
50
sysa/mes-0.22/lib/mes/abtol.c
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* This file is part of GNU Mes.
|
||||
*
|
||||
* GNU Mes is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* GNU Mes is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <mes/lib.h>
|
||||
#include <ctype.h>
|
||||
|
||||
long
|
||||
abtol (char const **p, int base)
|
||||
{
|
||||
char const *s = *p;
|
||||
int i = 0;
|
||||
int sign_p = 0;
|
||||
if (!base)
|
||||
base = 10;
|
||||
while (isspace (*s))
|
||||
s++;
|
||||
if (*s && *s == '+')
|
||||
s++;
|
||||
if (*s && *s == '-')
|
||||
{
|
||||
sign_p = 1;
|
||||
s++;
|
||||
}
|
||||
while (isnumber (*s, base))
|
||||
{
|
||||
i *= base;
|
||||
int m = *s > '9' ? 'a' - 10 : '0';
|
||||
i += *s - m;
|
||||
s++;
|
||||
}
|
||||
*p = s;
|
||||
return sign_p ? -i : i;
|
||||
}
|
||||
110
sysa/mes-0.22/lib/mes/div.c
Normal file
110
sysa/mes-0.22/lib/mes/div.c
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
* Copyright © 2019 Danny Milosavljevic <dannym@scratchpost.org>
|
||||
*
|
||||
* This file is part of GNU Mes.
|
||||
*
|
||||
* GNU Mes is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* GNU Mes is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <mes/lib.h>
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
#include <limits.h>
|
||||
|
||||
/*#define LONG_MIN (-(~0UL>>1)-1)*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
long quot;
|
||||
long rem;
|
||||
} ldiv_t;
|
||||
|
||||
void __mesabi_div0(void)
|
||||
{
|
||||
eputs(" ***MES C LIB*** divide by zero numerator=");
|
||||
eputs("\n");
|
||||
assert(0);
|
||||
}
|
||||
|
||||
/* Compare gcc: __udivdi3 */
|
||||
unsigned long __mesabi_uldiv(unsigned long a, unsigned long b, unsigned long* remainder)
|
||||
{
|
||||
unsigned long tmp;
|
||||
if (!remainder)
|
||||
remainder = &tmp;
|
||||
*remainder = 0;
|
||||
if (b == 1)
|
||||
return a;
|
||||
else if (b == 0)
|
||||
__mesabi_div0();
|
||||
else
|
||||
{
|
||||
unsigned long x;
|
||||
for (x = 0; a >= b; a -= b)
|
||||
++x;
|
||||
*remainder = a;
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
/* Note: Rounds towards zero.
|
||||
Maintainer: Be careful to satisfy quot * b + rem == a.
|
||||
That means that rem can be negative. */
|
||||
ldiv_t ldiv(long a, long b)
|
||||
{
|
||||
ldiv_t result;
|
||||
int negate_result = (a < 0) ^ (b < 0);
|
||||
assert(b != LONG_MIN);
|
||||
if (a != LONG_MIN)
|
||||
{
|
||||
int negative_a = (a < 0);
|
||||
if (negative_a)
|
||||
a = -a;
|
||||
if (b < 0)
|
||||
b = -b;
|
||||
result.quot = __mesabi_uldiv(a, b, &result.rem);
|
||||
if (negate_result)
|
||||
result.quot = -result.quot;
|
||||
if (negative_a)
|
||||
result.rem = -result.rem;
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
result.rem = 0;
|
||||
if (b < 0)
|
||||
b = -b;
|
||||
if (b == 1)
|
||||
{
|
||||
result.quot = a;
|
||||
/* Since result.quot is already negative, don't negate it again. */
|
||||
negate_result = !negate_result;
|
||||
}
|
||||
else if (b == 0)
|
||||
__mesabi_div0();
|
||||
else
|
||||
{
|
||||
long x;
|
||||
for (x = 0; a <= -b; a += b)
|
||||
++x;
|
||||
result.rem = a; /* negative */
|
||||
result.quot = x;
|
||||
}
|
||||
if (negate_result)
|
||||
result.quot = -result.quot;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
46
sysa/mes-0.22/lib/mes/dtoab.c
Normal file
46
sysa/mes-0.22/lib/mes/dtoab.c
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* This file is part of GNU Mes.
|
||||
*
|
||||
* GNU Mes is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* GNU Mes is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <mes/lib.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
|
||||
char *
|
||||
dtoab (double d, int base, int signed_p)
|
||||
{
|
||||
static char dtoa_buf[40];
|
||||
long i = (long) d;
|
||||
char *p = ntoab (i, base, signed_p);
|
||||
strcpy (dtoa_buf, p);
|
||||
long f = (d - (double) i) * (double) 100000000;
|
||||
if (f)
|
||||
{
|
||||
if (f < 0)
|
||||
f = -f;
|
||||
strcat (dtoa_buf, ".");
|
||||
p = ntoab (f, base, 1);
|
||||
strcat (dtoa_buf, p);
|
||||
p = strchr (dtoa_buf, 0);
|
||||
p--;
|
||||
while (*p && *p == '0')
|
||||
*p-- = 0;
|
||||
}
|
||||
return dtoa_buf;
|
||||
}
|
||||
27
sysa/mes-0.22/lib/mes/eputc.c
Normal file
27
sysa/mes-0.22/lib/mes/eputc.c
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* This file is part of GNU Mes.
|
||||
*
|
||||
* GNU Mes is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* GNU Mes is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <mes/lib.h>
|
||||
|
||||
int
|
||||
eputc (int c)
|
||||
{
|
||||
return fdputc (c, __stderr);
|
||||
}
|
||||
30
sysa/mes-0.22/lib/mes/eputs.c
Normal file
30
sysa/mes-0.22/lib/mes/eputs.c
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* This file is part of GNU Mes.
|
||||
*
|
||||
* GNU Mes is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* GNU Mes is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <mes/lib.h>
|
||||
#include <string.h>
|
||||
|
||||
int
|
||||
eputs (char const *s)
|
||||
{
|
||||
int i = strlen (s);
|
||||
write (__stderr, s, i);
|
||||
return 0;
|
||||
}
|
||||
74
sysa/mes-0.22/lib/mes/fdgetc.c
Normal file
74
sysa/mes-0.22/lib/mes/fdgetc.c
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* This file is part of GNU Mes.
|
||||
*
|
||||
* GNU Mes is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* GNU Mes is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <mes/lib.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include <sys/resource.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int __ungetc_buf[__FILEDES_MAX + 1] = { 0 };
|
||||
|
||||
int
|
||||
__ungetc_p (int filedes)
|
||||
{
|
||||
return __ungetc_buf[filedes] >= 0;
|
||||
}
|
||||
|
||||
void
|
||||
__ungetc_init ()
|
||||
{
|
||||
if (__ungetc_buf[__FILEDES_MAX] == 0)
|
||||
memset (__ungetc_buf, -1, (__FILEDES_MAX + 1) * sizeof (int));
|
||||
}
|
||||
|
||||
void
|
||||
__ungetc_clear (int filedes)
|
||||
{
|
||||
__ungetc_buf[filedes] = -1;
|
||||
}
|
||||
|
||||
void
|
||||
__ungetc_set (int filedes, int c)
|
||||
{
|
||||
__ungetc_buf[filedes] = c;
|
||||
}
|
||||
|
||||
int
|
||||
fdgetc (int fd)
|
||||
{
|
||||
__ungetc_init ();
|
||||
|
||||
char c;
|
||||
int i = __ungetc_buf[fd];
|
||||
if (i >= 0)
|
||||
__ungetc_buf[fd] = -1;
|
||||
else
|
||||
{
|
||||
int r = read (fd, &c, 1);
|
||||
if (r < 1)
|
||||
return -1;
|
||||
i = (int) c;
|
||||
}
|
||||
if (i < 0)
|
||||
i += 256;
|
||||
|
||||
return i;
|
||||
}
|
||||
40
sysa/mes-0.22/lib/mes/fdgets.c
Normal file
40
sysa/mes-0.22/lib/mes/fdgets.c
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* This file is part of GNU Mes.
|
||||
*
|
||||
* GNU Mes is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* GNU Mes is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <mes/lib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
char *
|
||||
fdgets (char *s, int count, int fd)
|
||||
{
|
||||
int c = 0;
|
||||
char *p = s;
|
||||
while (--count > 0 && c != '\n')
|
||||
{
|
||||
c = fdgetc (fd);
|
||||
if (c == EOF)
|
||||
break;
|
||||
*p++ = c;
|
||||
}
|
||||
if (p == s && (c == EOF || count == -1))
|
||||
return 0;
|
||||
*p = 0;
|
||||
return s;
|
||||
}
|
||||
28
sysa/mes-0.22/lib/mes/fdputc.c
Normal file
28
sysa/mes-0.22/lib/mes/fdputc.c
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* This file is part of GNU Mes.
|
||||
*
|
||||
* GNU Mes is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* GNU Mes is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <mes/lib.h>
|
||||
|
||||
int
|
||||
fdputc (int c, int fd)
|
||||
{
|
||||
write (fd, (char *) &c, 1);
|
||||
return 0;
|
||||
}
|
||||
30
sysa/mes-0.22/lib/mes/fdputs.c
Normal file
30
sysa/mes-0.22/lib/mes/fdputs.c
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* This file is part of GNU Mes.
|
||||
*
|
||||
* GNU Mes is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* GNU Mes is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <mes/lib.h>
|
||||
#include <string.h>
|
||||
|
||||
int
|
||||
fdputs (char const *s, int fd)
|
||||
{
|
||||
int i = strlen (s);
|
||||
write (fd, s, i);
|
||||
return 0;
|
||||
}
|
||||
39
sysa/mes-0.22/lib/mes/fdungetc.c
Normal file
39
sysa/mes-0.22/lib/mes/fdungetc.c
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* This file is part of GNU Mes.
|
||||
*
|
||||
* GNU Mes is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* GNU Mes is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <mes/lib.h>
|
||||
#include <assert.h>
|
||||
|
||||
int
|
||||
fdungetc (int c, int fd)
|
||||
{
|
||||
__ungetc_init ();
|
||||
if (c == -1)
|
||||
return c;
|
||||
else if (__ungetc_p (fd))
|
||||
{
|
||||
eputs (" ***MES C LIB*** fdungetc ungetc buffer overflow fd=");
|
||||
eputs (itoa (fd));
|
||||
eputs ("\n");
|
||||
assert (0);
|
||||
}
|
||||
__ungetc_set (fd, c);
|
||||
return c;
|
||||
}
|
||||
27
sysa/mes-0.22/lib/mes/itoa.c
Normal file
27
sysa/mes-0.22/lib/mes/itoa.c
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* This file is part of GNU Mes.
|
||||
*
|
||||
* GNU Mes is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* GNU Mes is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <mes/lib.h>
|
||||
|
||||
char *
|
||||
itoa (int x)
|
||||
{
|
||||
return ntoab (x, 10, 1);
|
||||
}
|
||||
27
sysa/mes-0.22/lib/mes/ltoa.c
Normal file
27
sysa/mes-0.22/lib/mes/ltoa.c
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* This file is part of GNU Mes.
|
||||
*
|
||||
* GNU Mes is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* GNU Mes is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <mes/lib.h>
|
||||
|
||||
char *
|
||||
ltoa (long x)
|
||||
{
|
||||
return ntoab (x, 10, 1);
|
||||
}
|
||||
27
sysa/mes-0.22/lib/mes/ltoab.c
Normal file
27
sysa/mes-0.22/lib/mes/ltoab.c
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* This file is part of GNU Mes.
|
||||
*
|
||||
* GNU Mes is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* GNU Mes is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <mes/lib.h>
|
||||
|
||||
char *
|
||||
ltoab (long x, int base)
|
||||
{
|
||||
return ntoab (x, base, 1);
|
||||
}
|
||||
50
sysa/mes-0.22/lib/mes/mes_open.c
Normal file
50
sysa/mes-0.22/lib/mes/mes_open.c
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* This file is part of GNU Mes.
|
||||
*
|
||||
* GNU Mes is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* GNU Mes is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <mes/lib.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if SYSTEM_LIBC
|
||||
#include <fcntl.h>
|
||||
#include <stdarg.h>
|
||||
// The Mes C Library defines and initializes these in crt1
|
||||
int __stdin = STDIN;
|
||||
int __stdout = STDOUT;
|
||||
int __stderr = STDERR;
|
||||
|
||||
int
|
||||
mes_open (char const *file_name, int flags, int mask)
|
||||
{
|
||||
__ungetc_init ();
|
||||
int filedes = open (file_name, flags, mask);
|
||||
if (filedes > 2)
|
||||
__ungetc_clear (filedes);
|
||||
return filedes;
|
||||
}
|
||||
|
||||
#else // !SYSTEM_LIBC
|
||||
|
||||
int
|
||||
mes_open (char const *file_name, int flags, int mask)
|
||||
{
|
||||
return _open3 (file_name, flags, mask);
|
||||
}
|
||||
|
||||
#endif // !SYSTEM_LIBC
|
||||
36
sysa/mes-0.22/lib/mes/mini-write.c
Normal file
36
sysa/mes-0.22/lib/mes/mini-write.c
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* This file is part of GNU Mes.
|
||||
*
|
||||
* GNU Mes is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* GNU Mes is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <mes/lib.h>
|
||||
#include <errno.h>
|
||||
|
||||
ssize_t
|
||||
write (int filedes, void const *buffer, size_t size)
|
||||
{
|
||||
int r = _write (filedes, buffer, size);
|
||||
if (r < 0)
|
||||
{
|
||||
errno = -r;
|
||||
r = -1;
|
||||
}
|
||||
else
|
||||
errno = 0;
|
||||
return r;
|
||||
}
|
||||
59
sysa/mes-0.22/lib/mes/ntoab.c
Normal file
59
sysa/mes-0.22/lib/mes/ntoab.c
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* This file is part of GNU Mes.
|
||||
*
|
||||
* GNU Mes is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* GNU Mes is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <mes/lib.h>
|
||||
|
||||
char *
|
||||
ntoab (long x, int base, int signed_p)
|
||||
{
|
||||
static char itoa_buf[20];
|
||||
char *p = itoa_buf + 11;
|
||||
*p-- = 0;
|
||||
assert(base > 0);
|
||||
|
||||
int sign_p = 0;
|
||||
unsigned long u;
|
||||
if (signed_p && x < 0)
|
||||
{
|
||||
sign_p = 1;
|
||||
u = -x;
|
||||
}
|
||||
else
|
||||
u = x;
|
||||
|
||||
do
|
||||
{
|
||||
unsigned long i;
|
||||
#if __MESC__ && __arm__
|
||||
u = __mesabi_uldiv (u, (unsigned long) base, &i);
|
||||
#else
|
||||
i = u % base;
|
||||
u = u / base;
|
||||
#endif
|
||||
*p-- = i > 9 ? 'a' + i - 10 : '0' + i;
|
||||
}
|
||||
while (u);
|
||||
|
||||
if (sign_p && *(p + 1) != '0')
|
||||
*p-- = '-';
|
||||
|
||||
return p + 1;
|
||||
}
|
||||
27
sysa/mes-0.22/lib/mes/oputc.c
Normal file
27
sysa/mes-0.22/lib/mes/oputc.c
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* This file is part of GNU Mes.
|
||||
*
|
||||
* GNU Mes is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* GNU Mes is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <mes/lib.h>
|
||||
|
||||
int
|
||||
oputc (int c)
|
||||
{
|
||||
return fdputc (c, __stdout);
|
||||
}
|
||||
30
sysa/mes-0.22/lib/mes/oputs.c
Normal file
30
sysa/mes-0.22/lib/mes/oputs.c
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* This file is part of GNU Mes.
|
||||
*
|
||||
* GNU Mes is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* GNU Mes is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <mes/lib.h>
|
||||
#include <string.h>
|
||||
|
||||
int
|
||||
oputs (char const *s)
|
||||
{
|
||||
int i = strlen (s);
|
||||
write (__stdout, s, i);
|
||||
return 0;
|
||||
}
|
||||
66
sysa/mes-0.22/lib/mes/search-path.c
Normal file
66
sysa/mes-0.22/lib/mes/search-path.c
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* This file is part of GNU Mes.
|
||||
*
|
||||
* GNU Mes is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* GNU Mes is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <mes/lib.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
char *
|
||||
search_path (char const *file_name)
|
||||
{
|
||||
static char buf[256];
|
||||
char *path = getenv ("PATH");
|
||||
if (__mes_debug ())
|
||||
{
|
||||
eputs ("\n search-path: ");
|
||||
eputs (file_name);
|
||||
eputs ("\n");
|
||||
}
|
||||
while (*path)
|
||||
{
|
||||
char *end = strchr (path, ':');
|
||||
if (!end)
|
||||
end = strchr (path, '\0');
|
||||
strncpy (buf, path, end - path);
|
||||
buf[end - path] = 0;
|
||||
if (__mes_debug ())
|
||||
{
|
||||
eputs (" dir: ");
|
||||
eputs (buf);
|
||||
eputs ("\n");
|
||||
}
|
||||
if (buf[end - path] != '/')
|
||||
strcat (buf, "/");
|
||||
strcat (buf, file_name);
|
||||
if (!access (buf, X_OK))
|
||||
{
|
||||
if (__mes_debug ())
|
||||
{
|
||||
eputs (" found: ");
|
||||
eputs (buf);
|
||||
eputs ("\n");
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
path = end + 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
27
sysa/mes-0.22/lib/mes/ultoa.c
Normal file
27
sysa/mes-0.22/lib/mes/ultoa.c
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* This file is part of GNU Mes.
|
||||
*
|
||||
* GNU Mes is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* GNU Mes is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <mes/lib.h>
|
||||
|
||||
char *
|
||||
ultoa (unsigned long x)
|
||||
{
|
||||
return ntoab (x, 10, 1);
|
||||
}
|
||||
27
sysa/mes-0.22/lib/mes/utoa.c
Normal file
27
sysa/mes-0.22/lib/mes/utoa.c
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* This file is part of GNU Mes.
|
||||
*
|
||||
* GNU Mes is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* GNU Mes is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <mes/lib.h>
|
||||
|
||||
char *
|
||||
utoa (unsigned x)
|
||||
{
|
||||
return ntoab (x, 10, 0);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue