From b7d9b20fdf175cbebdaa8baa3d338262b5e726a5 Mon Sep 17 00:00:00 2001 From: Sean Hefty Date: Fri, 15 Jan 2010 17:14:20 +0000 Subject: [PATCH] etc/getopt: allow use of '/' for command line args Windows uses '/' to specify command line arguments. Change getopt to allow using '-' or '/'. Signed-off-by: Sean Hefty git-svn-id: svn://openib.tc.cornell.edu/gen1@2668 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- trunk/etc/user/getopt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/trunk/etc/user/getopt.c b/trunk/etc/user/getopt.c index af9230cb..dded0bd2 100644 --- a/trunk/etc/user/getopt.c +++ b/trunk/etc/user/getopt.c @@ -49,7 +49,7 @@ int getopt(int argc, char * const argv[], char const *opts) return EOF; } - if (argv[optind][0] != '-') { + if (argv[optind][0] != '-' && argv[optind][0] != '/') { return EOF; } @@ -82,7 +82,7 @@ int getopt(int argc, char * const argv[], char const *opts) optarg = NULL; goto out; } - if (argv[optind+1] && argv[optind+1][0] == '-') + if (argv[optind+1] && (argv[optind+1][0] == '-' || argv[optind+1][0] == '/')) goto out; } @@ -107,7 +107,7 @@ int getopt_long(int argc, char * const argv[], char const *opts, return EOF; } - if (argv[optind][0] != '-') { + if (argv[optind][0] != '-' && argv[optind][0] != '/') { return EOF; } -- 2.46.0