Mercurial > hg-old > index.cgi
comparison lwlib/lw_string.c @ 329:c15cca3ae6a2
Created first pass of input layer
author | lost |
---|---|
date | Sun, 28 Feb 2010 05:01:31 +0000 |
parents | 2eb058346cad |
children |
comparison
equal
deleted
inserted
replaced
328:591d01b343b9 | 329:c15cca3ae6a2 |
---|---|
38 r = lw_alloc(strlen(s) + 1); | 38 r = lw_alloc(strlen(s) + 1); |
39 strcpy(r, s); | 39 strcpy(r, s); |
40 return r; | 40 return r; |
41 } | 41 } |
42 | 42 |
43 char *lw_strndup(const char *s, int len) | |
44 { | |
45 char *r; | |
46 int sl; | |
47 | |
48 sl = strlen(s); | |
49 if (sl > len) | |
50 sl = len; | |
51 | |
52 r = lw_alloc(sl + 1); | |
53 memmove(r, s, sl); | |
54 r[sl] = '\0'; | |
55 return r; | |
56 } | |
57 | |
43 char *lw_token(const char *s, int sep, const char **ap) | 58 char *lw_token(const char *s, int sep, const char **ap) |
44 { | 59 { |
45 const char *p; | 60 const char *p; |
46 char *r; | 61 char *r; |
47 | 62 |