You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

37 line
704 B

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