aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-09-02 20:49:08 +0200
committerMattias Andrée <maandree@operamail.com>2015-09-02 20:49:08 +0200
commitf9e52c4acbd8f53da1b083770c6aab9c67cb0368 (patch)
tree755cb04726fbf6f44b42d94844fd78be6940dd7c /src
parentadd memcasecmp and wmemcasecmp (diff)
downloadslibc-f9e52c4acbd8f53da1b083770c6aab9c67cb0368.tar.gz
slibc-f9e52c4acbd8f53da1b083770c6aab9c67cb0368.tar.bz2
slibc-f9e52c4acbd8f53da1b083770c6aab9c67cb0368.tar.xz
misc
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src')
-rw-r--r--src/assert.c2
-rw-r--r--src/err.c1
-rw-r--r--src/error.c9
-rw-r--r--src/slibc-error.c1
-rw-r--r--src/string/strerror.c5
-rw-r--r--src/wchar/wcsspn.c12
6 files changed, 20 insertions, 10 deletions
diff --git a/src/assert.c b/src/assert.c
index 8e7561a..ffd61a3 100644
--- a/src/assert.c
+++ b/src/assert.c
@@ -50,7 +50,7 @@ void __assert_fail(const char* expression, int errnum, const char* file, int lin
tty, line, tty,
tty, file, tty,
tty, func, tty,
- tty, expression != NULL, (expression ? expression : stderror(errnum)), tty);
+ tty, expression != NULL, (expression ? expression : strerror(errnum)), tty);
fflush(NULL); /* Flush all streams. */
abort();
diff --git a/src/err.c b/src/err.c
index caa8d3f..b873a93 100644
--- a/src/err.c
+++ b/src/err.c
@@ -19,6 +19,7 @@
#include <error.h>
#include <errno.h>
#include <stdlib.h>
+#include <stdarg.h>
diff --git a/src/error.c b/src/error.c
index eb73276..c560d2a 100644
--- a/src/error.c
+++ b/src/error.c
@@ -20,6 +20,9 @@
#include <stdio.h>
#include <errno.h>
#include <stddef.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdarg.h>
@@ -85,7 +88,7 @@ void error_at_line(int status, int errnum, const char* filename,
{
va_list args;
va_start(args, format);
- verror_at_line(status, errnu, filename, linenum, format, args);
+ verror_at_line(status, errnum, filename, linenum, format, args);
va_end(args);
}
@@ -130,7 +133,7 @@ void verror_at_line(int status, int errnum, const char* filename,
}
fprintf(stderr, "%(: %(\033[35m%)%s%(\033[0m%): %(\033[32m%)%u%(\033[0m%)%)%(: %s%)%(: %)",
- filename != NULL, tty, filename, tty, tty, filenum, tty,
+ filename != NULL, tty, filename, tty, tty, linenum, tty,
errnum != 0, strerror(errnum) /* TODO strerror is not MT-Safe */, format != NULL);
if (filename != NULL)
@@ -185,5 +188,5 @@ volatile int error_one_per_line = 1;
*
* This is a GNU extension.
*/
-volatile void (*error_print_progname)(void) = NULL;
+void (*volatile error_print_progname)(void) = NULL;
diff --git a/src/slibc-error.c b/src/slibc-error.c
index 0680751..fd103d1 100644
--- a/src/slibc-error.c
+++ b/src/slibc-error.c
@@ -21,6 +21,7 @@
#include <unistd.h>
#include <string.h>
#include <stddef.h>
+#include <stdarg.h>
diff --git a/src/string/strerror.c b/src/string/strerror.c
index 87f3261..ccce049 100644
--- a/src/string/strerror.c
+++ b/src/string/strerror.c
@@ -40,7 +40,7 @@
*/
char* strerror(int errnum)
{
- return strerror_l(errnum, CURRENT_LOCALE /* TODO not defined */);
+ return strerror_l(errnum, 0 /* TODO CURRENT_LOCALE, not defined */);
}
@@ -63,7 +63,8 @@ char* strerror(int errnum)
char* strerror_l(int errnum, locale_t locale)
{
/* TODO implement strerror_l */
- return (void) errnum, (void) locale, NULL:
+ return strerror(errnum);
+ (void) locale;
}
diff --git a/src/wchar/wcsspn.c b/src/wchar/wcsspn.c
index 239b863..63dc60b 100644
--- a/src/wchar/wcsspn.c
+++ b/src/wchar/wcsspn.c
@@ -53,12 +53,16 @@ size_t wcsspn(const wchar_t* string, const wchar_t* skipset)
*/
size_t wcscspn(const wchar_t* string, const wchar_t* stopset)
{
- size_t end = wcslen(string);
- wchar_t* p;
+ size_t i, end = wcslen(string);
+ wchar_t* s;
wchar_t c;
while ((c = *stopset++))
- if (p = wcsnchr(string, c, end), p != NULL)
- end = (size_t)(p - string);
+ for (i = 0, s = string; *s && (i < end); i++, s++)
+ if (*s == c)
+ {
+ end = (size_t)(s - string);
+ break;
+ }
return end;
}