Lines Matching defs:to

4  * The contents of this file are subject to the terms of the
24 * Use is subject to license terms.
38 /* global to this file */
111 * take a larger increment to avoid mallocing too often
166 sp->ptr = sp->end - (size_t)1; /* point to NULL terminator */
170 /* convert string to lower case */
187 /* append a char array to a string */
189 s_append(string *to, char *from)
191 if (to == NULL)
192 to = s_new();
194 return (to);
196 s_putc(to, (int)(unsigned int)*from);
197 s_terminate(to);
198 return (to);
204 * The `lineortoken' variable indicates whether the sequence to beinput
207 * FILE *fp; stream to read from
208 * string *to; where to put token
211 * Returns a pointer to the string or NULL. Trailing newline is stripped off.
214 s_seq_read(FILE *fp, string *to, int lineortoken)
227 if (to != NULL)
228 s_terminate(to);
247 if (to == NULL)
248 to = s_new();
256 s_putc(to, (int)(unsigned int)'\\');
257 s_putc(to, c);
264 s_terminate(to);
265 return (to);
269 s_terminate(to);
270 return (to);
274 s_putc(to, c);
287 string *to = s_new();
289 s_putc(to, (int)(unsigned int)*from->ptr);
292 s_terminate(to);
293 s_restart(to);
294 /* LINT: warning due to lint bug */
296 return (to);
300 string *to = s_clone(from);
303 return (to);
311 * Append an input line to a string.
313 * Returns a pointer to the string (or NULL).
317 s_read_line(FILE *fp, string *to)
322 s_terminate(to);
333 s_terminate(to);
334 return (to->ptr - len);
336 s_putc(to, (int)(unsigned int)'\n');
337 s_terminate(to);
338 return (to->ptr - len);
340 s_putc(to, c);
351 s_read_to_eof(FILE *fp, string *to)
356 s_terminate(to);
362 have = to->end - to->ptr;
364 s_simplegrow(to, (size_t)4096);
367 have = to->end - to->ptr;
368 got = fread(to->ptr, (size_t)1, have, fp);
371 /* LINT: warning due to lint bug */
372 to->ptr += got;
376 s_terminate(to);
377 return (to->ptr - to->base);
384 * string *from; string to parse
385 * string *to; where to put parsed token
388 s_parse(string *from, string *to)
394 if (to == NULL)
395 to = s_new();
399 s_putc(to, (int)(unsigned int)*from->ptr);
405 s_putc(to, (int)(unsigned int)*from->ptr);
410 s_putc(to, (int)(unsigned int)*from->ptr);
412 s_terminate(to);
414 return (to);