00001 #include <grass/gis.h> 00002 /* this routine remove trailing zeros from decimal number 00003 * for example: 23.45000 would come back as 23.45 00004 */ 00005 00016 int G_trim_decimal (char *buf) 00017 { 00018 char *mark; 00019 00020 /* find the . */ 00021 while (*buf != '.') 00022 if (*buf++ == 0) 00023 return 0; 00024 mark = buf; 00025 while (*++buf) 00026 if (*buf != '0') 00027 mark = buf+1; 00028 *mark = 0; 00029 00030 return 0; 00031 }