search for: optopt

Displaying 20 results from an estimated 37 matches for "optopt".

Did you mean: optout
2002 Jun 16
1
multiple definition of `optind'
Any ideas of the best way around this problem? Should I just hack the source code, or is there a magic switch somewhere I'm missing? I'm assuming I can't just dismiss that function as OpenSSH is probably based on the OpenBSD semantics. ============================================================================= gcc -g -O2 -Wall -Wno-uninitialized -I. -I.
2012 Feb 29
15
[RFC] [PATCH] Add btrfs autosnap feature
From: anand jain <anand.jain@oracle.com> Anand Jain (1): [RFC] Add btrfs autosnap feature Makefile | 6 +- autosnap.c | 1553 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ autosnap.h | 81 +++ btrfs-list.c | 140 +++++- btrfs.c | 46 ++- btrfs_cmds.c | 186 +++++++- btrfs_cmds.h | 3 +- scrub.c | 1 + 8 files changed, 1982 insertions(+), 34
2020 Jun 18
1
[PATCH] Kbuild for klibc and nfsmount: fix multiple definitions
...ltiple definition of `optind'; usr/klibc/getopt.o:(.sbss+0x8): first defined here ppc-linux-ld: usr/klibc/getopt_long.o:(.sbss+0xc): multiple definition of `optarg'; usr/klibc/getopt.o:(.sbss+0xc): first defined here ppc-linux-ld: usr/klibc/getopt_long.o:(.sbss+0x0): multiple definition of `optopt'; usr/klibc/getopt.o:(.sbss+0x0): first defined here ppc-linux-ld: usr/klibc/getopt_long.o:(.sbss+0x4): multiple definition of `opterr'; usr/klibc/getopt.o:(.sbss+0x4): first defined here ppc-linux-ld: usr/klibc/mrand48.o:/root/ldb_base/ofl/packages/klibc-2.0.7/usr/klibc/mrand48.c:8: multip...
2001 Dec 24
0
static compilation
I had the same problem compiling openssh-3.0.2p1 statically on Slackware 8.0. The problem is caused by the redefinition of opterr, optind, and optopt in openbsd-compat/getopt.c (previously defined in libc). Here's how I was able to get it to build statically: 1. ./configure 2. edit openbsd-compat/getopt.c 45 //int opterr = 1, /* if error message should be printed */ 46 // optind = 1, /* index into parent argv...
2008 Mar 25
2
bunch of small fixes
...&= ~MS_RDONLY; break; + case 'f': + /* we can't edit /etc/mtab yet anyway; exit */ + exit(0); + case 'i': + /* ignore for now; no support for mount helpers */ + break; case '?': fprintf(stderr, "%s: invalid option -%c\n", progname, optopt); @@ -98,7 +104,7 @@ int main(int argc, char *argv[]) type = "none"; if (optind + 2 != argc || type == NULL) { - fprintf(stderr, "Usage: %s [-r] [-w] [-o options] [-t type] " + fprintf(stderr, "Usage: %s [-r] [-w] [-o options] [-t type] [-f] [-i] " "[...
2012 Mar 20
5
[PATCH] Add vncviewer xm compatibility options the 'xl create' command
...break; break; + case ''v'': + vnc = 1; + break; + case ''a'': + vnc = vncautopass = 1; + break; default: fprintf(stderr, "option `%c'' not supported.\n", optopt); break; @@ -3391,12 +3403,40 @@ dom_info.migrate_fd = -1; dom_info.console_autoconnect = console_autoconnect; dom_info.incr_generationid = 0; + dom_info.vncviewer = vnc; + dom_info.vncviewer_autopass = vncautopass; + rc = create_domain(&dom_info);...
2016 Jun 18
2
Supporting sub commands in LLVM command line tools
Not sure I follow how this would work. "llvm" is an executable, and "opt" is a symlink to "llvm"? How does llvm then detect that it needs to use the opt set of commands? That said, in principle sure you could have "llvm opt <opt-specific command syntax>" or "llvm llc <llc options>". At some point you'd probably need to extend
2016 Jan 06
0
[klibc:master] readlink: Add -f option
...progname = *argv++; + progname = argv[0]; - if (argc < 2) + do { + c = getopt(argc, argv, "f"); + if (c == EOF) + break; + switch (c) { + case 'f': + f_flag = 1; + break; + + case '?': + fprintf(stderr, "%s: invalid option -%c\n", + progname, optopt); + usage(); + } + } while (1); + + if (optind == argc) usage(); + argv += optind; while ((name = *argv++)) { - rv = readlink(name, link_name, sizeof link_name - 1); + if (f_flag) + rv = realpath(name, link_name) ? strlen(link_name) : -1; + else + rv = readlink(name, link_name, siz...
2010 Oct 22
0
[PATCH] tools/xenstat/xentop/xentop.c -- fix xentop so it returns the correct exit code on invalid argument
...' and the case from switch matching it. The solution was to remove the case ''?'' so that the default match could be triggered. Quote from `man 3 getopt` "If getopt() does not recognize an option character, it prints an error message to stderr, stores the character in optopt, and returns ''?''." --- tools/xenstat/xentop/xentop.c-orig 2010-10-22 15:20:13.000000000 -0700 +++ tools/xenstat/xentop/xentop.c 2010-10-22 15:20:21.000000000 -0700 @@ -1135,7 +1135,6 @@ default: usage(argv[0]);...
2010 Apr 16
1
Failure compiling 1.0.19 on OSX 10.5.8
...cho './'`bin/quartzcompact.cc ./common/gnu_getopt.h:71: error: ?optarg? is already declared in this scope ./common/gnu_getopt.h:72: error: ?optind? is already declared in this scope ./common/gnu_getopt.h:73: error: ?opterr? is already declared in this scope ./common/gnu_getopt.h:74: error: ?optopt? is already declared in this scope make[2]: *** [bin/bin_quartzcompact-quartzcompact.o] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2 Thanks, -- Zach Dennis http://www.continuousthinking.com (personal) http://www.mutuallyhuman.com (hire me) http://ideafoundry.info/behavio...
2004 Aug 19
1
tftp-hpa: getopt problems
Hi! I hope this is the right list for sending tftpd-patches - if not, please point me in the right direction... I experienced quite strange problems when trying to use tftp-hpa in newer Cygwin versions. It simply isn't able to parse its command line correctly because it seems to use another optind variable than getopt(). When you try to start it with something like tftpd.exe -s /mypath
2003 Apr 29
0
[PATCH] ipconfig: fix memory leak, and exit if no interfaces to configure
...- "dest to %d\n", local_port, remote_port); break; case 't': loop_timeout = atoi(optarg); @@ -448,7 +462,6 @@ case 'd': add_device(optarg); break; - case '?': fprintf(stderr, "%s: invalid option -%c\n", progname, optopt); @@ -456,6 +469,13 @@ } } while (1); + check_for_devs(); + + if (local_port != LOCAL_PORT) { + printf("IP-Config: binding source port to %d, " + "dest to %d\n", local_port, remote_port); + } + loop(); return 0;
2004 Feb 21
1
[PATCH] ln for klibc utils
...tat sb; + + s = f = 0; + do { + c = getopt(argc, argv, "sf"); + if (c == EOF) + break; + + switch (c) { + + case 's': + s = 1; + break; + case 'f': + f = 1; + break; + case '?': + fprintf(stderr, "%s: invalid option -%c\n", + argv[0], optopt); + return 1; + } + + } while (1); + + if (optind == argc) { + fprintf(stderr, "Usage: %s [-s] [-f] target link\n", + argv[0]); + return 1; + } + + memset(&sb, 0, sizeof(struct stat)); + if (stat(argv[argc - 1], &sb) < 0 && argc - optind > 2) { + if (!(S_ISDI...
2005 Jan 05
2
[PATCH] getopt
...ch to guarantee __optptr initialization and to correctly increment optind for missing arguments. --- klibc-0.194/klibc/getopt.c.orig 2005-01-04 23:18:50.229222640 -0700 +++ klibc-0.194/klibc/getopt.c 2005-01-04 23:17:05.236184008 -0700 @@ -11,7 +11,7 @@ char *optarg; int optind = 1; int opterr, optopt; -static const char *__optptr; +static const char *__optptr = NULL; int getopt(int argc, char * const *argv, const char *optstring) { @@ -51,6 +51,7 @@ optind += 2; } else { /* Missing argument */ + optind++; return (optstring[0] == ':') ? ':' : '?'; }...
2006 Aug 24
0
[patch] mkdir use and add usage
...rr, "Usage: %s [-p] [-m mode] dir...\n", progname); + exit(1); +} + static int make_one_dir(char *dir, mode_t mode) { struct stat stbuf; @@ -131,14 +137,12 @@ int main(int argc, char *argv[]) case '?': fprintf(stderr, "%s: invalid option -%c\n", progname, optopt); - exit(1); + usage(); } } while (1); - if (optind == argc) { - fprintf(stderr, "Usage: %s [-p] [-m mode] dir...\n", progname); - exit(1); - } + if (optind == argc) + usage(); while (optind < argc) { if (make_dir(argv[optind])) -- maks
2007 Feb 18
0
[PATCH] umount: Add -l option for lazy unmount
...quot;); + c = getopt(argc, argv, "fl"); if (c == EOF) break; switch (c) { case 'f': flag |= MNT_FORCE; break; + case 'l': + flag |= MNT_DETACH; + break; case '?': fprintf(stderr, "%s: invalid option -%c\n", progname, optopt); @@ -32,7 +35,7 @@ int main(int argc, char *argv[]) } while (1); if (optind + 1 != argc) { - fprintf(stderr, "Usage: %s [-f] mntpoint\n", progname); + fprintf(stderr, "Usage: %s [-f] [-l] mntpoint\n", progname); return 1; } -- 1.5.0.57.g09e9d
2011 Jun 11
0
[PATCH] utils add minimal mv
...ar *argv[]) +{ + int c, f; + char *p; + struct stat sb; + + f = 0; + do { + c = getopt(argc, argv, "f"); + if (c == EOF) + break; + + switch (c) { + + case 'f': + f = 1; + break; + case '?': + fprintf(stderr, "%s: invalid option -%c\n", + argv[0], optopt); + return 1; + } + + } while (1); + + if (optind == argc) { + fprintf(stderr, "Usage: %s [-f] source dest\n", argv[0]); + return 1; + } + + memset(&sb, 0, sizeof(struct stat)); + if (stat(argv[argc - 1], &sb) < 0 && argc - optind > 2) { + if (!(S_ISDIR(sb.st_m...
2014 Sep 27
1
[PATCH 2/2] readlink: Add -f option
...progname = *argv++; + progname = argv[0]; - if (argc < 2) + do { + c = getopt(argc, argv, "f"); + if (c == EOF) + break; + switch (c) { + case 'f': + f_flag = 1; + break; + + case '?': + fprintf(stderr, "%s: invalid option -%c\n", + progname, optopt); + usage(); + } + } while (1); + + if (optind == argc) usage(); + argv += optind; while ((name = *argv++)) { - rv = readlink(name, link_name, sizeof link_name - 1); + if (f_flag) + rv = realpath(name, link_name) ? strlen(link_name) : -1; + else + rv = readlink(name, link_name, siz...
2019 Jan 18
1
Re: [PATCH nbdkit 1/2] include: Fix NBDKIT_HANDLE_NOT_NEEDED for C90 compilers.
...ersally declares optind. gnulib states that MSVC 14 lacks <unistd.h>. Other POSIX standardized global variables: environ (but no standardized header declares it) daylight, getdate_err, timezone, tzname (<time.h>, but both marked XSI so not necessarily on all platforms) optarg, opterr, optopt (<unistd.h>, same boat as optind) signgam (<math.h>, but marked XSI, and requires -lm on some platforms) stdin, stdout, stderr (<stdio.h>) Also, pulling in the address of one of these forces the variable to be linked in. For errno or stdin, that's okay (you're probably li...
2020 Jun 17
1
[PATCH] Kbuild for klibc and nfsmount: add -fcommon
...ltiple definition of `optind'; usr/klibc/getopt.o:(.sbss+0x8): first defined here ppc-linux-ld: usr/klibc/getopt_long.o:(.sbss+0xc): multiple definition of `optarg'; usr/klibc/getopt.o:(.sbss+0xc): first defined here ppc-linux-ld: usr/klibc/getopt_long.o:(.sbss+0x0): multiple definition of `optopt'; usr/klibc/getopt.o:(.sbss+0x0): first defined here ppc-linux-ld: usr/klibc/getopt_long.o:(.sbss+0x4): multiple definition of `opterr'; usr/klibc/getopt.o:(.sbss+0x4): first defined here ppc-linux-ld: usr/klibc/mrand48.o:/root/ldb_base/ofl/packages/klibc-2.0.7/usr/klibc/mrand48.c:8: multip...