source: trunk/essentials/app-shells/bash/builtins/printf.def

Last change on this file was 3228, checked in by bird, 19 years ago

bash 3.1

File size: 20.1 KB
Line 
1This file is printf.def, from which is created printf.c.
2It implements the builtin "printf" in Bash.
3
4Copyright (C) 1997-2005 Free Software Foundation, Inc.
5
6This file is part of GNU Bash, the Bourne Again SHell.
7
8Bash is free software; you can redistribute it and/or modify it under
9the terms of the GNU General Public License as published by the Free
10Software Foundation; either version 2, or (at your option) any later
11version.
12
13Bash is distributed in the hope that it will be useful, but WITHOUT ANY
14WARRANTY; without even the implied warranty of MERCHANTABILITY or
15FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16for more details.
17
18You should have received a copy of the GNU General Public License along
19with Bash; see the file COPYING. If not, write to the Free Software
20Foundation, 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]
27printf formats and prints ARGUMENTS under control of the FORMAT. FORMAT
28is a character string which contains three types of objects: plain
29characters, which are simply copied to standard output, character escape
30sequences which are converted and copied to the standard output, and
31format specifications, each of which causes printing of the next successive
32argument. In addition to the standard printf(1) formats, %b means to
33expand backslash escape sequences in the corresponding argument, and %q
34means to quote the argument in a way that can be reused as shell input.
35If the -v option is supplied, the output is placed into the value of the
36shell 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