strfmon.c (103668) | strfmon.c (104942) |
---|---|
1/*- 2 * Copyright (c) 2001 Alexey Zelkin <phantom@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 12 unchanged lines hidden (view full) --- 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 */ 27 28#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2001 Alexey Zelkin <phantom@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 12 unchanged lines hidden (view full) --- 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 */ 27 28#include <sys/cdefs.h> |
29__FBSDID("$FreeBSD: head/lib/libc/stdlib/strfmon.c 103668 2002-09-20 08:24:01Z mike $"); | 29__FBSDID("$FreeBSD: head/lib/libc/stdlib/strfmon.c 104942 2002-10-11 22:59:22Z tjr $"); |
30 31#include <sys/types.h> 32#include <ctype.h> 33#include <errno.h> 34#include <limits.h> 35#include <locale.h> 36#include <stdarg.h> 37#include <stdio.h> --- 131 unchanged lines hidden (view full) --- 169 flags |= (SIGN_POSN_USED|PARENTH_POSN); 170 continue; 171 case '!': /* suppress currency symbol */ 172 flags |= SUPRESS_CURR_SYMBOL; 173 continue; 174 case '-': /* alignment (left) */ 175 flags |= LEFT_JUSTIFY; 176 continue; | 30 31#include <sys/types.h> 32#include <ctype.h> 33#include <errno.h> 34#include <limits.h> 35#include <locale.h> 36#include <stdarg.h> 37#include <stdio.h> --- 131 unchanged lines hidden (view full) --- 169 flags |= (SIGN_POSN_USED|PARENTH_POSN); 170 continue; 171 case '!': /* suppress currency symbol */ 172 flags |= SUPRESS_CURR_SYMBOL; 173 continue; 174 case '-': /* alignment (left) */ 175 flags |= LEFT_JUSTIFY; 176 continue; |
177 case '#': /* left || right precision */ 178 case '.': 179 if (*fmt == '#') 180 ntmp = &left_prec; 181 else 182 ntmp = &right_prec; 183 184 if (!isdigit((unsigned char)*++fmt)) 185 goto format_error; 186 GET_NUMBER(*ntmp); 187 fmt--; 188 continue; | |
189 default: 190 break; 191 } 192 break; 193 } 194 195 /* field Width */ 196 if (isdigit((unsigned char)*fmt)) { 197 GET_NUMBER(width); 198 /* Do we have enough space to put number with 199 * required width ? 200 */ 201 if (dst + width >= s + maxsize) 202 goto e2big_error; 203 } | 177 default: 178 break; 179 } 180 break; 181 } 182 183 /* field Width */ 184 if (isdigit((unsigned char)*fmt)) { 185 GET_NUMBER(width); 186 /* Do we have enough space to put number with 187 * required width ? 188 */ 189 if (dst + width >= s + maxsize) 190 goto e2big_error; 191 } |
204 | 192 193 /* Left precision */ 194 if (*fmt == '#') { 195 if (!isdigit((unsigned char)*++fmt)) 196 goto format_error; 197 GET_NUMBER(left_prec); 198 } 199 200 /* Right precision */ 201 if (*fmt == '.') { 202 if (!isdigit((unsigned char)*++fmt)) 203 goto format_error; 204 GET_NUMBER(right_prec); 205 } 206 |
205 /* Conversion Characters */ 206 switch (*fmt++) { 207 case 'i': /* use internaltion currency format */ 208 flags |= USE_INTL_CURRENCY; 209 break; 210 case 'n': /* use national currency format */ 211 flags &= ~(USE_INTL_CURRENCY); 212 break; --- 381 unchanged lines hidden --- | 207 /* Conversion Characters */ 208 switch (*fmt++) { 209 case 'i': /* use internaltion currency format */ 210 flags |= USE_INTL_CURRENCY; 211 break; 212 case 'n': /* use national currency format */ 213 flags &= ~(USE_INTL_CURRENCY); 214 break; --- 381 unchanged lines hidden --- |