runit

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

stralloc_opyb.c (273B)


      1 /* Public domain. */
      2 
      3 #include "stralloc.h"
      4 #include "byte.h"
      5 
      6 int stralloc_copyb(stralloc *sa,const char *s,unsigned int n)
      7 {
      8   if (!stralloc_ready(sa,n + 1)) return 0;
      9   byte_copy(sa->s,n,s);
     10   sa->len = n;
     11   sa->s[n] = 'Z'; /* ``offensive programming'' */
     12   return 1;
     13 }