equal
deleted
inserted
replaced
160 } |
160 } |
161 outbuf[outpos] = 0; |
161 outbuf[outpos] = 0; |
162 char *shrunk = realloc(outbuf, outpos+1); |
162 char *shrunk = realloc(outbuf, outpos+1); |
163 return shrunk ? shrunk : outbuf; |
163 return shrunk ? shrunk : outbuf; |
164 } |
164 } |
|
165 |
|
166 bool flib_contains_dir_separator(const char *str) { |
|
167 if(!log_badparams_if(!str)) { |
|
168 for(;*str;str++) { |
|
169 if(*str=='\\' || *str=='/') { |
|
170 return true; |
|
171 } |
|
172 } |
|
173 } |
|
174 return false; |
|
175 } |
|
176 |
|
177 int flib_gets(char *str, size_t strlen) { |
|
178 if(fgets(str, strlen, stdin)) { |
|
179 for(char *s=str; *s; s++) { |
|
180 if(*s=='\r' || *s=='\n') { |
|
181 *s = 0; |
|
182 break; |
|
183 } |
|
184 } |
|
185 return 0; |
|
186 } |
|
187 return -1; |
|
188 } |