| 1 | This file is printf.def, from which is created printf.c.
|
|---|
| 2 | It implements the builtin "printf" in Bash.
|
|---|
| 3 |
|
|---|
| 4 | Copyright (C) 1997-2005 Free Software Foundation, Inc.
|
|---|
| 5 |
|
|---|
| 6 | This file is part of GNU Bash, the Bourne Again SHell.
|
|---|
| 7 |
|
|---|
| 8 | Bash is free software; you can redistribute it and/or modify it under
|
|---|
| 9 | the terms of the GNU General Public License as published by the Free
|
|---|
| 10 | Software Foundation; either version 2, or (at your option) any later
|
|---|
| 11 | version.
|
|---|
| 12 |
|
|---|
| 13 | Bash is distributed in the hope that it will be useful, but WITHOUT ANY
|
|---|
| 14 | WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|---|
| 15 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|---|
| 16 | for more details.
|
|---|
| 17 |
|
|---|
| 18 | You should have received a copy of the GNU General Public License along
|
|---|
| 19 | with Bash; see the file COPYING. If not, write to the Free Software
|
|---|
| 20 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
|---|
| 21 |
|
|---|
| 22 | $PRODUCES printf.c
|
|---|
| 23 |
|
|---|
| 24 | $BUILTIN printf
|
|---|
| 25 | $FUNCTION printf_builtin
|
|---|
| 26 | $SHORT_DOC printf [-v var] format [arguments]
|
|---|
| 27 | printf formats and prints ARGUMENTS under control of the FORMAT. FORMAT
|
|---|
| 28 | is a character string which contains three types of objects: plain
|
|---|
| 29 | characters, which are simply copied to standard output, character escape
|
|---|
| 30 | sequences which are converted and copied to the standard output, and
|
|---|
| 31 | format specifications, each of which causes printing of the next successive
|
|---|
| 32 | argument. In addition to the standard printf(1) formats, %b means to
|
|---|
| 33 | expand backslash escape sequences in the corresponding argument, and %q
|
|---|
| 34 | means to quote the argument in a way that can be reused as shell input.
|
|---|
| 35 | If the -v option is supplied, the output is placed into the value of the
|
|---|
| 36 | shell variable VAR rather than being sent to the standard output.
|
|---|
| 37 | $END
|
|---|
| 38 |
|
|---|
| 39 | #include <config.h>
|
|---|
| 40 |
|
|---|
| 41 | #include "../bashtypes.h"
|
|---|
| 42 |
|
|---|
| 43 | #include <errno.h>
|
|---|
| 44 | #if defined (HAVE_LIMITS_H)
|
|---|
| 45 | # include <limits.h>
|
|---|
| 46 | #else
|
|---|
| 47 | /* Assume 32-bit ints. */
|
|---|
| 48 | # define INT_MAX 2147483647
|
|---|
| 49 | # define INT_MIN (-2147483647-1)
|
|---|
| 50 | #endif
|
|---|
| 51 |
|
|---|
|
|---|