Beispiel #1
0
void jx_print_link( struct jx *j, struct link *l, time_t stoptime )
{

	buffer_t buffer;
	buffer_init(&buffer);
	jx_print_buffer(j,&buffer);

	size_t len;
	const char *str = buffer_tolstring(&buffer, &len);

	link_write(l,str,len,stoptime);
	buffer_free(&buffer);
}
Beispiel #2
0
int link_putvfstring(struct link *link, const char *fmt, time_t stoptime, va_list va)
{
	int rc;
	size_t l;
	const char *str;
	buffer_t B;

	buffer_init(&B);
	if (buffer_putvfstring(&B, fmt, va) == -1)
		return -1;
	str = buffer_tolstring(&B, &l);
	rc = link_putlstring(link, str, l, stoptime);
	buffer_free(&B);

	return rc;
}
int cfs_fflush(CHIRP_FILE * file)
{
	size_t size;
	const char *content;

	if(file->type == LOCAL)
		return fflush(file->f.lfile);

	content = buffer_tolstring(&file->f.cfile.B, &size);

	while((INT64_T) size > file->f.cfile.offset) {	/* finish all writes */
		int w = cfs->pwrite(file->f.cfile.fd, content, size, file->f.cfile.offset);
		if(w == -1) {
			file->f.cfile.error = EIO;
			return EOF;
		}
		file->f.cfile.offset += w;
	}
	return 0;
}