Author: bapt Date: Sat May 7 18:21:58 2016 New Revision: 299216 URL: https://svnweb.freebsd.org/changeset/base/299216
Log: Replace fparseln(3) with getline(3) It removes a dependency on libutil. Modified: head/usr.bin/sdiff/Makefile head/usr.bin/sdiff/sdiff.c Modified: head/usr.bin/sdiff/Makefile ============================================================================== --- head/usr.bin/sdiff/Makefile Sat May 7 08:30:21 2016 (r299215) +++ head/usr.bin/sdiff/Makefile Sat May 7 18:21:58 2016 (r299216) @@ -6,7 +6,6 @@ PROG= sdiff SRCS= common.c edit.c sdiff.c WARNS= 3 -LIBADD= util MAN1= sdiff.1 .if ${MK_TESTS} != "no" Modified: head/usr.bin/sdiff/sdiff.c ============================================================================== --- head/usr.bin/sdiff/sdiff.c Sat May 7 08:30:21 2016 (r299215) +++ head/usr.bin/sdiff/sdiff.c Sat May 7 18:21:58 2016 (r299216) @@ -22,11 +22,11 @@ __FBSDID("$FreeBSD$"); #include <limits.h> #include <paths.h> #include <stdint.h> +#define _WITH_GETLINE #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> -#include <libutil.h> #include "common.h" #include "extern.h" @@ -693,20 +693,23 @@ println(const char *s1, const char div, static char * xfgets(FILE *file) { - const char delim[3] = {'\0', '\0', '\0'}; + size_t linecap; + ssize_t l; char *s; - /* XXX - Is this necessary? */ clearerr(file); + linecap = 0; + s = NULL; - if (!(s = fparseln(file, NULL, NULL, delim, 0)) && - ferror(file)) - err(2, "error reading file"); - - if (!s) { + if ((l = getline(&s, &linecap, file)) == -1) { + if (ferror(file)) + err(2, "error reading file"); return (NULL); } + if (s[l-1] == '\n') + s[l-1] = '\0'; + return (s); } _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"