From owner-freebsd-bugs@FreeBSD.ORG Tue May 30 13:20:27 2006 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9588B16A7CD for ; Tue, 30 May 2006 13:20:27 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id BFE4C43D5E for ; Tue, 30 May 2006 13:20:23 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k4UDKN1n047687 for ; Tue, 30 May 2006 13:20:23 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k4UDKNct047686; Tue, 30 May 2006 13:20:23 GMT (envelope-from gnats) Resent-Date: Tue, 30 May 2006 13:20:23 GMT Resent-Message-Id: <200605301320.k4UDKNct047686@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Andrey Simonenko Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EED2016A425 for ; Tue, 30 May 2006 13:16:53 +0000 (UTC) (envelope-from simon@comsys.ntu-kpi.kiev.ua) Received: from comsys.ntu-kpi.kiev.ua (comsys.ntu-kpi.kiev.ua [195.245.194.142]) by mx1.FreeBSD.org (Postfix) with ESMTP id 449AE43D48 for ; Tue, 30 May 2006 13:16:40 +0000 (GMT) (envelope-from simon@comsys.ntu-kpi.kiev.ua) Received: from pm513-1.comsys.ntu-kpi.kiev.ua (pm513-1.comsys.ntu-kpi.kiev.ua [10.18.52.101]) (authenticated bits=0) by comsys.ntu-kpi.kiev.ua (8.13.6/8.13.6) with ESMTP id k4UDHQsq007040 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Tue, 30 May 2006 16:17:26 +0300 (EEST) Received: by pm513-1.comsys.ntu-kpi.kiev.ua (Postfix, from userid 1001) id DC1AB5C023; Tue, 30 May 2006 16:16:29 +0300 (EEST) Message-Id: <20060530131629.GA2438@pm513-1.comsys.ntu-kpi.kiev.ua> Date: Tue, 30 May 2006 16:16:29 +0300 From: Andrey Simonenko To: FreeBSD-gnats-submit@FreeBSD.org Cc: Subject: bin/98141: [patch] Update for regression/sockets/unix_cmsg X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 May 2006 13:20:28 -0000 >Number: 98141 >Category: bin >Synopsis: [patch] Update for regression/sockets/unix_cmsg >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: update >Submitter-Id: current-users >Arrival-Date: Tue May 30 13:20:22 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Andrey Simonenko >Release: FreeBSD 7.0-CURRENT >Organization: >Environment: >Description: I updated sockets/unix_cmsg regression tests: o Let getopt(3) report errors in command line arguments. o If something is wrong with options, then output short usage help message. o Use PRIdMAX macro for outputting intmax_t values. o Output errstr returned from strtonum(3). >How-To-Repeat: >Fix: --- unix_cmsg.c.orig Mon May 29 21:40:55 2006 +++ unix_cmsg.c Tue May 30 15:43:00 2006 @@ -162,12 +162,14 @@ * Output the help message (-h switch). */ static void -usage(void) +usage(int quick) { const struct test_func *test_func; - fprintf(stderr, "Usage: %s [-dhz] [-t ] [testno]\n\n", __progname); - fprintf(stderr, " Options are:\n\ + fprintf(stderr, "Usage: %s [-dhz] [-t ] [testno]\n", __progname); + if (quick) + return; + fprintf(stderr, "\n Options are:\n\ -d\t\t\tOutput debugging information\n\ -h\t\t\tOutput this help message and exit\n\ -t \t\tRun test only for the given socket type:\n\ @@ -314,15 +316,14 @@ int opt, dgramflag, streamflag; u_int testno1, testno2; - opterr = 0; dgramflag = streamflag = 0; - while ((opt = getopt(argc, argv, ":dht:z")) != -1) + while ((opt = getopt(argc, argv, "dht:z")) != -1) switch (opt) { case 'd': debug = 1; break; case 'h': - usage(); + usage(0); return (EX_OK); case 't': if (strcmp(optarg, "stream") == 0) @@ -335,14 +336,10 @@ case 'z': no_control_data = 1; break; - case ':': - errx(EX_USAGE, "option -%c requires an argument", optopt); - /* NOTREACHED */ case '?': - errx(EX_USAGE, "invalid switch -%c", optopt); - /* NOTREACHED */ default: - errx(EX_SOFTWARE, "unexpected option -%c", optopt); + usage(1); + return (EX_USAGE); } if (optind < argc) { @@ -350,7 +347,7 @@ errx(EX_USAGE, "too many arguments"); testno1 = strtonum(argv[optind], 0, UINT_MAX, &errstr); if (errstr != NULL) - errx(EX_USAGE, "wrong test number"); + errx(EX_USAGE, "wrong test number: %s", errstr); } else testno1 = 0; @@ -1560,7 +1557,7 @@ timeval = (const struct timeval *)CMSG_DATA(cmptr); - dbgmsg(("timeval tv_sec %jd, tv_usec %jd", + dbgmsg(("timeval tv_sec %"PRIdMAX", tv_usec %"PRIdMAX, (intmax_t)timeval->tv_sec, (intmax_t)timeval->tv_usec)); if ((cmptr = CMSG_NXTHDR(&msg, cmptr)) != NULL) { >Release-Note: >Audit-Trail: >Unformatted: