nfs-ganesha 1.4
|
00001 00008 #ifdef HAVE_CONFIG_H 00009 #include "config.h" 00010 #endif 00011 00012 #include <stdio.h> 00013 #include <stdlib.h> 00014 #include <string.h> 00015 #include <stdint.h> 00016 #include <math.h> 00017 #include "parse_type.h" 00018 00025 int real2str(char *str, double num) 00026 { 00027 int n; 00028 00029 n = snprintf(str, PRINT_LEN, "+%.5e", num); 00030 00031 return n == PRINT_LEN + 1; 00032 } 00033 00040 int str2real(double *pnum, char *str) 00041 { 00042 *pnum = strtod(str, NULL); 00043 00044 return *pnum == 0 && str[0] != '0'; 00045 } 00046 00047 int big2str(char *str, int64_t num) 00048 { 00049 int n; 00050 n = snprintf(str, PRINT_LEN, "%lld", (long long) num); 00051 return n == PRINT_LEN + 1; 00052 } 00053 00054 int str2big(int64_t * pnum, char *str) 00055 { 00056 *pnum = strtoll(str, NULL, 10); 00057 return *pnum == 0 && str[0] != '0'; 00058 }