From owner-svn-src-all@freebsd.org Wed May 23 02:54:29 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E2D77EEC459; Wed, 23 May 2018 02:54:28 +0000 (UTC) (envelope-from wollman@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9836073B77; Wed, 23 May 2018 02:54:28 +0000 (UTC) (envelope-from wollman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 784E81CE40; Wed, 23 May 2018 02:54:28 +0000 (UTC) (envelope-from wollman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4N2sSM4020345; Wed, 23 May 2018 02:54:28 GMT (envelope-from wollman@FreeBSD.org) Received: (from wollman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4N2sSba020344; Wed, 23 May 2018 02:54:28 GMT (envelope-from wollman@FreeBSD.org) Message-Id: <201805230254.w4N2sSba020344@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wollman set sender to wollman@FreeBSD.org using -f From: Garrett Wollman Date: Wed, 23 May 2018 02:54:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334071 - head/usr.bin/getconf X-SVN-Group: head X-SVN-Commit-Author: wollman X-SVN-Commit-Paths: head/usr.bin/getconf X-SVN-Commit-Revision: 334071 X-SVN-Commit-Repository: base 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.26 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: Wed, 23 May 2018 02:54:29 -0000 Author: wollman Date: Wed May 23 02:54:28 2018 New Revision: 334071 URL: https://svnweb.freebsd.org/changeset/base/334071 Log: Whoops, forgot to add this file in r334070. PR: 164049 Added: head/usr.bin/getconf/unsigned_limits.gperf (contents, props changed) Added: head/usr.bin/getconf/unsigned_limits.gperf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/getconf/unsigned_limits.gperf Wed May 23 02:54:28 2018 (r334071) @@ -0,0 +1,43 @@ +%{ +/* + * Copyright is disclaimed as to the contents of this file. + * + * $FreeBSD$ + */ + +#include + +#include +#include + +#include "getconf.h" + +/* + * Override gperf's built-in external scope. + */ +static const struct map *in_word_set(const char *str); + +%} +struct map { const char *name; uintmax_t value; int valid; }; +%% +UCHAR_MAX, UCHAR_MAX +UINT_MAX, UINT_MAX +ULLONG_MAX, ULLONG_MAX +ULONG_MAX, ULONG_MAX +USHRT_MAX, USHRT_MAX +%% +int +find_unsigned_limit(const char *name, uintmax_t *value) +{ + const struct map *rv; + + rv = in_word_set(name); + if (rv != NULL) { + if (rv->valid) { + *value = rv->value; + return 1; + } + return -1; + } + return 0; +}