|
3 | 3 | *
|
4 | 4 | * Copyright (c) 2000-2005, PostgreSQL Global Development Group
|
5 | 5 | *
|
6 |
| - * $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.70 2005/07/1818:58:45 momjian Exp $ |
| 6 | + * $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.71 2005/07/1819:27:37 momjian Exp $ |
7 | 7 | */
|
8 | 8 | #include"postgres_fe.h"
|
9 | 9 | #include"common.h"
|
@@ -65,17 +65,18 @@ integer_digits(const char *my_str)
|
65 | 65 | staticint
|
66 | 66 | len_numericseps(constchar*my_str)
|
67 | 67 | {
|
68 |
| -intint_len=integer_digits(my_str),sep_len; |
| 68 | +intint_len=integer_digits(my_str),len=0; |
69 | 69 | intgroupdigits=atoi(grouping);
|
70 | 70 |
|
71 |
| -if (int_len==0) |
72 |
| -sep_len=0; |
73 |
| -else |
| 71 | +if (int_len>0) |
74 | 72 | /* Don't count a leading separator */
|
75 |
| -sep_len=int_len /groupdigits- (int_len %groupdigits==0); |
| 73 | +len= (int_len /groupdigits- (int_len %groupdigits==0))* |
| 74 | +strlen(thousands_sep); |
76 | 75 |
|
77 |
| -returnsep_len*strlen(thousands_sep)- |
78 |
| -strlen(".")+strlen(decimal_point); |
| 76 | +if (strchr(my_str,'.')!=NULL) |
| 77 | +len+=strlen(decimal_point)-strlen("."); |
| 78 | + |
| 79 | +returnlen; |
79 | 80 | }
|
80 | 81 |
|
81 | 82 | staticint
|
|