1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
#include <ctype.h>
#include <assert.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "htslib/khash.h"
#include "htslib/ksort.h"
#include "htslib/knetfile.h"
#if !(_POSIX_C_SOURCE >= 200809L || _XOPEN_SOURCE >= 700)
/*
* A rudimentary emulation of getline() for systems that dont support it
* natively. Since this is used for PPD file reading, it assumes (possibly
* falsely) that BUFSIZ is big enough.
*/
ssize_t
getline(char **line, size_t *linelen, FILE *fp)
{
if (*linelen == 0)
{
*linelen = BUFSIZ;
*line = malloc(*linelen);
}
memset(*line, 0, *linelen);
fgets(*line, *linelen, fp);
return (strlen(*line));
}
#endif
|