1 /* -*-comment-start: "//";comment-end:""-*-
2 * Mes --- Maxwell Equations of Software
3 * Copyright © 2017 Jan Nieuwenhuizen <janneke@gnu.org>
5 * This file is part of Mes.
7 * Mes is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or (at
10 * your option) any later version.
12 * Mes is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Mes. If not, see <http://www.gnu.org/licenses/>.
41 asm ("mov____0x8(%ebp),%ebx !8");
43 asm ("mov____$i32,%eax SYS_close");
48 unlink (char const *file_name)
50 asm ("mov____0x8(%ebp),%ebx !8");
52 asm ("mov____$i32,%eax SYS_unlink");
57 lseek (int fd, off_t offset, int whence)
59 asm ("mov____0x8(%ebp),%ebx !8");
60 asm ("mov____0x8(%ebp),%ecx !12");
61 asm ("mov____0x8(%ebp),%edx !16");
63 asm ("mov____$i32,%eax SYS_lseek");
68 getcwd (char *buf, size_t size)
70 asm ("mov____0x8(%ebp),%ebx !8");
71 asm ("mov____0x8(%ebp),%ecx !12");
73 asm ("mov____$i32,%eax SYS_getcwd");
80 dlclose (void *handle)
86 dlopen (char const *filename, int flags)
92 execvp (char const *file, char *const argv[])
94 eputs ("execvp stub\n");
101 eputs ("fclose stub\n");
106 fdopen (int fd, char const *mode)
108 eputs ("fdopen stub\n");
113 fflush (FILE *stream)
115 eputs ("fflush stub\n");
120 fopen (char const *pathname, char const *mode)
122 eputs ("fopen stub\n");
127 fprintf (FILE *stream, char const *format, ...)
129 eputs ("fprintf stub\n");
134 fread (void *ptr, size_t size, size_t nmemb, FILE *stream)
136 eputs ("fread stub\n");
146 fseek (FILE *stream, long offset, int whence)
148 eputs ("fseek stub\n");
155 eputs ("ftell stub\n");
160 fwrite (void const *ptr, size_t size, size_t nmemb, FILE *stream)
162 eputs ("fwrite stub\n");
167 gettimeofday (struct timeval *tv, struct timezone *tz)
173 localtime (time_t const *timep)
175 eputs ("localtime stub\n");
180 longjmp (jmp_buf env, int val)
182 eputs ("longjmp stub\n");
186 memcpy (void *dest, void const *src, size_t n)
190 while (n--) *p++ = *q++;
195 memmove (void *dest, void const *src, size_t n)
198 return memcpy (dest, src, n);
200 char const *q = src +n;
207 memset (void *s, int c, size_t n)
210 while (n--) *p++ = c;
215 memcmp (void const *s1, void const *s2, size_t n)
219 while (*a == *b && --n) {a++;b++;}
224 mprotect (void *addr, size_t len, int prot)
230 qsort (void *base, size_t nmemb, size_t size, int (*compar)(void const *, void const *))
232 eputs ("qsort stub\n");
236 remove (char const *file_name)
238 eputs ("remove stub\n");
245 eputs ("setjmp stub\n");
250 sigaction (int signum, struct sigaction const *act, struct sigaction *oldact)
256 sigemptyset (sigset_t *set)
262 snprintf(char *str, size_t size, char const *format, ...)
264 eputs ("snprintf stub\n");
269 sscanf (char const *str, const char *format, ...)
271 eputs ("sscanf stub\n");
276 strcat (char *dest, char const *src)
278 eputs ("strcat stub\n");
283 strchr (char const *s, int c)
288 if (c == *p) return p;
295 strrchr (char const *s, int c)
299 char const *p = s + n - 1;
302 if (c == *p) return p;
309 strstr (char const *haystack, char const *needle)
311 eputs ("strstr stub\n");
316 strtol (char const *nptr, char **endptr, int base)
318 eputs ("strtol stub\n");
323 strtoll (char const *nptr, char **endptr, int base)
325 eputs ("strtoll stub\n");
330 strtoul (char const *nptr, char **endptr, int base)
332 eputs ("strtoul stub\n");
337 strtoull (char const *nptr, char **endptr, int base)
339 eputs ("strtoull stub\n");
343 time_t time (time_t *tloc)
349 vsnprintf (char *str, size_t size, char const *format, va_list ap)
351 eputs ("vsnprintf stub\n");
356 calloc (size_t nmemb, size_t size)
358 size_t count = nmemb * size;
359 void *p = malloc (count);
360 memset (p, 0, count);
365 realloc (void *ptr, size_t size)
367 void *new = malloc (size);
370 memcpy (new, ptr, size);
377 vfprintf (FILE* f, char const* format, va_list ap)
380 char const *p = format;
390 case '%': {fputc (*p, fd); break;}
391 case 'c': {char c; c = va_arg (ap, char); fputc (c, fd); break;}
392 case 'd': {int d; d = va_arg (ap, int); fputs (itoa (d), fd); break;}
393 case 's': {char *s; s = va_arg (ap, char *); fputs (s, fd); break;}
394 default: {fputc (*p, fd); break;}