Windows uses '/' to specify command line arguments. Change getopt to allow using '-' or '/'.
This allows all applications using getopt to specify all options using a '-' or '/', including a mix. Long options still require the use of '--'. The use of /? now behaves the same as -?. Signed-off-by: Sean Hefty <[email protected]> --- trunk/etc/user/getopt.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/trunk/etc/user/getopt.c b/trunk/etc/user/getopt.c index af9230c..dded0bd 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; } _______________________________________________ ofw mailing list [email protected] http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw
