Mercurial > hg > mlmmj
changeset 241:736bf7713eca
removed dead code
author | mortenp |
---|---|
date | Sat, 19 Jun 2004 11:36:37 +1000 |
parents | 1a66aeb8fca7 |
children | 667b62093c98 |
files | src/mygetline.c |
diffstat | 1 files changed, 0 insertions(+), 47 deletions(-) [+] |
line wrap: on
line diff
--- a/src/mygetline.c Sat Jun 19 11:08:51 2004 +1000 +++ b/src/mygetline.c Sat Jun 19 11:36:37 2004 +1000 @@ -66,50 +66,3 @@ } } } - -#if 0 -char *myfgetline(FILE *infile) -{ - size_t buf_size = BUFSIZE; /* initial buffer size */ - size_t buf_used; - char *buf = malloc(buf_size); - - buf[0] = '\0'; - - if(infile == NULL) - return NULL; - - for (;;) { - buf_used = strlen(buf); - if (fgets(buf+buf_used, buf_size-buf_used, infile) == NULL) { - if (buf[0]) { - return buf; - } else { - free(buf); - return NULL; - } - } - - if ((strlen(buf) < buf_size-1) || (buf[buf_size-1] == '\n')) { - return buf; - } - - /* grow buffer */ - buf_size *= 2; - buf = realloc(buf, buf_size); - - } -} - -int main(int argc, char **argv) -{ - char *str; - - while((str = mygetline(fileno(stdin)))) { - printf("%s", str); - free(str); - } - - return 0; -} -#endif