mescc: Mes C Library: Explode libc+gnu.c.
* modified: include/math.h: Add declarations. * lib/posix/getopt.c: Rename from lib/getopt.c. * lib/gcc.c: Remove. * lib/m4.c: Remove. * lib/ctype/isalnum.c: New file, explode from libc+gnu.c. * lib/ctype/isalpha.c: Likewise. * lib/ctype/isascii.c: Likewise. * lib/ctype/iscntrl.c: Likewise. * lib/ctype/isnumber.c: Likewise. * lib/ctype/isprint.c: Likewise. * lib/ctype/ispunct.c: Likewise. * lib/math/fabs.c: Likewise. * lib/posix/alarm.c: Likewise. * lib/posix/mktemp.c: Likewise. * lib/posix/raise.c: Likewise. * lib/posix/sbrk.c: Likewise. * lib/posix/sleep.c: Likewise. * lib/posix/unsetenv.c: Likewise. * lib/stdio/clearerr.c: Likewise. * lib/stdio/fdgets.c: Likewise. * lib/stdio/feof.c: Likewise. * lib/stdio/fgets.c: Likewise. * lib/stdio/fileno.c: Likewise. * lib/stdio/freeopen.c: Likewise. * lib/stdio/freopen.c: Likewise. * lib/stdio/perror.c: Likewise. * lib/stdlib/__exit.c: Likewise. * lib/stdlib/abs.c: Likewise. * lib/stdlib/atexit.c: Likewise. * lib/stdlib/atol.c: Likewise. * lib/stdlib/bsearch.c: Likewise. * lib/stdlib/mbstowcs.c: Likewise. * lib/string/bcmp.c: Likewise. * lib/string/bcopy.c: Likewise. * lib/string/bzero.c: Likewise. * lib/string/index.c: Likewise. * lib/string/rindex.c: Likewise. * lib/string/strcspn.c: Likewise. * lib/string/strdup.c: Likewise. * lib/string/strerror.c: Likewise. * lib/string/strncat.c: Likewise. * lib/string/strpbrk.c: Likewise. * lib/string/strspn.c: Likewise. * lib/stub/__cleanup.c: Likewise. * lib/stub/atof.c: Likewise. * lib/stub/chown.c: Likewise. * lib/stub/ctime.c: Likewise. * lib/stub/fpurge.c: Likewise. * lib/stub/freadahead.c: Likewise. * lib/stub/frexp.c: Likewise. * lib/stub/fscanf.c: Likewise. * lib/stub/getpwnam.c: Likewise. * lib/stub/gmtime.c: Likewise. * lib/stub/pclose.c: Likewise. * lib/stub/popen.c: Likewise. * lib/stub/rewind.c: Likewise. * lib/stub/setbuf.c: Likewise. * lib/stub/sigsetmask.c: Likewise. * lib/stub/strftime.c: Likewise. * lib/stub/sys_siglist.c: Likewise. * lib/stub/system.c: Likewise. * lib/stub/times.c: Likewise. * lib/stub/umask.c: Likewise. * lib/stub/utime.c: Likewise. * lib/libc+gnu.c: Include explodings. * lib/libg.c: Likewise. * lib/libgetopt.c: Include explodings.
This commit is contained in:
parent
e9d9e80980
commit
457d120770
|
@ -27,5 +27,6 @@
|
|||
double ldexp (double x, int exp);
|
||||
#endif // ! WITH_GLIBC
|
||||
|
||||
#endif // __MES_MATH_H
|
||||
double fabs (double number);
|
||||
|
||||
#endif // __MES_MATH_H
|
||||
|
|
306
lib/binutils.c
306
lib/binutils.c
|
@ -1,306 +0,0 @@
|
|||
/* -*-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 <libmes.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int
|
||||
abs (int x)
|
||||
{
|
||||
if (x < 0)
|
||||
return -x;
|
||||
return x;
|
||||
}
|
||||
|
||||
int
|
||||
chown (char const *file_name, uid_t owner, gid_t group)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("chown stub\n");
|
||||
stub = 1;
|
||||
errno = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
ctime (int x)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("ctime stub\n");
|
||||
stub = 1;
|
||||
errno = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
int
|
||||
feof (FILE *stream)
|
||||
{
|
||||
char c = fgetc (stream);
|
||||
if (c != EOF)
|
||||
ungetc (c, stream);
|
||||
return c == EOF;
|
||||
}
|
||||
|
||||
char *
|
||||
fgets (char *s, int count, FILE *stream)
|
||||
{
|
||||
return fdgets (s, count, (int)stream);
|
||||
}
|
||||
|
||||
int
|
||||
frexp (int x)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("frexp stub\n");
|
||||
stub = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
perror (char const *message)
|
||||
{
|
||||
fprintf (stderr, "%s: %s\n", strerror (errno), message);
|
||||
}
|
||||
|
||||
int
|
||||
sigsetmask (int x)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("sigsetmask stub\n");
|
||||
stub = 1;
|
||||
errno = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t
|
||||
strcspn (char const *string, char const *stopset)
|
||||
{
|
||||
char *p = string;
|
||||
while (*p)
|
||||
if (strchr (stopset, *p))
|
||||
break;
|
||||
else
|
||||
p++;
|
||||
return p - string;
|
||||
}
|
||||
|
||||
char *
|
||||
strncat (char *to, char const *from, size_t size)
|
||||
{
|
||||
if (size == 0)
|
||||
return to;
|
||||
char *p = strchr (to , '\0');
|
||||
while (*from && size-- > 0)
|
||||
*p++ = *from++;
|
||||
*p = 0;
|
||||
return to;
|
||||
}
|
||||
|
||||
char *
|
||||
strpbrk (char const *string, char const* stopset)
|
||||
{
|
||||
char *p = string;
|
||||
while (*p)
|
||||
if (strchr (stopset, *p))
|
||||
break;
|
||||
else
|
||||
p++;
|
||||
return p;
|
||||
}
|
||||
|
||||
size_t
|
||||
strspn (char const *string, char const *skipset)
|
||||
{
|
||||
char *p = string;
|
||||
while (*p)
|
||||
if (!strchr (skipset, *p))
|
||||
break;
|
||||
else
|
||||
p++;
|
||||
return p - string;
|
||||
}
|
||||
|
||||
int
|
||||
sys_siglist (int x)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("sys_siglist stub\n");
|
||||
stub = 1;
|
||||
errno = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
umask (int x)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("umask stub\n");
|
||||
stub = 1;
|
||||
errno = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
utime (int x)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("utime stub\n");
|
||||
errno = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// binutils-2.10.1
|
||||
int
|
||||
fscanf (FILE *stream, char const *template, ...)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("fscan stub\n");
|
||||
stub = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
isascii (int c)
|
||||
{
|
||||
return c >= 0 && c <= 127;
|
||||
}
|
||||
|
||||
void *
|
||||
#if __MESC__
|
||||
bsearch (void const *key, void const *array, size_t count, size_t size, void (*compare) ())
|
||||
#else
|
||||
bsearch (void const *key, void const *array, size_t count, size_t size, comparison_fn_t compare)
|
||||
#endif
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("bsearch stub\n");
|
||||
stub = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct tm *
|
||||
gmtime (time_t const *time)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("gmtime stub\n");
|
||||
stub = 1;
|
||||
errno = 0;
|
||||
return localtime (time);
|
||||
}
|
||||
|
||||
#if __SBRK_CHAR_PTRDIFF
|
||||
char *
|
||||
sbrk (ptrdiff_t)
|
||||
#else
|
||||
void *
|
||||
sbrk (intptr_t delta)
|
||||
#endif
|
||||
{
|
||||
if (delta >= 0)
|
||||
return malloc (delta);
|
||||
return __brk;
|
||||
}
|
||||
|
||||
// binutils 2.30
|
||||
char *
|
||||
strdup (char const *s)
|
||||
{
|
||||
size_t length = strlen (s) + 1;
|
||||
char *p = (char*)malloc (length);
|
||||
if (p)
|
||||
return memcpy (p, s, length);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
raise (int signum)
|
||||
{
|
||||
kill (getpid (), signum);
|
||||
}
|
||||
|
||||
size_t
|
||||
strftime (char *s, size_t size, char const *template,
|
||||
struct tm const *brokentime)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("strftime stub\n");
|
||||
stub = 1;
|
||||
return template;
|
||||
}
|
||||
|
||||
#if !__MESC__
|
||||
typedef char wchar_t[];
|
||||
|
||||
size_t
|
||||
mbstowcs (wchar_t *wstring, char const *string,
|
||||
size_t size)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("mbstowcs stub\n");
|
||||
stub = 1;
|
||||
strcpy (wstring, string);
|
||||
return strlen (string);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
clearerr (FILE *stream)
|
||||
{
|
||||
errno = 0;
|
||||
}
|
||||
|
||||
double
|
||||
fabs (double number)
|
||||
{
|
||||
if (number < 0)
|
||||
return -number;
|
||||
return number;
|
||||
}
|
27
lib/ctype/isalnum.c
Normal file
27
lib/ctype/isalnum.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 <ctype.h>
|
||||
|
||||
int
|
||||
isalnum (int c)
|
||||
{
|
||||
return isdigit (c) || isalpha (c);
|
||||
}
|
27
lib/ctype/isalpha.c
Normal file
27
lib/ctype/isalpha.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 <ctype.h>
|
||||
|
||||
int
|
||||
isalpha (int c)
|
||||
{
|
||||
return islower (c) || isupper (c);
|
||||
}
|
27
lib/ctype/isascii.c
Normal file
27
lib/ctype/isascii.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 <ctype.h>
|
||||
|
||||
int
|
||||
isascii (int c)
|
||||
{
|
||||
return c >= 0 && c <= 127;
|
||||
}
|
27
lib/ctype/iscntrl.c
Normal file
27
lib/ctype/iscntrl.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 <ctype.h>
|
||||
|
||||
int
|
||||
iscntrl (int c)
|
||||
{
|
||||
return c >= 0 && c < 32;
|
||||
}
|
|
@ -18,7 +18,7 @@
|
|||
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <libmes.h>
|
||||
#include <ctype.h>
|
||||
|
||||
int
|
||||
isnumber (int c, int base)
|
||||
|
|
27
lib/ctype/isprint.c
Normal file
27
lib/ctype/isprint.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 <ctype.h>
|
||||
|
||||
int
|
||||
isprint (int c)
|
||||
{
|
||||
return c >= 32 && c < 127;
|
||||
}
|
27
lib/ctype/ispunct.c
Normal file
27
lib/ctype/ispunct.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 <ctype.h>
|
||||
|
||||
int
|
||||
ispunct (int c)
|
||||
{
|
||||
return isprint (c) && !isspace (c) && !isalnum (c);
|
||||
}
|
107
lib/gcc.c
107
lib/gcc.c
|
@ -1,107 +0,0 @@
|
|||
/* -*-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 <libmes.h>
|
||||
#include <stdint.h>
|
||||
#include <time.h>
|
||||
#include <sys/times.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
FILE *
|
||||
freopen (char const *file_name, char const *opentype, FILE *stream)
|
||||
{
|
||||
fclose (stream);
|
||||
return fopen (file_name, opentype);
|
||||
}
|
||||
|
||||
clock_t
|
||||
times (struct tms *buffer)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("times stub\n");
|
||||
stub = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int
|
||||
sleep (unsigned int seconds)
|
||||
{
|
||||
struct timespec requested_time;
|
||||
struct timespec remaining;
|
||||
requested_time.tv_sec = seconds;
|
||||
requested_time.tv_nsec = 0;
|
||||
return nanosleep (&requested_time, &remaining);
|
||||
}
|
||||
|
||||
// gcc-3.4
|
||||
void
|
||||
unsetenv (char const *name)
|
||||
{
|
||||
int length = strlen (name);
|
||||
char **p = environ;
|
||||
while (*p)
|
||||
{
|
||||
if (!strncmp (name, *p, length) && *(*p + length) == '=')
|
||||
{
|
||||
char **q = p;
|
||||
q[0] = q[1];
|
||||
while (*q++)
|
||||
q[0] = q[1];
|
||||
}
|
||||
p++;
|
||||
}
|
||||
}
|
||||
|
||||
// gcc-3.0
|
||||
int
|
||||
atexit (void (*function) (void))
|
||||
{
|
||||
__call_at_exit = function;
|
||||
}
|
||||
|
||||
unsigned int
|
||||
alarm (unsigned int seconds)
|
||||
{
|
||||
#if !__MESC__
|
||||
struct itimerval old;
|
||||
struct itimerval new;
|
||||
new.it_interval.tv_usec = 0;
|
||||
new.it_interval.tv_sec = 0;
|
||||
new.it_value.tv_usec = 0;
|
||||
new.it_value.tv_sec = (long int) seconds;
|
||||
if (setitimer (ITIMER_REAL, &new, &old) < 0)
|
||||
return 0;
|
||||
return old.it_value.tv_sec;
|
||||
#endif
|
||||
}
|
||||
|
||||
// gcc-2.95.3
|
||||
|
||||
struct passwd *
|
||||
getpwnam (const char *NAME)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("getpwnam stub\n");
|
||||
stub = 1;
|
||||
errno = 0;
|
||||
return 0;
|
||||
}
|
|
@ -28,10 +28,73 @@
|
|||
#error both __GNU__ and _linux__ are undefined, choose one
|
||||
#endif
|
||||
|
||||
#include <m4.c>
|
||||
#include <binutils.c>
|
||||
#include <gcc.c>
|
||||
// m4
|
||||
#include <stdlib/abort.c>
|
||||
#include <stdlib/atol.c>
|
||||
#include <stub/atof.c>
|
||||
#include <string/bcmp.c>
|
||||
#include <string/bcopy.c>
|
||||
#include <string/bzero.c>
|
||||
#include <stdio/fileno.c>
|
||||
#include <stub/fpurge.c>
|
||||
#include <stub/freadahead.c>
|
||||
#include <string/index.c>
|
||||
#include <ctype/isalnum.c>
|
||||
#include <ctype/isalpha.c>
|
||||
#include <ctype/iscntrl.c>
|
||||
#include <ctype/isprint.c>
|
||||
#include <ctype/ispunct.c>
|
||||
#include <posix/mktemp.c>
|
||||
#include <stub/pclose.c>
|
||||
#include <stub/popen.c>
|
||||
#include <string/rindex.c>
|
||||
#include <stub/rewind.c>
|
||||
#include <stub/setbuf.c>
|
||||
#include <stub/system.c>
|
||||
#include <string/strerror.c>
|
||||
|
||||
// binutils
|
||||
#include <stdlib/abs.c>
|
||||
#include <stub/chown.c>
|
||||
#include <stub/ctime.c>
|
||||
#include <stdio/fdgets.c>
|
||||
#include <stdio/feof.c>
|
||||
#include <stdio/fgets.c>
|
||||
#include <stub/frexp.c>
|
||||
#include <stdio/perror.c>
|
||||
#include <stub/sigsetmask.c>
|
||||
#include <string/strcspn.c>
|
||||
#include <string/strncat.c>
|
||||
#include <string/strpbrk.c>
|
||||
#include <string/strspn.c>
|
||||
#include <stub/sys_siglist.c>
|
||||
#include <stub/umask.c>
|
||||
#include <stub/utime.c>
|
||||
#include <stub/fscanf.c>
|
||||
#include <ctype/isascii.c>
|
||||
#include <stdlib/bsearch.c>
|
||||
#include <stub/gmtime.c>
|
||||
#include <posix/sbrk.c>
|
||||
#include <string/strdup.c>
|
||||
#include <posix/raise.c>
|
||||
#include <stub/strftime.c>
|
||||
#include <stdlib/mbstowcs.c>
|
||||
#include <stdio/clearerr.c>
|
||||
#include <math/fabs.c>
|
||||
|
||||
// gcc
|
||||
|
||||
#include <stdio/freopen.c>
|
||||
#include <stub/times.c>
|
||||
#include <posix/sleep.c>
|
||||
#include <posix/unsetenv.c>
|
||||
#include <stdlib/atexit.c>
|
||||
#include <posix/alarm.c>
|
||||
#include <stub/getpwnam.c>
|
||||
|
||||
#if !__GNU__
|
||||
#include <stdlib/alloca.c>
|
||||
#endif
|
||||
#include <glibc.c>
|
||||
|
||||
#include <stdlib/__exit.c>
|
||||
#include <stub/__cleanup.c>
|
||||
|
|
80
lib/libg.c
80
lib/libg.c
|
@ -46,19 +46,75 @@
|
|||
#error both __GNU__ and _linux__ are undefined, choose one
|
||||
#endif
|
||||
|
||||
#include <m4.c>
|
||||
#include <binutils.c>
|
||||
#include <gcc.c>
|
||||
// m4
|
||||
#include <stdlib/abort.c>
|
||||
#include <stub/atof.c>
|
||||
#include <string/bcmp.c>
|
||||
#include <string/bcopy.c>
|
||||
#include <string/bzero.c>
|
||||
#include <stdio/fileno.c>
|
||||
#include <stub/fpurge.c>
|
||||
#include <stub/freadahead.c>
|
||||
#include <string/index.c>
|
||||
#include <ctype/isalnum.c>
|
||||
#include <ctype/isalpha.c>
|
||||
#include <ctype/iscntrl.c>
|
||||
#include <ctype/isprint.c>
|
||||
#include <ctype/ispunct.c>
|
||||
#include <posix/mktemp.c>
|
||||
#include <stub/pclose.c>
|
||||
#include <stub/popen.c>
|
||||
#include <string/rindex.c>
|
||||
#include <stub/rewind.c>
|
||||
#include <stub/setbuf.c>
|
||||
#include <stub/system.c>
|
||||
#include <string/strerror.c>
|
||||
|
||||
int
|
||||
__cleanup ()
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("__cleanup stub\n");
|
||||
stub = 1;
|
||||
return 0;
|
||||
}
|
||||
// binutils
|
||||
#include <stdlib/abs.c>
|
||||
#include <stub/chown.c>
|
||||
#include <stub/ctime.c>
|
||||
#include <stdio/fdgets.c>
|
||||
#include <stdio/feof.c>
|
||||
#include <stdio/fgets.c>
|
||||
#include <stub/frexp.c>
|
||||
#include <stdio/perror.c>
|
||||
#include <stub/sigsetmask.c>
|
||||
#include <string/strcspn.c>
|
||||
#include <string/strncat.c>
|
||||
#include <string/strpbrk.c>
|
||||
#include <string/strspn.c>
|
||||
#include <stub/sys_siglist.c>
|
||||
#include <stub/umask.c>
|
||||
#include <stub/utime.c>
|
||||
#include <stub/fscanf.c>
|
||||
#include <ctype/isascii.c>
|
||||
#include <stdlib/bsearch.c>
|
||||
#include <stub/gmtime.c>
|
||||
#include <posix/sbrk.c>
|
||||
#include <string/strdup.c>
|
||||
#include <posix/raise.c>
|
||||
#include <stub/strftime.c>
|
||||
#include <stdlib/mbstowcs.c>
|
||||
#include <stdio/clearerr.c>
|
||||
#include <math/fabs.c>
|
||||
|
||||
// gcc
|
||||
|
||||
#include <stdio/freopen.c>
|
||||
#include <stub/times.c>
|
||||
#include <posix/sleep.c>
|
||||
#include <posix/unsetenv.c>
|
||||
#include <stdlib/atexit.c>
|
||||
#include <posix/alarm.c>
|
||||
#include <stub/getpwnam.c>
|
||||
|
||||
#if !__GNU__
|
||||
#include <stdlib/alloca.c>
|
||||
#endif
|
||||
|
||||
//#include <stdlib/__exit.c>
|
||||
#include <stub/__cleanup.c>
|
||||
|
||||
int
|
||||
__libc_subinit ()
|
||||
|
|
|
@ -18,4 +18,4 @@
|
|||
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <getopt.c>
|
||||
#include <posix/getopt.c>
|
||||
|
|
253
lib/m4.c
253
lib/m4.c
|
@ -1,253 +0,0 @@
|
|||
/* -*-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 <ctype.h>
|
||||
|
||||
#include "stdlib/abort.c"
|
||||
|
||||
int
|
||||
atof (int x)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("atof stub\n");
|
||||
stub = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
atol (char const *s)
|
||||
{
|
||||
return atoi (s);
|
||||
}
|
||||
|
||||
int
|
||||
bcmp (void const *s1, void const *s2, size_t size)
|
||||
{
|
||||
return memcmp (s1, s2, size);
|
||||
}
|
||||
|
||||
void
|
||||
bcopy (void const *src, void *dest, size_t n)
|
||||
{
|
||||
memmove (dest, src, n);
|
||||
}
|
||||
|
||||
int
|
||||
bzero (void *block, size_t size)
|
||||
{
|
||||
return memset (block, 0, size);
|
||||
}
|
||||
|
||||
int
|
||||
fileno (FILE *stream)
|
||||
{
|
||||
return (int)stream;
|
||||
}
|
||||
|
||||
int
|
||||
fpurge (FILE *stream)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("fpurge stub\n");
|
||||
stub = 1;
|
||||
errno = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t
|
||||
freadahead (FILE *fp)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("freadahead stub\n");
|
||||
stub = 1;
|
||||
errno = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
index (char const *s, int c)
|
||||
{
|
||||
return strchr (s, c);
|
||||
}
|
||||
|
||||
int
|
||||
isalnum (int c)
|
||||
{
|
||||
return isdigit (c) || isalpha (c);
|
||||
}
|
||||
|
||||
int
|
||||
isalpha (int c)
|
||||
{
|
||||
return islower (c) || isupper (c);
|
||||
}
|
||||
|
||||
int
|
||||
iscntrl (int c)
|
||||
{
|
||||
return c >= 0 && c < 32;
|
||||
}
|
||||
|
||||
int
|
||||
isprint (int c)
|
||||
{
|
||||
return c >= 32 && c < 127;
|
||||
}
|
||||
|
||||
int
|
||||
ispunct (int c)
|
||||
{
|
||||
return isprint (c) && !isspace (c) && !isalnum (c);
|
||||
}
|
||||
|
||||
char *
|
||||
mktemp (char *template)
|
||||
{
|
||||
char *p = strchr (template, '\0');
|
||||
int q = (int)template;
|
||||
*--p = ((unsigned char)(q >> 4)) % 26 + 'a';
|
||||
*--p = ((unsigned char)(q >> 8)) % 26 + 'a';
|
||||
*--p = ((unsigned char)(q >> 12)) % 26 + 'a';
|
||||
*--p = ((unsigned char)(q >> 16)) % 26 + 'a';
|
||||
*--p = ((unsigned char)(q >> 20)) % 26 + 'a';
|
||||
*--p = ((unsigned char)(q >> 24)) % 26 + 'a';
|
||||
return template;
|
||||
}
|
||||
|
||||
int
|
||||
pclose (int x)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("pclose stub\n");
|
||||
stub = 1;
|
||||
errno = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
popen (int x)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("popen stub\n");
|
||||
stub = 1;
|
||||
errno = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
rindex (char const *s, int c)
|
||||
{
|
||||
return strrchr (s, c);
|
||||
}
|
||||
|
||||
int
|
||||
rewind (int x)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("rewind stub\n");
|
||||
stub = 1;
|
||||
errno = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
setbuf (int x)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("setbuf stub\n");
|
||||
stub = 1;
|
||||
errno = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
system (int x)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("system stub\n");
|
||||
stub = 1;
|
||||
errno = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *sys_errlist[] = {
|
||||
"error 00",
|
||||
"error 01",
|
||||
"error 02",
|
||||
"error 03",
|
||||
"error 04",
|
||||
"error 05",
|
||||
"error 06",
|
||||
"error 07",
|
||||
"error 08",
|
||||
"error 09",
|
||||
"error 10",
|
||||
"error 11",
|
||||
"error 12",
|
||||
"error 13",
|
||||
"error 14",
|
||||
"error 15",
|
||||
"error 16",
|
||||
"error 17",
|
||||
"error 18",
|
||||
"error 19",
|
||||
"error 20",
|
||||
"error 21",
|
||||
"error 22",
|
||||
"error 23",
|
||||
"error 24",
|
||||
"error 25",
|
||||
"error 26",
|
||||
"error 27",
|
||||
"error 28",
|
||||
"error 29",
|
||||
"error 30",
|
||||
"error 31",
|
||||
"error 32",
|
||||
"error 33",
|
||||
"error 34",
|
||||
"error 35",
|
||||
"error 36",
|
||||
"error 37",
|
||||
"error 38",
|
||||
"error 39",
|
||||
};
|
||||
|
||||
int sys_nerr = 39;
|
||||
|
||||
char *
|
||||
strerror (int errnum)
|
||||
{
|
||||
if (__mes_debug ())
|
||||
{
|
||||
eputs ("strerror errnum="); eputs (itoa (errnum)); eputs ("\n");
|
||||
}
|
||||
if (errnum > 0 && errnum <= sys_nerr)
|
||||
return sys_errlist[errnum];
|
||||
return "sterror: unknown error";
|
||||
}
|
29
lib/math/fabs.c
Normal file
29
lib/math/fabs.c
Normal file
|
@ -0,0 +1,29 @@
|
|||
/* -*-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 <math.h>
|
||||
|
||||
double
|
||||
fabs (double number)
|
||||
{
|
||||
if (number < 0)
|
||||
return -number;
|
||||
return number;
|
||||
}
|
37
lib/posix/alarm.c
Normal file
37
lib/posix/alarm.c
Normal file
|
@ -0,0 +1,37 @@
|
|||
/* -*-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 <unistd.h>
|
||||
|
||||
unsigned int
|
||||
alarm (unsigned int seconds)
|
||||
{
|
||||
#if !__MESC__
|
||||
struct itimerval old;
|
||||
struct itimerval new;
|
||||
new.it_interval.tv_usec = 0;
|
||||
new.it_interval.tv_sec = 0;
|
||||
new.it_value.tv_usec = 0;
|
||||
new.it_value.tv_sec = (long int) seconds;
|
||||
if (setitimer (ITIMER_REAL, &new, &old) < 0)
|
||||
return 0;
|
||||
return old.it_value.tv_sec;
|
||||
#endif
|
||||
}
|
35
lib/posix/mktemp.c
Normal file
35
lib/posix/mktemp.c
Normal file
|
@ -0,0 +1,35 @@
|
|||
/* -*-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 <unistd.h>
|
||||
|
||||
char *
|
||||
mktemp (char *template)
|
||||
{
|
||||
char *p = strchr (template, '\0');
|
||||
int q = (int)template;
|
||||
*--p = ((unsigned char)(q >> 4)) % 26 + 'a';
|
||||
*--p = ((unsigned char)(q >> 8)) % 26 + 'a';
|
||||
*--p = ((unsigned char)(q >> 12)) % 26 + 'a';
|
||||
*--p = ((unsigned char)(q >> 16)) % 26 + 'a';
|
||||
*--p = ((unsigned char)(q >> 20)) % 26 + 'a';
|
||||
*--p = ((unsigned char)(q >> 24)) % 26 + 'a';
|
||||
return template;
|
||||
}
|
27
lib/posix/raise.c
Normal file
27
lib/posix/raise.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 <unistd.h>
|
||||
|
||||
int
|
||||
raise (int signum)
|
||||
{
|
||||
kill (getpid (), signum);
|
||||
}
|
34
lib/posix/sbrk.c
Normal file
34
lib/posix/sbrk.c
Normal file
|
@ -0,0 +1,34 @@
|
|||
/* -*-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 <unistd.h>
|
||||
|
||||
#if __SBRK_CHAR_PTRDIFF
|
||||
char *
|
||||
sbrk (ptrdiff_t)
|
||||
#else
|
||||
void *
|
||||
sbrk (intptr_t delta)
|
||||
#endif
|
||||
{
|
||||
if (delta >= 0)
|
||||
return malloc (delta);
|
||||
return __brk;
|
||||
}
|
31
lib/posix/sleep.c
Normal file
31
lib/posix/sleep.c
Normal file
|
@ -0,0 +1,31 @@
|
|||
/* -*-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 <unistd.h>
|
||||
|
||||
unsigned int
|
||||
sleep (unsigned int seconds)
|
||||
{
|
||||
struct timespec requested_time;
|
||||
struct timespec remaining;
|
||||
requested_time.tv_sec = seconds;
|
||||
requested_time.tv_nsec = 0;
|
||||
return nanosleep (&requested_time, &remaining);
|
||||
}
|
39
lib/posix/unsetenv.c
Normal file
39
lib/posix/unsetenv.c
Normal file
|
@ -0,0 +1,39 @@
|
|||
/* -*-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 <unistd.h>
|
||||
|
||||
void
|
||||
unsetenv (char const *name)
|
||||
{
|
||||
int length = strlen (name);
|
||||
char **p = environ;
|
||||
while (*p)
|
||||
{
|
||||
if (!strncmp (name, *p, length) && *(*p + length) == '=')
|
||||
{
|
||||
char **q = p;
|
||||
q[0] = q[1];
|
||||
while (*q++)
|
||||
q[0] = q[1];
|
||||
}
|
||||
p++;
|
||||
}
|
||||
}
|
27
lib/stdio/clearerr.c
Normal file
27
lib/stdio/clearerr.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 <stdio.h>
|
||||
|
||||
void
|
||||
clearerr (FILE *stream)
|
||||
{
|
||||
errno = 0;
|
||||
}
|
39
lib/stdio/fdgets.c
Normal file
39
lib/stdio/fdgets.c
Normal file
|
@ -0,0 +1,39 @@
|
|||
/* -*-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 <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;
|
||||
}
|
30
lib/stdio/feof.c
Normal file
30
lib/stdio/feof.c
Normal file
|
@ -0,0 +1,30 @@
|
|||
/* -*-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 <stdio.h>
|
||||
|
||||
int
|
||||
feof (FILE *stream)
|
||||
{
|
||||
char c = fgetc (stream);
|
||||
if (c != EOF)
|
||||
ungetc (c, stream);
|
||||
return c == EOF;
|
||||
}
|
27
lib/stdio/fgets.c
Normal file
27
lib/stdio/fgets.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 <stdio.h>
|
||||
|
||||
char *
|
||||
fgets (char *s, int count, FILE *stream)
|
||||
{
|
||||
return fdgets (s, count, (int)stream);
|
||||
}
|
27
lib/stdio/fileno.c
Normal file
27
lib/stdio/fileno.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 <stdio.h>
|
||||
|
||||
int
|
||||
fileno (FILE *stream)
|
||||
{
|
||||
return (int)stream;
|
||||
}
|
28
lib/stdio/freeopen.c
Normal file
28
lib/stdio/freeopen.c
Normal file
|
@ -0,0 +1,28 @@
|
|||
/* -*-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 <stdio.h>
|
||||
|
||||
FILE *
|
||||
freopen (char const *file_name, char const *opentype, FILE *stream)
|
||||
{
|
||||
fclose (stream);
|
||||
return fopen (file_name, opentype);
|
||||
}
|
28
lib/stdio/freopen.c
Normal file
28
lib/stdio/freopen.c
Normal file
|
@ -0,0 +1,28 @@
|
|||
/* -*-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 <stdio.h>
|
||||
|
||||
FILE *
|
||||
freopen (char const *file_name, char const *opentype, FILE *stream)
|
||||
{
|
||||
fclose (stream);
|
||||
return fopen (file_name, opentype);
|
||||
}
|
27
lib/stdio/perror.c
Normal file
27
lib/stdio/perror.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 <stdio.h>
|
||||
|
||||
void
|
||||
perror (char const *message)
|
||||
{
|
||||
fprintf (stderr, "%s: %s\n", strerror (errno), message);
|
||||
}
|
25
lib/stdlib/__exit.c
Normal file
25
lib/stdlib/__exit.c
Normal file
|
@ -0,0 +1,25 @@
|
|||
/* -*-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/>.
|
||||
*/
|
||||
|
||||
int
|
||||
__exit (int status)
|
||||
{
|
||||
exit (status);
|
||||
}
|
29
lib/stdlib/abs.c
Normal file
29
lib/stdlib/abs.c
Normal file
|
@ -0,0 +1,29 @@
|
|||
/* -*-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 <stdlib.h>
|
||||
|
||||
int
|
||||
abs (int x)
|
||||
{
|
||||
if (x < 0)
|
||||
return -x;
|
||||
return x;
|
||||
}
|
27
lib/stdlib/atexit.c
Normal file
27
lib/stdlib/atexit.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 <stdlib.h>
|
||||
|
||||
int
|
||||
atexit (void (*function) (void))
|
||||
{
|
||||
__call_at_exit = function;
|
||||
}
|
27
lib/stdlib/atol.c
Normal file
27
lib/stdlib/atol.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 <stdlib.h>
|
||||
|
||||
int
|
||||
atol (char const *s)
|
||||
{
|
||||
return atoi (s);
|
||||
}
|
35
lib/stdlib/bsearch.c
Normal file
35
lib/stdlib/bsearch.c
Normal file
|
@ -0,0 +1,35 @@
|
|||
/* -*-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 <stdlib.h>
|
||||
|
||||
void *
|
||||
#if __MESC__
|
||||
bsearch (void const *key, void const *array, size_t count, size_t size, void (*compare) ())
|
||||
#else
|
||||
bsearch (void const *key, void const *array, size_t count, size_t size, comparison_fn_t compare)
|
||||
#endif
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("bsearch stub\n");
|
||||
stub = 1;
|
||||
return 0;
|
||||
}
|
37
lib/stdlib/mbstowcs.c
Normal file
37
lib/stdlib/mbstowcs.c
Normal file
|
@ -0,0 +1,37 @@
|
|||
/* -*-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 <stdlib.h>
|
||||
|
||||
#if !__MESC__
|
||||
typedef char wchar_t[];
|
||||
|
||||
size_t
|
||||
mbstowcs (wchar_t *wstring, char const *string,
|
||||
size_t size)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("mbstowcs stub\n");
|
||||
stub = 1;
|
||||
strcpy (wstring, string);
|
||||
return strlen (string);
|
||||
}
|
||||
#endif
|
27
lib/string/bcmp.c
Normal file
27
lib/string/bcmp.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 <string.h>
|
||||
|
||||
int
|
||||
bcmp (void const *s1, void const *s2, size_t size)
|
||||
{
|
||||
return memcmp (s1, s2, size);
|
||||
}
|
27
lib/string/bcopy.c
Normal file
27
lib/string/bcopy.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 <string.h>
|
||||
|
||||
void
|
||||
bcopy (void const *src, void *dest, size_t n)
|
||||
{
|
||||
memmove (dest, src, n);
|
||||
}
|
27
lib/string/bzero.c
Normal file
27
lib/string/bzero.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 <string.h>
|
||||
|
||||
int
|
||||
bzero (void *block, size_t size)
|
||||
{
|
||||
return memset (block, 0, size);
|
||||
}
|
27
lib/string/index.c
Normal file
27
lib/string/index.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 <string.h>
|
||||
|
||||
int
|
||||
index (char const *s, int c)
|
||||
{
|
||||
return strchr (s, c);
|
||||
}
|
27
lib/string/rindex.c
Normal file
27
lib/string/rindex.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 <string.h>
|
||||
|
||||
int
|
||||
rindex (char const *s, int c)
|
||||
{
|
||||
return strrchr (s, c);
|
||||
}
|
33
lib/string/strcspn.c
Normal file
33
lib/string/strcspn.c
Normal file
|
@ -0,0 +1,33 @@
|
|||
/* -*-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 <string.h>
|
||||
|
||||
size_t
|
||||
strcspn (char const *string, char const *stopset)
|
||||
{
|
||||
char *p = string;
|
||||
while (*p)
|
||||
if (strchr (stopset, *p))
|
||||
break;
|
||||
else
|
||||
p++;
|
||||
return p - string;
|
||||
}
|
31
lib/string/strdup.c
Normal file
31
lib/string/strdup.c
Normal file
|
@ -0,0 +1,31 @@
|
|||
/* -*-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 <string.h>
|
||||
|
||||
char *
|
||||
strdup (char const *s)
|
||||
{
|
||||
size_t length = strlen (s) + 1;
|
||||
char *p = (char*)malloc (length);
|
||||
if (p)
|
||||
return memcpy (p, s, length);
|
||||
return 0;
|
||||
}
|
79
lib/string/strerror.c
Normal file
79
lib/string/strerror.c
Normal file
|
@ -0,0 +1,79 @@
|
|||
/* -*-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 <string.h>
|
||||
|
||||
char *sys_errlist[] =
|
||||
{
|
||||
"error 00",
|
||||
"error 01",
|
||||
"error 02",
|
||||
"error 03",
|
||||
"error 04",
|
||||
"error 05",
|
||||
"error 06",
|
||||
"error 07",
|
||||
"error 08",
|
||||
"error 09",
|
||||
"error 10",
|
||||
"error 11",
|
||||
"error 12",
|
||||
"error 13",
|
||||
"error 14",
|
||||
"error 15",
|
||||
"error 16",
|
||||
"error 17",
|
||||
"error 18",
|
||||
"error 19",
|
||||
"error 20",
|
||||
"error 21",
|
||||
"error 22",
|
||||
"error 23",
|
||||
"error 24",
|
||||
"error 25",
|
||||
"error 26",
|
||||
"error 27",
|
||||
"error 28",
|
||||
"error 29",
|
||||
"error 30",
|
||||
"error 31",
|
||||
"error 32",
|
||||
"error 33",
|
||||
"error 34",
|
||||
"error 35",
|
||||
"error 36",
|
||||
"error 37",
|
||||
"error 38",
|
||||
"error 39",
|
||||
};
|
||||
|
||||
int sys_nerr = 39;
|
||||
|
||||
char *
|
||||
strerror (int errnum)
|
||||
{
|
||||
if (__mes_debug ())
|
||||
{
|
||||
eputs ("strerror errnum="); eputs (itoa (errnum)); eputs ("\n");
|
||||
}
|
||||
if (errnum > 0 && errnum <= sys_nerr)
|
||||
return sys_errlist[errnum];
|
||||
return "sterror: unknown error";
|
||||
}
|
33
lib/string/strncat.c
Normal file
33
lib/string/strncat.c
Normal file
|
@ -0,0 +1,33 @@
|
|||
/* -*-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 <string.h>
|
||||
|
||||
char *
|
||||
strncat (char *to, char const *from, size_t size)
|
||||
{
|
||||
if (size == 0)
|
||||
return to;
|
||||
char *p = strchr (to , '\0');
|
||||
while (*from && size-- > 0)
|
||||
*p++ = *from++;
|
||||
*p = 0;
|
||||
return to;
|
||||
}
|
33
lib/string/strpbrk.c
Normal file
33
lib/string/strpbrk.c
Normal file
|
@ -0,0 +1,33 @@
|
|||
/* -*-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 <string.h>
|
||||
|
||||
char *
|
||||
strpbrk (char const *string, char const* stopset)
|
||||
{
|
||||
char *p = string;
|
||||
while (*p)
|
||||
if (strchr (stopset, *p))
|
||||
break;
|
||||
else
|
||||
p++;
|
||||
return p;
|
||||
}
|
33
lib/string/strspn.c
Normal file
33
lib/string/strspn.c
Normal file
|
@ -0,0 +1,33 @@
|
|||
/* -*-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 <string.h>
|
||||
|
||||
size_t
|
||||
strspn (char const *string, char const *skipset)
|
||||
{
|
||||
char *p = string;
|
||||
while (*p)
|
||||
if (!strchr (skipset, *p))
|
||||
break;
|
||||
else
|
||||
p++;
|
||||
return p - string;
|
||||
}
|
31
lib/stub/__cleanup.c
Normal file
31
lib/stub/__cleanup.c
Normal file
|
@ -0,0 +1,31 @@
|
|||
/* -*-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 <libmes.h>
|
||||
|
||||
int
|
||||
__cleanup ()
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("__cleanup stub\n");
|
||||
stub = 1;
|
||||
return 0;
|
||||
}
|
31
lib/stub/atof.c
Normal file
31
lib/stub/atof.c
Normal file
|
@ -0,0 +1,31 @@
|
|||
/* -*-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 <libmes.h>
|
||||
|
||||
int
|
||||
atof (int x)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("atof stub\n");
|
||||
stub = 1;
|
||||
return 0;
|
||||
}
|
33
lib/stub/chown.c
Normal file
33
lib/stub/chown.c
Normal file
|
@ -0,0 +1,33 @@
|
|||
/* -*-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 <libmes.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int
|
||||
chown (char const *file_name, uid_t owner, gid_t group)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("chown stub\n");
|
||||
stub = 1;
|
||||
errno = 0;
|
||||
return 0;
|
||||
}
|
32
lib/stub/ctime.c
Normal file
32
lib/stub/ctime.c
Normal file
|
@ -0,0 +1,32 @@
|
|||
/* -*-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 <libmes.h>
|
||||
|
||||
int
|
||||
ctime (int x)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("ctime stub\n");
|
||||
stub = 1;
|
||||
errno = 0;
|
||||
return 0;
|
||||
}
|
33
lib/stub/fpurge.c
Normal file
33
lib/stub/fpurge.c
Normal file
|
@ -0,0 +1,33 @@
|
|||
/* -*-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 <libmes.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
fpurge (FILE *stream)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("fpurge stub\n");
|
||||
stub = 1;
|
||||
errno = 0;
|
||||
return 0;
|
||||
}
|
33
lib/stub/freadahead.c
Normal file
33
lib/stub/freadahead.c
Normal file
|
@ -0,0 +1,33 @@
|
|||
/* -*-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 <libmes.h>
|
||||
#include <stdio.h>
|
||||
|
||||
size_t
|
||||
freadahead (FILE *fp)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("freadahead stub\n");
|
||||
stub = 1;
|
||||
errno = 0;
|
||||
return 0;
|
||||
}
|
31
lib/stub/frexp.c
Normal file
31
lib/stub/frexp.c
Normal file
|
@ -0,0 +1,31 @@
|
|||
/* -*-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 <libmes.h>
|
||||
|
||||
int
|
||||
frexp (int x)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("frexp stub\n");
|
||||
stub = 1;
|
||||
return 0;
|
||||
}
|
32
lib/stub/fscanf.c
Normal file
32
lib/stub/fscanf.c
Normal file
|
@ -0,0 +1,32 @@
|
|||
/* -*-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 <libmes.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
fscanf (FILE *stream, char const *template, ...)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("fscan stub\n");
|
||||
stub = 1;
|
||||
return 0;
|
||||
}
|
33
lib/stub/getpwnam.c
Normal file
33
lib/stub/getpwnam.c
Normal file
|
@ -0,0 +1,33 @@
|
|||
/* -*-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 <libmes.h>
|
||||
#include <pwd.h>
|
||||
|
||||
struct passwd *
|
||||
getpwnam (const char *NAME)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("getpwnam stub\n");
|
||||
stub = 1;
|
||||
errno = 0;
|
||||
return 0;
|
||||
}
|
34
lib/stub/gmtime.c
Normal file
34
lib/stub/gmtime.c
Normal file
|
@ -0,0 +1,34 @@
|
|||
/* -*-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 <libmes.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
struct tm *
|
||||
gmtime (time_t const *time)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("gmtime stub\n");
|
||||
stub = 1;
|
||||
errno = 0;
|
||||
return localtime (time);
|
||||
}
|
32
lib/stub/pclose.c
Normal file
32
lib/stub/pclose.c
Normal file
|
@ -0,0 +1,32 @@
|
|||
/* -*-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 <libmes.h>
|
||||
|
||||
int
|
||||
pclose (int x)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("pclose stub\n");
|
||||
stub = 1;
|
||||
errno = 0;
|
||||
return 0;
|
||||
}
|
32
lib/stub/popen.c
Normal file
32
lib/stub/popen.c
Normal file
|
@ -0,0 +1,32 @@
|
|||
/* -*-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 <libmes.h>
|
||||
|
||||
int
|
||||
popen (int x)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("popen stub\n");
|
||||
stub = 1;
|
||||
errno = 0;
|
||||
return 0;
|
||||
}
|
32
lib/stub/rewind.c
Normal file
32
lib/stub/rewind.c
Normal file
|
@ -0,0 +1,32 @@
|
|||
/* -*-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 <libmes.h>
|
||||
|
||||
int
|
||||
rewind (int x)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("rewind stub\n");
|
||||
stub = 1;
|
||||
errno = 0;
|
||||
return 0;
|
||||
}
|
32
lib/stub/setbuf.c
Normal file
32
lib/stub/setbuf.c
Normal file
|
@ -0,0 +1,32 @@
|
|||
/* -*-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 <libmes.h>
|
||||
|
||||
int
|
||||
setbuf (int x)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("setbuf stub\n");
|
||||
stub = 1;
|
||||
errno = 0;
|
||||
return 0;
|
||||
}
|
32
lib/stub/sigsetmask.c
Normal file
32
lib/stub/sigsetmask.c
Normal file
|
@ -0,0 +1,32 @@
|
|||
/* -*-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 <libmes.h>
|
||||
|
||||
int
|
||||
sigsetmask (int x)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("sigsetmask stub\n");
|
||||
stub = 1;
|
||||
errno = 0;
|
||||
return 0;
|
||||
}
|
32
lib/stub/strftime.c
Normal file
32
lib/stub/strftime.c
Normal file
|
@ -0,0 +1,32 @@
|
|||
/* -*-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 <libmes.h>
|
||||
|
||||
size_t
|
||||
strftime (char *s, size_t size, char const *template,
|
||||
struct tm const *brokentime)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("strftime stub\n");
|
||||
stub = 1;
|
||||
return template;
|
||||
}
|
32
lib/stub/sys_siglist.c
Normal file
32
lib/stub/sys_siglist.c
Normal file
|
@ -0,0 +1,32 @@
|
|||
/* -*-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 <libmes.h>
|
||||
|
||||
int
|
||||
sys_siglist (int x)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("sys_siglist stub\n");
|
||||
stub = 1;
|
||||
errno = 0;
|
||||
return 0;
|
||||
}
|
32
lib/stub/system.c
Normal file
32
lib/stub/system.c
Normal file
|
@ -0,0 +1,32 @@
|
|||
/* -*-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 <libmes.h>
|
||||
|
||||
int
|
||||
system (int x)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("system stub\n");
|
||||
stub = 1;
|
||||
errno = 0;
|
||||
return 0;
|
||||
}
|
33
lib/stub/times.c
Normal file
33
lib/stub/times.c
Normal file
|
@ -0,0 +1,33 @@
|
|||
/* -*-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 <libmes.h>
|
||||
#include <sys/times.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
clock_t
|
||||
times (struct tms *buffer)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("times stub\n");
|
||||
stub = 1;
|
||||
return 0;
|
||||
}
|
32
lib/stub/umask.c
Normal file
32
lib/stub/umask.c
Normal file
|
@ -0,0 +1,32 @@
|
|||
/* -*-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 <libmes.h>
|
||||
|
||||
int
|
||||
umask (int x)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("umask stub\n");
|
||||
stub = 1;
|
||||
errno = 0;
|
||||
return 0;
|
||||
}
|
31
lib/stub/utime.c
Normal file
31
lib/stub/utime.c
Normal file
|
@ -0,0 +1,31 @@
|
|||
/* -*-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 <libmes.h>
|
||||
|
||||
int
|
||||
utime (int x)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("utime stub\n");
|
||||
errno = 0;
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue