2017-12-03 12:56:21 +00:00
|
|
|
/* -*-comment-start: "//";comment-end:""-*-
|
2018-07-22 12:24:36 +00:00
|
|
|
* GNU Mes --- Maxwell Equations of Software
|
2018-05-26 20:33:00 +00:00
|
|
|
* Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
2017-12-03 12:56:21 +00:00
|
|
|
*
|
2018-07-22 12:24:36 +00:00
|
|
|
* This file is part of GNU Mes.
|
2017-12-03 12:56:21 +00:00
|
|
|
*
|
2018-07-22 12:24:36 +00:00
|
|
|
* GNU Mes is free software; you can redistribute it and/or modify it
|
2017-12-03 12:56:21 +00:00
|
|
|
* 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.
|
|
|
|
*
|
2018-07-22 12:24:36 +00:00
|
|
|
* GNU Mes is distributed in the hope that it will be useful, but
|
2017-12-03 12:56:21 +00:00
|
|
|
* 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
|
2018-07-22 12:24:36 +00:00
|
|
|
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
2017-12-03 12:56:21 +00:00
|
|
|
*/
|
|
|
|
|
2018-04-22 09:47:44 +00:00
|
|
|
#include <sys/ioctl.h>
|
2017-12-03 12:56:21 +00:00
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdlib.h>
|
2018-05-29 18:07:46 +00:00
|
|
|
#include <libmes.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include <libmes.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
#include <libc-mini.c>
|
|
|
|
#include <libmes.c>
|
2018-06-30 11:11:03 +00:00
|
|
|
|
|
|
|
#if __GNU__
|
|
|
|
#include <hurd/libc.c>
|
|
|
|
#elif __linux__
|
|
|
|
#include <linux/libc.c>
|
|
|
|
#else
|
|
|
|
#error both __GNU__ and _linux__ are undefined, choose one
|
|
|
|
#endif
|
2017-12-03 12:56:21 +00:00
|
|
|
|
|
|
|
void _env ();
|
|
|
|
|
2018-06-10 12:07:19 +00:00
|
|
|
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
|
|
|
|
|
|
|
int
|
|
|
|
__mes_debug ()
|
|
|
|
{
|
|
|
|
static int __mes_debug = -1;
|
|
|
|
if (__mes_debug == -1)
|
|
|
|
{
|
|
|
|
char *p = getenv ("MES_DEBUG");
|
2018-06-17 06:39:31 +00:00
|
|
|
__mes_debug = p ? MAX (atoi (p), 1) : 0;
|
2018-06-10 12:07:19 +00:00
|
|
|
}
|
|
|
|
return __mes_debug;
|
|
|
|
}
|
|
|
|
|
2018-06-30 11:11:03 +00:00
|
|
|
|
|
|
|
#if !___GNU__
|
|
|
|
#include <assert/assert.c>
|
2019-02-24 16:51:53 +00:00
|
|
|
#include <stdlib/malloc.c>
|
|
|
|
#include <string/memcpy.c>
|
2018-06-30 11:11:03 +00:00
|
|
|
#endif
|
|
|
|
|
2018-08-16 08:50:53 +00:00
|
|
|
#include <stdio/getchar.c>
|
|
|
|
#include <stdio/putchar.c>
|
|
|
|
#include <stdio/fputc.c>
|
|
|
|
#include <stdio/fputs.c>
|
|
|
|
#include <stdio/putc.c>
|
|
|
|
#include <stdio/getc.c>
|
|
|
|
#include <stdio/fgetc.c>
|
|
|
|
#include <stdio/ungetc.c>
|
|
|
|
|
2018-11-15 23:01:18 +00:00
|
|
|
#include <string/memchr.c>
|
2018-11-25 15:09:31 +00:00
|
|
|
#include <string/memcmp.c>
|
2018-08-16 08:50:53 +00:00
|
|
|
#include <string/strcmp.c>
|
|
|
|
#include <string/strcpy.c>
|
|
|
|
#include <string/strncmp.c>
|
|
|
|
|
|
|
|
#include <stdlib/free.c>
|
|
|
|
#include <stdlib/realloc.c>
|
|
|
|
|
2019-02-24 16:51:53 +00:00
|
|
|
#include <posix/getenv.c>
|
2018-08-16 08:50:53 +00:00
|
|
|
#include <posix/isatty.c>
|
2019-02-24 16:51:53 +00:00
|
|
|
#include <posix/setenv.c>
|
2018-08-16 08:50:53 +00:00
|
|
|
#include <posix/wait.c>
|
|
|
|
#include <posix/execv.c>
|