s_memappend.c 332 B

1234567891011121314151617181920
  1. #include <u.h>
  2. #include <libc.h>
  3. #include "String.h"
  4. /* append a char array ( of up to n characters) to a String */
  5. String *
  6. s_memappend(String *to, char *from, int n)
  7. {
  8. char *e;
  9. if (to == 0)
  10. to = s_new();
  11. if (from == 0)
  12. return to;
  13. for(e = from + n; from < e; from++)
  14. s_putc(to, *from);
  15. s_terminate(to);
  16. return to;
  17. }