1 /* 2 string_util.h 3 4 The client actually uses lots of string functions, mostly to 5 format the information it displays. This module provides 6 housing for all these string functions. 7 */ 8 9 #ifndef string_util_h 10 #define string_util_h 11 12 13 char *itoapad (int val, char *result, int pad, int prec); 14 /* 15 Convert an integer `val' to a null terminated string `result'. 16 17 Only the `prec' most significant digits will be written out. 18 If `val' can be expressed in fewer than `prec' digits then the 19 number is padded out with zeros (if pad is true) or spaces 20 (if pad is false). 21 22 WARNING: val must be <= 100000000 (size < 9). 23 Does not work for negative numbers. 24 */ 25 26 27 28 char *ftoa (float fval, char *result, int pad, int iprec, int dprec); 29 /* 30 Convert a float `fval' to a null terminated string `result'. 31 32 Only the `iprec' most significant whole digits and the `dprec' 33 most significat fractional digits are printed. 34 35 The integer part will be padded with zeros (if pad is true) or 36 spaces (if pad is false) if it is shorter than `iprec' digits. 37 38 The floating point part will always be padded with zeros. 39 40 WARNING: The whole part of `fval' must be <= 100000000 (size < 9). 41 */ 42 43 44 char *format (char *buf, char *from, int width, int right_justify); 45 /* 46 Right or left justify the string `from' into the next `width' 47 characters in the buffer `buf'. 48 */ 49 50 51 #endif /* defined string_util_h */ 52