version 1.27 | | version 1.28 |
---|
| | |
/* | | /* |
* static char *rcsid_porting_c = | | * static char *rcsid_porting_c = |
* "$Id: porting.c,v 1.27 2005/09/04 16:58:12 akirschbaum Exp $"; | | * "$Id: porting.c,v 1.28 2005/10/28 23:43:30 akirschbaum Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
*/ | | */ |
| | |
char *ltostr10(signed long n) { | | char *ltostr10(signed long n) { |
static char buf[10]; | | static char buf[12]; /* maximum size is n=-2 billion, i.e. 11 characters+1 |
char *cp=buf+9; | | character for the trailing nul character */ |
long flag; | | snprintf(buf, sizeof(buf), "%ld", n); |
| | return buf; |
*cp='\0'; | | |
if(n<0) | | |
flag= n = -n; | | |
else | | |
flag=0; | | |
do { | | |
*(--cp) = '0'+n%10; | | |
n/=10; | | |
} while(n); | | |
if(flag) | | |
*(--cp)='-'; | | |
return cp; | | |
} | | } |
char *doubletostr10(double v){ | | char *doubletostr10(double v){ |
static char tbuf[200]; | | static char tbuf[200]; |