mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-05-13 19:20:51 +08:00
kvprintf: Add support for %m
This commit is contained in:
parent
54a577d44f
commit
356f59c898
@ -800,6 +800,11 @@ reswitch: switch (ch = (u_char)*fmt++) {
|
|||||||
else
|
else
|
||||||
*(va_arg(ap, int *)) = retval;
|
*(va_arg(ap, int *)) = retval;
|
||||||
break;
|
break;
|
||||||
|
#ifdef __rtems__
|
||||||
|
case 'm':
|
||||||
|
p = strerror(errno);
|
||||||
|
goto handle_string;
|
||||||
|
#endif /* __rtems__ */
|
||||||
case 'o':
|
case 'o':
|
||||||
base = 8;
|
base = 8;
|
||||||
goto handle_nosign;
|
goto handle_nosign;
|
||||||
@ -819,6 +824,9 @@ reswitch: switch (ch = (u_char)*fmt++) {
|
|||||||
goto handle_nosign;
|
goto handle_nosign;
|
||||||
case 's':
|
case 's':
|
||||||
p = va_arg(ap, char *);
|
p = va_arg(ap, char *);
|
||||||
|
#ifdef __rtems__
|
||||||
|
handle_string:
|
||||||
|
#endif /* __rtems__ */
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
p = "(null)";
|
p = "(null)";
|
||||||
if (!dot)
|
if (!dot)
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -138,6 +139,11 @@ test_main(void)
|
|||||||
printf("out: %4D", "AAAA", ":");
|
printf("out: %4D", "AAAA", ":");
|
||||||
check(ctx, "out: 41:41:41:41");
|
check(ctx, "out: 41:41:41:41");
|
||||||
|
|
||||||
|
errno = ENOMSG;
|
||||||
|
reset(ctx, LOG_PRINTF);
|
||||||
|
printf("%m");
|
||||||
|
check(ctx, "No message of desired type");
|
||||||
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user