From owner-svn-src-head@freebsd.org Wed May 16 01:08:12 2018 Return-Path: Delivered-To: svn-src-head@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 700E7EE2CAB; Wed, 16 May 2018 01:08:12 +0000 (UTC) (envelope-from emaste@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 1FFF06E2CB; Wed, 16 May 2018 01:08:12 +0000 (UTC) (envelope-from emaste@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 F07BE13404; Wed, 16 May 2018 01:08:11 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4G18Blu021000; Wed, 16 May 2018 01:08:11 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4G18Bks020999; Wed, 16 May 2018 01:08:11 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201805160108.w4G18Bks020999@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 16 May 2018 01:08:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r333657 - head/tools/tools/intel-ucode-split X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/tools/tools/intel-ucode-split X-SVN-Commit-Revision: 333657 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 May 2018 01:08:12 -0000 Author: emaste Date: Wed May 16 01:08:11 2018 New Revision: 333657 URL: https://svnweb.freebsd.org/changeset/base/333657 Log: intel-ucode-split: add a -v verbose flag And be quiet by default. Sponsored by: The FreeBSD Foundation Modified: head/tools/tools/intel-ucode-split/intel-ucode-split.c Modified: head/tools/tools/intel-ucode-split/intel-ucode-split.c ============================================================================== --- head/tools/tools/intel-ucode-split/intel-ucode-split.c Wed May 16 00:57:42 2018 (r333656) +++ head/tools/tools/intel-ucode-split/intel-ucode-split.c Wed May 16 01:08:11 2018 (r333657) @@ -29,6 +29,7 @@ #include #include +#include #include #include #include @@ -97,7 +98,7 @@ static void usage(void) { - printf("ucode-split microcode_file\n"); + printf("ucode-split [-v] microcode_file\n"); exit(1); } @@ -109,12 +110,26 @@ main(int argc, char *argv[]) char *buf; size_t len, resid; ssize_t rv; - int ifd, ofd; + int c, ifd, ofd; + bool vflag; - if (argc != 2) + vflag = false; + while ((c = getopt(argc, argv, "v")) != -1) { + switch (c) { + case 'v': + vflag = true; + break; + default: + usage(); + } + } + argc -= optind; + argv += optind; + + if (argc != 1) usage(); - ifd = open(argv[1], O_RDONLY); + ifd = open(argv[0], O_RDONLY); if (ifd < 0) err(1, "open"); @@ -133,7 +148,8 @@ main(int argc, char *argv[]) errx(1, "invalid microcode header"); } - dump_header(&hdr); + if (vflag) + dump_header(&hdr); format_signature(output_file, hdr.processor_signature); sprintf(output_file + strlen(output_file), ".%02x", @@ -163,7 +179,8 @@ main(int argc, char *argv[]) err(1, "write"); resid -= len; } - printf("written to %s\n\n", output_file); + if (vflag) + printf("written to %s\n\n", output_file); close(ofd); } }