Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pike
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pikelang
pike
Commits
3f858528
Commit
3f858528
authored
22 years ago
by
Henrik (Grubba) Grubbström
Browse files
Options
Downloads
Patches
Plain Diff
Improved documentation of Getopt.find_option().
Rev: lib/modules/Getopt.pmod:1.24
parent
854a7603
Branches
use-nextpnr
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/modules/Getopt.pmod
+10
-4
10 additions, 4 deletions
lib/modules/Getopt.pmod
with
10 additions
and
4 deletions
lib/modules/Getopt.pmod
+
10
−
4
View file @
3f858528
...
@@ -52,7 +52,8 @@ static void my_error(string err, int throw_errors) {
...
@@ -52,7 +52,8 @@ static void my_error(string err, int throw_errors) {
//! This argument has two functions: It specifies if the option takes an
//! This argument has two functions: It specifies if the option takes an
//! argument or not, and it informs @[find_option()] what to return if the
//! argument or not, and it informs @[find_option()] what to return if the
//! option is not present. If @[def] is given and the option does not have an
//! option is not present. If @[def] is given and the option does not have an
//! argument @[find_option()] will fail.
//! argument @[find_option()] will fail. @[def] can be specified as
//! @[UNDEFINED] or left out if the option does not take an argument.
//!
//!
//! @param throw_errors
//! @param throw_errors
//! If @[throw_errors] has been specified @[find_option()] will throw
//! If @[throw_errors] has been specified @[find_option()] will throw
...
@@ -67,16 +68,18 @@ static void my_error(string err, int throw_errors) {
...
@@ -67,16 +68,18 @@ static void my_error(string err, int throw_errors) {
//! will be returned.
//! will be returned.
//!
//!
//! Otherwise if any of the environment variables specified in @[envvars] has
//! Otherwise if any of the environment variables specified in @[envvars] has
//! been set, that value will be return.
//! been set, that value will be return
ed
.
//!
//!
//! If all else fails, @[def] will be returned.
//! If all else fails, @[def] will be returned.
//!
//!
//! @throws
//! @throws
//! If an option that requires an argument
misses the
argument and
//! If an option that requires an argument
lacks an
argument and
//! @[throw_errors] is set an error will be thrown.
//! @[throw_errors] is set an error will be thrown.
//!
//!
//! @note
//! @note
//! @[find_option()] modifies @[argv].
//! @[find_option()] modifies @[argv]. Parsed options will be removed
//! from @[argv]. Elements of @[argv] that have been removed entirely will
//! be replaced with zeroes.
//!
//!
//! This function reads options even if they are written after the first
//! This function reads options even if they are written after the first
//! non-option on the line.
//! non-option on the line.
...
@@ -84,6 +87,9 @@ static void my_error(string err, int throw_errors) {
...
@@ -84,6 +87,9 @@ static void my_error(string err, int throw_errors) {
//! Index @tt{0@} (zero) of @[argv] is not scanned for options, since it
//! Index @tt{0@} (zero) of @[argv] is not scanned for options, since it
//! is reserved for the program name.
//! is reserved for the program name.
//!
//!
//! Only the first ocurrance of an option will be parsed. To parse
//! multiple ocurrances, call @[find_option()] multiple times.
//!
//! @seealso
//! @seealso
//! @[Getopt.get_args()]
//! @[Getopt.get_args()]
//!
//!
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment