Mirror of git://git.busybox.net/busybox with our patches on top
Source
/* vi: set sw=4 ts=4: */
/* printf - format and print data
Copyright 1999 Dave Cinege
Portions copyright (C) 1990-1996 Free Software Foundation, Inc.
Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
/* Usage: printf format [argument...]
A front end to the printf function that lets it be used from the shell.
Backslash escapes:
\" = double quote
\\ = backslash
\a = alert (bell)
\b = backspace
\c = produce no further output
\f = form feed
\n = new line
\r = carriage return
\t = horizontal tab
\v = vertical tab
\0ooo = octal number (ooo is 0 to 3 digits)
\xhhh = hexadecimal number (hhh is 1 to 3 digits)
Additional directive:
%b = print an argument string, interpreting backslash escapes
The 'format' argument is re-used as many times as necessary
to convert all of the given arguments.
David MacKenzie <djm@gnu.ai.mit.edu>
*/
/* 19990508 Busy Boxed! Dave Cinege */
//config:config PRINTF
//config: bool "printf (3.3 kb)"
//config: default y
//config: help
//config: printf is used to format and print specified strings.
//config: It's similar to 'echo' except it has more options.
//applet:IF_PRINTF(APPLET_NOFORK(printf, printf, BB_DIR_USR_BIN, BB_SUID_DROP, printf))
//kbuild:lib-$(CONFIG_PRINTF) += printf.o
//kbuild:lib-$(CONFIG_ASH_PRINTF) += printf.o
//kbuild:lib-$(CONFIG_HUSH_PRINTF) += printf.o
//usage:#define printf_trivial_usage
//usage: "FORMAT [ARG]..."
//usage:#define printf_full_usage "\n\n"
//usage: "Format and print ARG(s) according to FORMAT (a-la C printf)"
//usage:
//usage:#define printf_example_usage
//usage: "$ printf \"Val=%d\\n\" 5\n"
//usage: "Val=5\n"