From owner-svn-src-all@FreeBSD.ORG Mon May 4 22:29:55 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3B246FB5; Mon, 4 May 2015 22:29:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [8.8.178.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0F3D51039; Mon, 4 May 2015 22:29:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t44MRupK082248; Mon, 4 May 2015 22:27:56 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t44MRtXD082246; Mon, 4 May 2015 22:27:55 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201505042227.t44MRtXD082246@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Mon, 4 May 2015 22:27:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r282439 - head/usr.bin/checknr X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 May 2015 22:29:55 -0000 Author: bapt Date: Mon May 4 22:27:55 2015 New Revision: 282439 URL: https://svnweb.freebsd.org/changeset/base/282439 Log: Remove limitation on input lines by using getline(3) Modified: head/usr.bin/checknr/checknr.1 head/usr.bin/checknr/checknr.c Modified: head/usr.bin/checknr/checknr.1 ============================================================================== --- head/usr.bin/checknr/checknr.1 Mon May 4 22:18:58 2015 (r282438) +++ head/usr.bin/checknr/checknr.1 Mon May 4 22:27:55 2015 (r282439) @@ -28,7 +28,7 @@ .\" @(#)checknr.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd January 26, 2005 +.Dd May 5, 2015 .Dt CHECKNR 1 .Os .Sh NAME @@ -157,7 +157,3 @@ There is no way to define a 1 character .Pp Does not correctly recognize certain reasonable constructs, such as conditionals. -.Pp -Input lines are limited to -.Dv LINE_MAX -(2048) bytes in length. Modified: head/usr.bin/checknr/checknr.c ============================================================================== --- head/usr.bin/checknr/checknr.c Mon May 4 22:18:58 2015 (r282438) +++ head/usr.bin/checknr/checknr.c Mon May 4 22:27:55 2015 (r282439) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); * structured typesetting. */ #include +#define _WITH_GETLINE #include #include #include @@ -284,11 +285,14 @@ process(FILE *f) { int i, n; char mac[5]; /* The current macro or nroff command */ + char *line; + size_t linecap; int pl; - static char line[256]; /* the current line */ + line = NULL; + linecap = 0; stktop = -1; - for (lineno = 1; fgets(line, sizeof line, f); lineno++) { + for (lineno = 1; getline(&line, &linecap, f) > 0; lineno++) { if (line[0] == '.') { /* * find and isolate the macro/command name. @@ -367,6 +371,7 @@ process(FILE *f) } } } + free(line); /* * We've hit the end and look at all this stuff that hasn't been * matched yet! Complain, complain.