search for: optind

Displaying 20 results from an estimated 332 matches for "optind".

2019 Jan 25
0
[klibc:update-dash] [VAR] Initialise OPTIND after importing environment
...libc/klibc.git;a=commit;h=d91eb7955d736009945a0c8418a07d6b28df020f Author: Herbert Xu <herbert at gondor.apana.org.au> AuthorDate: Fri, 23 Aug 2013 21:27:42 +1000 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Fri, 25 Jan 2019 02:57:21 +0000 [klibc] [VAR] Initialise OPTIND after importing environment On Sat, Mar 23, 2013 at 01:46:20AM +0000, Chris F.A. Johnson wrote: > > According to both the dash man page and the POSIX spec, "When the > shell is invoked, OPTIND is initialized to 1." > > However, it actually takes the value of the envi...
2020 Mar 28
0
[klibc:update-dash] dash: [VAR] Initialise OPTIND after importing environment
...libc.git;a=commit;h=285328db698e018ef91c9f04f59f25e3133d0984 Author: Herbert Xu <herbert at gondor.apana.org.au> AuthorDate: Fri, 23 Aug 2013 21:27:42 +1000 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Sat, 28 Mar 2020 21:42:54 +0000 [klibc] dash: [VAR] Initialise OPTIND after importing environment [ dash commit a14c418aee9d4ccd7cf888024e318b300173099f ] On Sat, Mar 23, 2013 at 01:46:20AM +0000, Chris F.A. Johnson wrote: > > According to both the dash man page and the POSIX spec, "When the > shell is invoked, OPTIND is initialized to 1." &g...
2016 May 05
1
[PATCH] tools: improve reporting for option errors (RHBZ#1316041)
...dd_drives (drvs, 'a'); diff --git a/cat/filesystems.c b/cat/filesystems.c index 3f9d931..f1c2852 100644 --- a/cat/filesystems.c +++ b/cat/filesystems.c @@ -291,8 +291,13 @@ main (int argc, char *argv[]) assert (live == 0); /* Must be no extra arguments on the command line. */ - if (optind != argc) + if (optind != argc) { + fprintf (stderr, _("%s: error: extra argument '%s' on command line.\n" + "Make sure to specify the argument for --format " + "like '--format=%s'.\n"), + guestfs_int_program_name,...
2017 May 19
4
[Bug 1149] New: xtables-eb.c:533: bad test ?
...Priority: P5 Component: ip_tables (kernel) Assignee: netfilter-buglog at lists.netfilter.org Reporter: dcb314 at hotmail.com xtables-eb.c:533:65: warning: logical 'and' of mutually exclusive tests is always false [-Wlogical-op] Source code is if (optind + 1 >= argc || (argv[optind][0] == '-' && (argv[optind][1] < '0' || argv[optind][1] > '9')) || (argv[optind + 1][0] == '-' && (argv[optind + 1][1] < '0' && argv[optind + 1][1] > '9'))) Maybe better code...
2002 Jun 16
1
multiple definition of `optind'
...ssh.o sshconnect.o sshconnect1.o sshconnect2.o sshtty.o readconf.o clientloop.o -static -L. -Lopenbsd-compat -lssh -lopenbsd-compat -lutil -lz -lnsl -lcrypto -lcrypt /usr/lib/libc.a(getopt.o): In function `store_args_and_env': /tmp/glibc-2.2.3/posix/getopt.c(.data+0x0): multiple definition of `optind' openbsd-compat/libopenbsd-compat.a(getopt.o)(.data+0x4):/home/root/src/openssh-3.2.3p1/tmp/openssh-3.2.3p1/openbsd-compat/getopt.c: first defined here /usr/lib/libc.a(getopt.o): In function `store_args_and_env': /tmp/glibc-2.2.3/posix/getopt.c:271: multiple definition of `opterr' openb...
2020 Feb 18
4
[PATCH nbdkit 2/2] server: Avoid modifying argv by saving keys in a list and freeing on exit.
Unfortunately you cannot restore argv by setting *p = '=' :-( The reason is we advertize that plugins are allowed to save they ‘const char *key’ pointer passed to them in .config, but assigning *p = '=' changes the key string from "key" back to "key=value". Surprisingly only test-eval.sh actually broke, but other plugins are undoubtedly affected. My alternate
2019 Jan 25
0
[klibc:update-dash] [VAR] Use setvareq to set OPTIND initially
...bc.git;a=commit;h=c70ab0138910d5351ca0386e0220e4e0944c439d Author: Herbert Xu <herbert at gondor.apana.org.au> AuthorDate: Tue, 7 Oct 2014 22:24:42 +0800 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Fri, 25 Jan 2019 02:57:21 +0000 [klibc] [VAR] Use setvareq to set OPTIND initially There is no need to setvarint to set the initial value of OPTIND of one. This patch switchs to setvareq which also lets us avoid an unnecessary memory allocation. Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au> Signed-off-by: Ben Hutchings <ben at decadent.org.uk&gt...
2020 Mar 28
0
[klibc:update-dash] dash: [VAR] Use setvareq to set OPTIND initially
...;a=commit;h=2a6d1412a44d0a9caf1e70dd74e6cd549fa47373 Author: Herbert Xu <herbert at gondor.apana.org.au> AuthorDate: Tue, 7 Oct 2014 22:24:42 +0800 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Sat, 28 Mar 2020 21:42:54 +0000 [klibc] dash: [VAR] Use setvareq to set OPTIND initially [ dash commit f20dcdd0948d7ebb7d462a0288ea218468ad4f6c ] There is no need to setvarint to set the initial value of OPTIND of one. This patch switchs to setvareq which also lets us avoid an unnecessary memory allocation. Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au>...
2003 Sep 10
3
[PATCH] No extern declarations of optarg & co if getopt.h is available
Hi, I have a problem with the extern declarations of optarg, optind, etc. We're currently moving getopt from being a statically linked function to a dynamically linked function as part of the Cygwin DLL. On Windows, this requires to generate special symbols (__imp__optarg, etc.), which is done by marking the exported variables in the corresponding header. In...
2006 May 12
1
nfsmount inside kinit
...nfsmount on it's own, say "nfsmount 1.2.3.4:/home/nfs /root" it works just fine, however, when calling nfsmount_main from within kinit (via nfsroot=), things get wonky. I have verified that argc is 3 and argv[1] == "1.2.3.4:/home/nfs", argv[2] == "/root", however, optind seems off-by-one. After leaving the getopt loop, optind is 2, which causes the server check to fail ( strchr("/root".':') ). I do not know where or how optind is thrown off, and have gotten to this point, but do not have the time to go farther. If anyone has any ideas, please l...
2020 Aug 26
2
Re: [nbdkit PATCH 3/5] api: Add nbdkit_string_intern helper
On 8/25/20 3:32 PM, Eric Blake wrote: >>> -      keys[optind] = strndup (argv[optind], n); >>> -      if (keys[optind] == NULL) { >>> -        perror ("strndup"); >>> +      CLEANUP_FREE char *key = strndup (argv[optind], n); >>> +      const char *safekey = nbdkit_string_intern (key); >>> +      if (saf...
2006 Aug 02
0
[PATCH] xenstore-chmod
...y(xsh, xth, path, &xsval_n); + + if (xsval) { + int i; + for (i = 0; i < xsval_n; i++) { + snprintf(buf, MAX_PATH_LEN, "%s/%s", path, xsval[i]); + + do_chmod(buf, perms, nperms, 0, 1, xsh, xth); + } + + free(xsval); + } + } +} +#endif static int perform(int optind, int argc, char **argv, struct xs_handle *xsh, - xs_transaction_t xth, int prefix, int tidy) + xs_transaction_t xth, int prefix, int tidy, int upto, int recurse) { while (optind < argc) { #if defined(CLIENT_read) @@ -168,6 +221,41 @@ perform(int optind, int argc, char **arg...
2015 May 21
1
Re: [PATCH v3 1/3] virt-ls: support drive letters on Windows
...ng that only when inspecting? Other tools (e.g. virt-cat) do this also when specifying mount points. > > /* Free up data structures, no longer needed after this point. */ > free_drives (drvs); > free_mps (mps); > > + > unsigned errors = 0; > > while (optind < argc) { > - const char *dir = argv[optind]; > + CLEANUP_FREE const char *dir; > + > + if (inspector == 1 && win_root != NULL) { > + dir = windows_path (g, win_root, argv[optind], 1 /* readonly */ ); > + } else { > + dir = safe_strdup (g, argv[...
2004 Aug 19
1
tftp-hpa: getopt problems
...i! 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 it complains about "too much -s directories". After some debugging, I found, that this code in main() --- SNIP --- dirs = xmalloc((argc-optind+1)*sizeof(char *)); for ( ndirs = 0 ; optind !...
2015 Mar 23
0
[PATCH v2] virt-ls: support drive letters on Windows
...S_LR (MODE_LS_L|MODE_LS_R) int mode = 0; + CLEANUP_FREE const char * win_root; g = guestfs_create (); if (g == NULL) { @@ -371,10 +375,18 @@ main (int argc, char *argv[]) free_drives (drvs); free_mps (mps); + win_root = get_windows_root (); + unsigned errors = 0; while (optind < argc) { - const char *dir = argv[optind]; + CLEANUP_FREE const char *dir; + + if (win_root != NULL) { + dir = windows_path (g, win_root, argv[optind], 1 /* readonly */ ); + } else { + dir = safe_strdup (g, argv[optind]); + } switch (mode) { case 0:...
2020 Aug 25
3
Re: [nbdkit PATCH 3/5] api: Add nbdkit_string_intern helper
...presents additional complications for the caller. Also I imagined that this function would be a true (LISP-style) INTERN, in that it would return a single pointer if called twice with the two equal strings. But I see from the implementation later on that this isn't the case. > - keys[optind] = strndup (argv[optind], n); > - if (keys[optind] == NULL) { > - perror ("strndup"); > + CLEANUP_FREE char *key = strndup (argv[optind], n); > + const char *safekey = nbdkit_string_intern (key); > + if (safekey == NULL) > exit (EXIT_F...
2015 Mar 23
2
[PATCH v2] RFE: support Windows drive letters in virt-ls
It is modelled after virt-cat. Fixes RHBZ#845234 Ammended so it doesn't do inspection for every dir to list. Maros Zatko (1): virt-ls: support drive letters on Windows cat/ls.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) -- 1.9.3
2018 Nov 14
0
Re: [PATCH 2/2] build: Replace ./nbdkit with a C program.
...passthru_format ("--%s", long_options[long_index].name); > else { > assert (c <= CHAR_MAX) > passthru_format ("-%c", c); > } > } > > >+ } > >+ } > >+ > >+ /* Are there any non-option arguments? */ > >+ if (optind < argc) { > >+ /* The first non-option argument is the plugin name. If it is > >+ * purely alphanumeric then rewrite it. > >+ */ > >+ if (is_short_name (argv[optind])) { > > is_short_name(" ") and is_short_name("-") both return tr...
2018 Nov 14
2
Re: [PATCH 2/2] build: Replace ./nbdkit with a C program.
...(c != '?'); if (long_index == -1) passthru_format ("--%s", long_options[long_index].name); else { assert (c <= CHAR_MAX) passthru_format ("-%c", c); } } > + } > + } > + > + /* Are there any non-option arguments? */ > + if (optind < argc) { > + /* The first non-option argument is the plugin name. If it is > + * purely alphanumeric then rewrite it. > + */ > + if (is_short_name (argv[optind])) { is_short_name(" ") and is_short_name("-") both return true, leading to some unusu...
2000 Dec 11
1
fixing shuffle in ogg123
...es the old one which sometimes gives two times the same song and never the other song) -=-=-- --- vorbis-tools-1.0beta3/ogg123/ogg123.c.pix Sat Nov 4 01:23:21 2000 +++ vorbis-tools-1.0beta3/ogg123/ogg123.c Thu Dec 7 13:13:36 2000 @@ -324,12 +324,20 @@ if (param.shuffle) { - int i=optind, j=0; - for (i = optind; i < argc; i++) + int i; + int nb = argc - optind; + int *p = alloca(sizeof(int) * nb); + for (i = 0; i < nb; i++) p[i] = i; + + srand (time (NULL)); + for (i = 1; i < nb; i++) { - srand (time (NULL)); - j = (int) ((f...