blob: 07d339d887066554f16e067956e4a6c9a0705a66 (
plain) (
tree)
|
|
int smprintf (char ** str, const char * format, ...) { /* allocates automaticalls (: */
va_list ap, aq;
va_start(ap, format);
va_copy(aq, ap);
int len = vsnprintf(NULL, 0, format, ap);
*str = malloc(len+1);
if (len != vsprintf(*str, format, ap))
fprintf(stderr, "[BUG] !!! len1 != len2\n");
va_end(ap);
va_end(aq);
return len;
}
char * startswith (char * testiranec, char * začetek) {
if (!strncmp(testiranec, začetek, strlen(začetek)))
return testiranec+strlen(začetek);
return NULL;
}
|