Hi,
I am writing Synopsis (in man page/documentation) to my program and I was wondering how to write something like this:
program [-a | -b]
here | stands for xor (I guess) - is there any way how to write or? so that -a and -b can be used together or separately?
thanks a lot
program synopsis
Started by gor, Sep 25 2010 11:19 PM
4 replies to this topic
#1
Posted 25 September 2010 - 11:19 PM
|
|
|
#2
Posted 26 September 2010 - 12:12 AM
"|" is the bitwise operator OR (bits that are set in A or B are set in result C).
For example when you would wish to define all bitflags (-a -b): char allPossibleOpts = a | b;
You would be looking for the boolean operator OR, which is in this case "||", although you say "used together or separately" which makes little sense.
For example when you would wish to define all bitflags (-a -b): char allPossibleOpts = a | b;
You would be looking for the boolean operator OR, which is in this case "||", although you say "used together or separately" which makes little sense.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
#3
Posted 26 September 2010 - 12:28 AM
Nullw0rm said:
although you say "used together or separately" which makes little sense.
program -a -b
program -a
program -b
#4
Posted 26 September 2010 - 12:38 AM
@Nullw0rm: I think gor is talking about standard command line syntax to specify available options and valid combinations for some program, not programming languages.
If both options (-a and -b) are optional but can be specified simultaneously, the common representation is this:
If both options (-a and -b) are optional but can be specified simultaneously, the common representation is this:
Quote
program [-a] [-b]
#5
Posted 26 September 2010 - 01:04 AM
You will not need anything special if there are no conflics, a synopsis can be as simple as "PROGRAM [OPTIONS] ... FILE ..." (verbatim)
Writing them in brackets are for constraints, such as an optional parameter (not needed):
"PROGRAM -a [-b shortdesc] [-c num | -d alpha] ... FILE ..."
Writing them in brackets are for constraints, such as an optional parameter (not needed):
"PROGRAM -a [-b shortdesc] [-c num | -d alpha] ... FILE ..."
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.


Sign In
Create Account


Back to top









