From 312dcd244a84196577608a3b16ec919efc9d4437 Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Thu, 27 Oct 2022 23:02:51 +0200 Subject: [PATCH] DRAFT lib: Add strsignal stub. * lib/stub/strsignal.c: New file. * build-aux/configure-lib.sh (libc_gnu_SOURCES): Add it. * include/string.h (strsignal): Add prototype. --- build-aux/configure-lib.sh | 1 + include/string.h | 3 ++- lib/stub/strsignal.c | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 lib/stub/strsignal.c diff --git a/build-aux/configure-lib.sh b/build-aux/configure-lib.sh index 56776653..0c0fce3f 100644 --- a/build-aux/configure-lib.sh +++ b/build-aux/configure-lib.sh @@ -400,6 +400,7 @@ lib/stub/sigsetmask.c lib/stub/sin.c lib/stub/sqrt.c lib/stub/strftime.c +lib/stub/strsignal.c lib/stub/sys_siglist.c lib/stub/sysconf.c lib/stub/system.c diff --git a/include/string.h b/include/string.h index cb60243a..441faeda 100644 --- a/include/string.h +++ b/include/string.h @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2017 Jan (janneke) Nieuwenhuizen + * Copyright © 2017,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -47,6 +47,7 @@ size_t strlen (char const *); char *strncpy (char *to, char const *from, size_t size); int strncmp (char const *, char const *, size_t); char *strrchr (char const *s, int c); +char *strsignal (int signum); char *strstr (char const *haystack, char const *needle); char *strtok (char *new_string, char const *delimiters); char *strlwr (char *string); diff --git a/lib/stub/strsignal.c b/lib/stub/strsignal.c new file mode 100644 index 00000000..87c3f708 --- /dev/null +++ b/lib/stub/strsignal.c @@ -0,0 +1,34 @@ +/* -*-comment-start: "//";comment-end:""-*- + * GNU Mes --- Maxwell Equations of Software + * Copyright © 2022 Jan (janneke) Nieuwenhuizen + * + * 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 . + */ + +#include +#include + +char * +strsignal (int signum) +{ + static int stub = 0; + if (__mes_debug () && !stub) + eputs ("strsignal stub\n"); + stub = 1; + static char buf[30] = "Unknown signal: "; + strcat (buf, itoa (signum)); + return buf; +}