Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9151051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:42:25+00:00 2026-06-17T11:42:25+00:00

Quoted from the getopt() Linux Manual page : If the first character of optstring

  • 0

Quoted from the getopt() Linux Manual page:

If the first character of optstring is a hyphen (-), then each nonoption argv-element is handled as if it were the argument of an option with character code 1. (This is used by programs that were written to expect options and other argv-elements in any order and that care about the ordering of the two.) The special argument double hyphens (--) forces an end of option-scanning regardless of the scanning mode.

Quoted from the manual page of Java GetOpt class:

…The second is to allow options anywhere, but to return all elements in the order they occur on the command line. When a non-option element is ecountered, an integer 1 is returned and the value of the non-option element is stored in optarg is if it were the argument to that option. For example, “-a foo -d”, returns first ‘a’, then 1 (with optarg set to “foo”) then ‘d’ then -1. When this “return in order” functionality is enabled, the only way to stop getopt() from scanning all command line elements is to use the special “–” string by itself as described above. An example is “-a foo -b — bar”, which would return ‘a’, then integer 1 with optarg set to “foo”, then ‘b’, then -1. optind would then point to “bar” as the first non-option argv element. The “–” is discarded.

Yes, I understand what the above statements talking about, but I still cannot imagine what kind of applications use such a behaviour.

Could someone provides an example of a command-line syntax that likely used by applications that implement the “return in order” behavior?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T11:42:26+00:00Added an answer on June 17, 2026 at 11:42 am

    find is an example of a command that mixes options and non-option arguments, and cares about the order.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Quoted from this page : send(url: String, target: String, [method: String]) Sends the variables
Consider the following example quoted from php manual for DateTime <?php $date = new
reading this https://developers.google.com/in-app-payments/docs/tutorial Quoted from the above page: Because you sign the JWT using
Quote from Head first html: You can add padding to the top and bottom
Quoted from Effective Java - Second Edition by Joshua Bloch For floating-point fields, use
Quoted from wikipedia, the P vs NP problem, regarding the time complexity of algorithms
Quoted from here : If delimiter contains a value that is not contained in
Quoted from the POSIX.1-2008 description about -W option , The -W (capital-W) option shall
From the manual, I know that there are 6 different transfer encoding in IMAP.
Quoted from ngx_hash.c : ngx_strlow(elt->name, names[n].key.data, names[n].key.len); Which copies the lower case string to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.