5 char *put_mem(char *dst
, char *src
, int len
)
11 char *put_str(char *dst
, char *src
)
13 int len
= strchr(src
, '\0') - src
;
14 memcpy(dst
, src
, len
+ 1);
18 static char *put_int_fill(char *s
, int n
, int w
, int f
)
21 for (i
= 0; i
< w
; i
++) {
22 s
[w
- i
- 1] = n
|| !i
? '0' + n
% 10 : f
;
28 char *put_int(char *s
, int n
, int w
)
30 return put_int_fill(s
, n
, w
, ' ');
33 char *put_intz(char *s
, int n
, int w
)
35 return put_int_fill(s
, n
, w
, '0');
38 char *cut_word(char *dst
, char *s
)
40 while (*s
&& isspace(*s
))
42 while (*s
&& !isspace(*s
))
48 /* return 1 if r starts with s */
49 int startswith(char *r
, char *s
)
52 if (tolower(*s
++) != tolower(*r
++))