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)
197 eputs ("memmove stub\n");
202 memset (void *s, int c, size_t n)
205 while (n--) *p++ = c;
210 memcmp (void const *s1, void const *s2, size_t n)
214 while (*a == *b && --n) {a++;b++;}
219 mprotect (void *addr, size_t len, int prot)
225 qsort (void *base, size_t nmemb, size_t size, int (*compar)(void const *, void const *))
227 eputs ("qsort stub\n");
231 remove (char const *file_name)
233 eputs ("remove stub\n");
240 eputs ("setjmp stub\n");
245 sigaction (int signum, struct sigaction const *act, struct sigaction *oldact)
251 sigemptyset (sigset_t *set)
257 snprintf(char *str, size_t size, char const *format, ...)
259 eputs ("snprintf stub\n");
264 sscanf (char const *str, const char *format, ...)
266 eputs ("sscanf stub\n");
271 strcat (char *dest, char const *src)
273 eputs ("strcat stub\n");
278 strchr (char const *s, int c)
283 if (c == *p) return p;
290 strrchr (char const *s, int c)
292 eputs ("strrchr stub\n");
297 strstr (char const *haystack, char const *needle)
299 eputs ("strstr stub\n");
304 strtol (char const *nptr, char **endptr, int base)
306 eputs ("strtol stub\n");
311 strtoll (char const *nptr, char **endptr, int base)
313 eputs ("strtoll stub\n");
318 strtoul (char const *nptr, char **endptr, int base)
320 eputs ("strtoul stub\n");
325 strtoull (char const *nptr, char **endptr, int base)
327 eputs ("strtoull stub\n");
331 time_t time (time_t *tloc)
337 vsnprintf (char *str, size_t size, char const *format, va_list ap)
339 eputs ("vsnprintf stub\n");
344 calloc (size_t nmemb, size_t size)
346 size_t count = nmemb * size;
347 void *p = malloc (count);
348 memset (p, 0, count);
353 realloc (void *ptr, size_t size)
355 void *new = malloc (size);
358 memcpy (new, ptr, size);
365 vfprintf (FILE* f, char const* format, va_list ap)
368 char const *p = format;
378 case '%': {fputc (*p, fd); break;}
379 case 'c': {char c; c = va_arg (ap, char); fputc (c, fd); break;}
380 case 'd': {int d; d = va_arg (ap, int); fputs (itoa (d), fd); break;}
381 case 's': {char *s; s = va_arg (ap, char *); fputs (s, fd); break;}
382 default: {fputc (*p, fd); break;}