Esempio n. 1
0
int watch_write(watch_t *w, const char *format, ...) {			/* XXX, refactory: watch_writef() */
	char		*text;
	int		textlen;
	va_list		ap;
	int		res;

	if (!w || !format)
		return -1;

	va_start(ap, format);
	text = vsaprintf(format, ap);
	va_end(ap);
	
	textlen = xstrlen(text); 

	debug_io("[watch]_send: %s\n", text ? textlen ? text: "[0LENGTH]":"[FAILED]");

	if (!text) 
		return -1;

	res = watch_write_data(w, text, textlen);

	xfree(text);
	return res;
}
Esempio n. 2
0
File: util.c Progetto: leia/dfsch
void dfsch_sl_printf(str_list_t* sl, char* format, ...){
  char* ret;
  va_list args;
  va_start(args, format);
  ret = vsaprintf(format, args);
  sl_append(sl, ret);
  va_end(args);
}
Esempio n. 3
0
File: util.c Progetto: leia/dfsch
char* dfsch_saprintf(char* format, ...){
  char* ret;
  va_list args;
  va_start(args, format);
  ret = vsaprintf(format, args);
  va_end(args);
  return ret;
}
Esempio n. 4
0
char *saprintf(const char *format, ...)
{
	va_list ap;
	char *res;

	va_start(ap, format);
	res = vsaprintf(format, ap);
	va_end(ap);

	return res;
}
Esempio n. 5
0
int vfprintf(FILE *stream, const char *format, va_list ap) {
	char *string;

	if (!stream) {
		return -1;
	}

	string = vsaprintf(format, ap);

	if (!string) {
		return -1;
	}

	fwrite(string, strlen(string), sizeof(char), stream);
	free(string);

	return 0;
}