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,33 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,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-mini.h>
int
main ()
{
if (strlen ("mes") == 3)
goto ok;
return 1;
ok:
if (strlen ("mes") != 3)
return 1;
return 0;
}

View file

@ -0,0 +1,68 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,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
main ()
{
char *p = "mes";
oputs ("\n");
oputs ("t: if (strcmp (p, \"foo\"))\n");
if (!strcmp (p, "foo"))
return 1;
oputs ("t: if (strcmp (p, \"t.c\\n\"))\n");
if (strcmp (p, "mes"))
return 2;
oputs ("t: if (!strcmp (p, \"t.c\\n\"))\n");
if (!strcmp (p, "mes"))
goto ok1;
return 3;
ok1:
oputs ("t: if (strcmp (p, \"foo\"))\n");
if (strcmp (p, "foo"))
goto ok2;
return 4;
ok2:
oputs ("t: itoa (33) == \"33\"\n");
if (strcmp (itoa (33), "33"))
return 5;
oputs ("strcmp (itoa (-1), \"-1\")\n");
if (strcmp (itoa (-1), "-1"))
return 6;
oputs ("strcmp (itoa (0), \"0\")\n");
if (strcmp (itoa (0), "0"))
return 7;
oputs ("strcmp (itoa (1), \"1\")\n");
if (strcmp (itoa (1), "1"))
return 8;
return 0;
}

View file

@ -0,0 +1,35 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,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
main ()
{
oputs ("\n");
oputs ("t: strcpy (buf, \"mes\")\n");
char buf[10];
strcpy (buf, "mes");
if (strcmp (buf, "mes"))
return 1;
return 0;
}

View file

@ -0,0 +1,37 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,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
main ()
{
if (strncmp ("abc", "a", 1))
return 1;
if (!strncmp ("abc", "x", 1))
return 2;
if (strncmp ("abc", "", 0))
return 3;
return 0;
}

View file

@ -0,0 +1,51 @@
/* -*-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>
#define strchr xstrchr
char *
strchr (char const *s, int c)
{
char const *p = s;
while (*p || !c)
{
if (c == *p)
return p;
p++;
}
return 0;
}
int
main ()
{
char *p = strchr ("hello", 'l');
if (!p)
return 1;
int i = p - "hello";
// int i;
// i = p - "hello";
if (i != 2)
return i;
return 0;
}

View file

@ -0,0 +1,42 @@
/* -*-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 <stdio.h>
#include <string.h>
int
main ()
{
puts ("\n");
char buf[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
strncpy (buf, "mesxxx", 3);
puts ("buf:");
puts (buf);
puts ("\n");
if (strncmp (buf, "mes", 3))
return 1;
strncpy (buf, "m", 4);
if (buf[3])
return 2;
return 0;
}

View 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 <string.h>
int
main (int argc, char *argv[])
{
char *string = "foo.bar";
char *p = strrchr (string, 0);
if (!p)
return 1;
if (strcmp (p, ""))
return 2;
p = strrchr (string, '.');
if (strcmp (p, ".bar"))
return 3;
return 0;
}

View 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 <mes/lib.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
int
main ()
{
int n = snprintf (0, 0, "%s", "0123456");
eputs ("***n=");
eputs (itoa (n));
eputs ("\n");
exit (n != 7);
/* if (n) */
/* return 1; */
return 0;
}

View file

@ -0,0 +1,54 @@
/* -*-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
main ()
{
char buf[100];
strcpy (buf, "foo");
strcat (buf, " bar");
eputs (buf);
eputs ("\n");
if (strcmp (buf, "foo bar"))
return 1;
strncat (buf, " bazzzz", 4);
eputs (buf);
eputs ("\n");
if (strcmp (buf, "foo bar baz"))
return 2;
char *p = strpbrk ("hello, world", " \t\n,.;!?");
if (strcmp (p, ", world"))
return 3;
eputs ("\n");
if (strspn ("hello, world", "abcdefghijklmnopqrstuvwxyz") != 5)
return 4;
if (strcspn ("hello, world", " \t\n,.;!?") != 5)
return 5;
return 0;
}

View file

@ -0,0 +1,47 @@
/* -*-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>
#define strspn xstrspn
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
main ()
{
if (strspn ("hello, world", "abcdefghijklmnopqrstuvwxyz") != 5)
return 1;
if (strcspn ("hello, world", " \t\n,.;!?") != 5)
return 2;
return 0;
}