Add mes and mescc-tools-extra

mescc-tools-extra contains two important tools:
- cp
- chmod

mes first builds itself from a mes 0.21 seed as used by guix, and then
builds a mes 0.22 and then mes 0.22 using that created mes 0.22.

It does /not/ use bootstrap.sh as we don't have a proper shell at this
point, it has been manually adapted for kaem.
This commit is contained in:
fosslinux 2020-12-25 18:40:14 +11:00
parent 2706e07556
commit 649d7b68dc
1029 changed files with 120985 additions and 18 deletions

View file

@ -0,0 +1,57 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017 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/>.
*/
#if SYSTEM_LIBC
#error "SYSTEM_LIBC not supported"
#endif
#include <mes/lib.h>
#include <stdio.h>
#include <stdlib.h>
int
main (int argc, char *argv[])
{
int size = 5000;
oputs ("m!\n");
//int *p = 0;
char *p = 0;
p = malloc (size);
size = 5000;
oputs ("p=");
oputs (itoa (p));
oputs ("\n");
int i;
for (i = 0; i < size; i = i + 1)
{
oputs ("set ");
oputs (itoa (i));
oputs ("\n");
p[i] = i;
}
for (i = 0; i < size; i = i + 1)
{
oputs (itoa (i));
oputs (": ");
oputs (itoa (p[i]));
oputs ("\n");
}
return 0;
}

View file

@ -0,0 +1,47 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib.h>
#include <mes/lib.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int
main ()
{
char *p = "42foo\n";
int n = abtol (&p, 0);
if (n != 42)
return 1;
eputs (p);
if (strcmp (p, "foo\n"))
return 2;
p = "2azar\n";
n = strtoull (p, (char **) &p, 16);
if (n != 42)
return 3;
eputs (p);
if (strcmp (p, "zar\n"))
return 4;
return 0;
}

View file

@ -0,0 +1,43 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib.h>
#include <string.h>
int
qsort_strcmp (void const *a, void const *b)
{
return strcmp (*((char **) a), *((char **) b));
}
int
main ()
{
char *list[3] = { "foo", "foo", 0 };
oputs ("\nls:\n");
qsort (list, 2, sizeof (char *), qsort_strcmp);
for (int i = 0; i < 2; i++)
{
oputs (list[i]);
oputs ("\n");
}
return 0;
}

View file

@ -0,0 +1,55 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib.h>
#include <string.h>
int
compare_int (void *a, void *b)
{
eputs ("compare: ");
eputs (itoa (*(int *) a));
eputs (" <? ");
eputs (itoa (*(int *) b));
eputs (" => ");
eputs (itoa (*(int *) a - *(int *) b));
eputs ("\n");
return *(int *) a - *(int *) b;
}
int
main ()
{
int lst[6] = { 0, 5, 4, 3, 2, -1 };
qsort (lst, 6, sizeof (int), compare_int);
for (int i = 0; i < 6; i++)
{
eputs (itoa (i));
eputs (":");
eputs (itoa (lst[i]));
eputs ("\n");
}
if (lst[0] != -1)
return 1;
if (lst[5] != 5)
return 2;
return 0;
}

View file

@ -0,0 +1,61 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib.h>
#include <stdlib.h>
int
main ()
{
eputs ("0x12\n");
if (strtol ("0x12", 0, 0) != 18)
1;
eputs ("012\n");
if (strtol ("012", 0, 0) != 10)
2;
eputs ("-1\n");
if (strtol ("-1", 0, 0) != -1)
3;
eputs ("-1\n");
if (strtoul ("-1", 0, 0) != -1)
4;
char *p = "16";
int n = strtol (p, (char **) &p, 0);
eputs ("p=");
eputs (p);
eputs ("\n");
if (*p != 0)
return 5;
p = "0x12";
n = strtol (p, (char **) &p, 0);
eputs ("p=");
eputs (p);
eputs ("\n");
if (*p != 0)
return 5;
return 0;
}