[BusyBox] [PATCH] kill error message

Vladimir N. Oleynik dzo at simtreas.ru
Wed Aug 17 06:50:37 UTC 2005


> %m is a glibc extension.  uClibc has an option to implement it, from 
> menuconfig in uClibc 0.9.27:
>>   │ Answer Y to support a glibc extension to interpret '%m' in printf
>   │ format strings as an instruction to output the error message string
>   │ (as generated by strerror) corresponding to the current value of 'errno
>>   │ Most people will answer N.

But uclibc support register_printf_function().
If add to busybox autoconfigure for check "%m" or not,
we can use this code (tested):

/* %m for printf format if libc not unsupported */

#include <stdio.h>
#include <stdlib.h>
#include <printf.h>
#include <errno.h>

static int
print_add_parse_percent_m (FILE *stream,
               const struct printf_info *info,
               const void *const *args)
   return fprintf (stream, "%*.*s",
                  (info->left ? -info->width : info->width), info->prec,

static int
print_add_parse_percent_m_arginfo (const struct printf_info *info, size_t n,
                       int *argtypes)
   return 0;

main (int argc, char *argv[])
   /* Register the print functions for support "%m" */
   register_printf_function ('m', print_add_parse_percent_m,


>>>># kill 1234
>>>>kill: 3: kill 1234: No such process
>>Really to like you here this result?
> Assuming your translator program meant something like "Do you really like this 
> result"?  The answer is "I personally don't strongly care one way or the 
> other".

Do you really like show the double "kill" word?


More information about the busybox mailing list