[BACK]Return to test-getline.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

File: [cvsweb.bsd.lv] / mandoc / test-getline.c (download)

Revision 1.1, Sat Nov 7 20:52:52 2015 UTC (8 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_6, VERSION_1_14_5, VERSION_1_14_4, VERSION_1_14_3, VERSION_1_14_2, VERSION_1_14_1, VERSION_1_13_4, VERSION_1_13, HEAD

provide a simple stand-alone implementation of getline(3)
for systems lacking it

#include <sys/types.h>
#include <stdio.h>
#include <unistd.h>

int
main(void)
{
	char	*line = NULL;
	size_t	 linesz = 0;

	fclose(stdin);
	return getline(&line, &linesz, stdin) != -1;
}