Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
88bf2a2d
Commit
88bf2a2d
authored
17 years ago
by
Yang Tse
Browse files
Options
Downloads
Patches
Plain Diff
Replace tabs with spaces
parent
45847c53
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ares/ares_getopt.c
+66
-66
66 additions, 66 deletions
ares/ares_getopt.c
with
66 additions
and
66 deletions
ares/ares_getopt.c
+
66
−
66
View file @
88bf2a2d
...
...
@@ -40,7 +40,7 @@
*/
/* #if !defined(lint)
* static char sccsid[] = "@(#)getopt.c
8.2 (Berkeley) 4/2/94";
* static char sccsid[] = "@(#)getopt.c
8.2 (Berkeley) 4/2/94";
* #endif
*/
...
...
@@ -53,78 +53,78 @@ extern char *optarg;
extern
int
optind
;
extern
int
opterr
;
int
opterr
=
1
,
/* if error message should be printed */
optind
=
1
,
/* index into parent argv vector */
optopt
,
/* character checked for validity */
optreset
;
/* reset getopt */
char
*
optarg
;
/* argument associated with option */
int
opterr
=
1
,
/* if error message should be printed */
optind
=
1
,
/* index into parent argv vector */
optopt
,
/* character checked for validity */
optreset
;
/* reset getopt */
char
*
optarg
;
/* argument associated with option */
#define
BADCH
(int)'?'
#define
BADARG
(int)':'
#define
EMSG
""
#define
BADCH
(int)'?'
#define
BADARG
(int)':'
#define
EMSG
""
/*
* getopt --
*
Parse argc/argv argument vector.
*
Parse argc/argv argument vector.
*/
int
getopt
(
nargc
,
nargv
,
ostr
)
int
nargc
;
char
*
const
*
nargv
;
const
char
*
ostr
;
int
nargc
;
char
*
const
*
nargv
;
const
char
*
ostr
;
{
static
char
*
place
=
EMSG
;
/* option letter processing */
char
*
oli
;
/* option letter list index */
static
char
*
place
=
EMSG
;
/* option letter processing */
char
*
oli
;
/* option letter list index */
if
(
optreset
||
!*
place
)
{
/* update scanning pointer */
optreset
=
0
;
if
(
optind
>=
nargc
||
*
(
place
=
nargv
[
optind
])
!=
'-'
)
{
place
=
EMSG
;
return
(
EOF
);
}
if
(
place
[
1
]
&&
*++
place
==
'-'
)
{
/* found "--" */
++
optind
;
place
=
EMSG
;
return
(
EOF
);
}
}
/* option letter okay? */
if
((
optopt
=
(
int
)
*
place
++
)
==
(
int
)
':'
||
!
(
oli
=
strchr
(
ostr
,
optopt
)))
{
/*
* if the user didn't specify '-' as an option,
* assume it means EOF.
*/
if
(
optopt
==
(
int
)
'-'
)
return
(
EOF
);
if
(
!*
place
)
++
optind
;
if
(
opterr
&&
*
ostr
!=
':'
)
(
void
)
fprintf
(
stderr
,
"%s: illegal option -- %c
\n
"
,
__FILE__
,
optopt
);
return
(
BADCH
);
}
if
(
*++
oli
!=
':'
)
{
/* don't need argument */
optarg
=
NULL
;
if
(
!*
place
)
++
optind
;
}
else
{
/* need an argument */
if
(
*
place
)
/* no white space */
optarg
=
place
;
else
if
(
nargc
<=
++
optind
)
{
/* no arg */
place
=
EMSG
;
if
(
*
ostr
==
':'
)
return
(
BADARG
);
if
(
opterr
)
(
void
)
fprintf
(
stderr
,
"%s: option requires an argument -- %c
\n
"
,
__FILE__
,
optopt
);
return
(
BADCH
);
}
else
/* white space */
optarg
=
nargv
[
optind
];
place
=
EMSG
;
++
optind
;
}
return
(
optopt
);
/* dump back option letter */
if
(
optreset
||
!*
place
)
{
/* update scanning pointer */
optreset
=
0
;
if
(
optind
>=
nargc
||
*
(
place
=
nargv
[
optind
])
!=
'-'
)
{
place
=
EMSG
;
return
(
EOF
);
}
if
(
place
[
1
]
&&
*++
place
==
'-'
)
{
/* found "--" */
++
optind
;
place
=
EMSG
;
return
(
EOF
);
}
}
/* option letter okay? */
if
((
optopt
=
(
int
)
*
place
++
)
==
(
int
)
':'
||
!
(
oli
=
strchr
(
ostr
,
optopt
)))
{
/*
* if the user didn't specify '-' as an option,
* assume it means EOF.
*/
if
(
optopt
==
(
int
)
'-'
)
return
(
EOF
);
if
(
!*
place
)
++
optind
;
if
(
opterr
&&
*
ostr
!=
':'
)
(
void
)
fprintf
(
stderr
,
"%s: illegal option -- %c
\n
"
,
__FILE__
,
optopt
);
return
(
BADCH
);
}
if
(
*++
oli
!=
':'
)
{
/* don't need argument */
optarg
=
NULL
;
if
(
!*
place
)
++
optind
;
}
else
{
/* need an argument */
if
(
*
place
)
/* no white space */
optarg
=
place
;
else
if
(
nargc
<=
++
optind
)
{
/* no arg */
place
=
EMSG
;
if
(
*
ostr
==
':'
)
return
(
BADARG
);
if
(
opterr
)
(
void
)
fprintf
(
stderr
,
"%s: option requires an argument -- %c
\n
"
,
__FILE__
,
optopt
);
return
(
BADCH
);
}
else
/* white space */
optarg
=
nargv
[
optind
];
place
=
EMSG
;
++
optind
;
}
return
(
optopt
);
/* dump back option letter */
}
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