Changeset 3232 in MondoRescue for branches/3.2/mindi-busybox/coreutils/printf.c
- Timestamp:
- Jan 1, 2014, 12:47:38 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.2/mindi-busybox/coreutils/printf.c
r2725 r3232 37 37 */ 38 38 39 // 19990508 Busy Boxed! Dave Cinege 39 /* 19990508 Busy Boxed! Dave Cinege */ 40 41 //usage:#define printf_trivial_usage 42 //usage: "FORMAT [ARG]..." 43 //usage:#define printf_full_usage "\n\n" 44 //usage: "Format and print ARG(s) according to FORMAT (a-la C printf)" 45 //usage: 46 //usage:#define printf_example_usage 47 //usage: "$ printf \"Val=%d\\n\" 5\n" 48 //usage: "Val=5\n" 40 49 41 50 #include "libbb.h" … … 123 132 } 124 133 134 /* Handles %b */ 125 135 static void print_esc_string(const char *str) 126 136 { … … 128 138 while ((c = *str) != '\0') { 129 139 str++; 130 if (c == '\\') 131 c = bb_process_escape_sequence(&str); 140 if (c == '\\') { 141 /* %b also accepts 4-digit octals of the form \0### */ 142 if (*str == '0') { 143 if ((unsigned char)(str[1] - '0') < 8) { 144 /* 2nd char is 0..7: skip leading '0' */ 145 str++; 146 } 147 } 148 { 149 /* optimization: don't force arg to be on-stack, 150 * use another variable for that. */ 151 const char *z = str; 152 c = bb_process_escape_sequence(&z); 153 str = z; 154 } 155 } 132 156 putchar(c); 133 157 }
Note:
See TracChangeset
for help on using the changeset viewer.