Jump to content

program synopsis

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
gor

gor

    Newbie

  • Members
  • PipPip
  • 15 posts
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

#2
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,118 posts
"|" 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.
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.

#3
gor

gor

    Newbie

  • Members
  • PipPip
  • 15 posts

Nullw0rm said:

although you say "used together or separately" which makes little sense.
I meant, that all these are legal:
program -a -b
program -a
program -b

#4
dbug

dbug

    Programmer

  • Members
  • PipPipPipPip
  • 155 posts
@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:

Quote

program [-a] [-b]


#5
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,118 posts
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 ..."
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.