X-Git-Url: http://git.ozo.com/?a=blobdiff_plain;ds=sidebyside;f=tools%2Finclude%2Fgetline.h;h=02df6c2f7900734aa9798c3eeef0cc6e9607ae88;hb=05c6fa7208e57281c0d24ac39812c9bf8a9be731;hp=219be752049fa9f8e15287782f4b38cbd7c01e63;hpb=652d9073459fce55104f0db8f64fc5b9100c979d;p=openwrt-10.03%2F.git diff --git a/tools/include/getline.h b/tools/include/getline.h index 219be7520..02df6c2f7 100644 --- a/tools/include/getline.h +++ b/tools/include/getline.h @@ -27,12 +27,12 @@ * SUCH DAMAGE. */ -#ifndef __linux__ #include #include #include #include +#if !defined(__linux__) && !(defined(__APPLE__) && __DARWIN_C_LEVEL >= 200809L) /* * Emulate glibc getline() via BSD fgetln(). * Note that outsize is not changed unless memory is allocated. @@ -40,10 +40,16 @@ static inline ssize_t getline(char **outbuf, size_t *outsize, FILE *fp) { - char *buf; size_t len; +#ifndef __CYGWIN__ + char *buf; buf = fgetln(fp, &len); +#else + char buf[512]; + fgets(buf, sizeof(buf), fp); + len = strlen(buf); +#endif if (buf == NULL) return (-1);