lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180815142749.18804-2-linux@rasmusvillemoes.dk>
Date:   Wed, 15 Aug 2018 16:27:47 +0200
From:   Rasmus Villemoes <linux@...musvillemoes.dk>
To:     Masahiro Yamada <yamada.masahiro@...ionext.com>,
        Michal Marek <michal.lkml@...kovi.net>
Cc:     linux-kbuild@...r.kernel.org,
        Rasmus Villemoes <linux@...musvillemoes.dk>,
        linux-kernel@...r.kernel.org
Subject: [PATCH 1/3] Kbuild: refactor fixdep to use getopt()

As preparation for teaching an old dog a few new tricks.

Signed-off-by: Rasmus Villemoes <linux@...musvillemoes.dk>
---
 scripts/basic/fixdep.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c
index 850966f3d602..666041841200 100644
--- a/scripts/basic/fixdep.c
+++ b/scripts/basic/fixdep.c
@@ -381,16 +381,23 @@ int main(int argc, char *argv[])
 	const char *depfile, *target, *cmdline;
 	int insert_extra_deps = 0;
 	void *buf;
+	int opt;
 
-	if (argc == 5 && !strcmp(argv[1], "-e")) {
-		insert_extra_deps = 1;
-		argv++;
-	} else if (argc != 4)
+	while ((opt = getopt(argc, argv, "e")) != -1) {
+		switch (opt) {
+		case 'e': insert_extra_deps = 1; break;
+		default: usage();
+		}
+	}
+	argc -= optind;
+	argv += optind;
+
+	if (argc != 3)
 		usage();
 
-	depfile = argv[1];
-	target = argv[2];
-	cmdline = argv[3];
+	depfile = argv[0];
+	target = argv[1];
+	cmdline = argv[2];
 
 	printf("cmd_%s := %s\n\n", target, cmdline);
 
-- 
2.16.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ