Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
3a2ce6db
...
3a2ce6dbe69d0e54b6813a07e074fee79ba33386
authored
2002-09-18 17:39:20 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
(mh_getopt, mh_help): Accept new argument: a pointer to the doc string.
1 parent
90accacc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
12 deletions
mh/mh_getopt.c
mh/mh_getopt.h
mh/mh_getopt.c
View file @
3a2ce6d
...
...
@@ -31,7 +31,7 @@ char *mh_optarg;
char
*
mh_optptr
;
int
mh_getopt
(
int
argc
,
char
**
argv
,
struct
mh_option
*
mh_opt
)
mh_getopt
(
int
argc
,
char
**
argv
,
struct
mh_option
*
mh_opt
,
const
char
*
doc
)
{
struct
mh_option
*
p
;
int
optlen
;
...
...
@@ -86,19 +86,19 @@ mh_getopt (int argc, char **argv, struct mh_option *mh_opt)
}
else
if
(
!
strcmp
(
mh_optptr
+
1
,
"help"
))
{
mh_help
(
mh_opt
);
mh_help
(
mh_opt
,
doc
);
exit
(
1
);
}
return
'?'
;
}
void
mh_help
(
struct
mh_option
*
mh_opt
)
mh_help
(
struct
mh_option
*
mh_opt
,
const
char
*
doc
)
{
struct
mh_option
*
p
;
printf
(
"Compatibility syntax:
\n
"
);
printf
(
"%s [
+folder] [msgs] [switches]
\n
"
,
program_invocation_short_name
);
printf
(
"%s [
switches] %s
\n
"
,
program_invocation_short_name
,
doc
);
printf
(
" switches are:
\n
"
);
for
(
p
=
mh_opt
;
p
->
opt
;
p
++
)
...
...
@@ -120,4 +120,5 @@ mh_help (struct mh_option *mh_opt)
printf
(
"
\n
"
);
}
printf
(
" -help
\n
"
);
printf
(
"
\n
Please use GNU long options instead. Run %s --help for more info on these.
\n
"
,
program_invocation_short_name
);
}
...
...
mh/mh_getopt.h
View file @
3a2ce6d
...
...
@@ -15,11 +15,12 @@ struct mh_option
extern
int
mh_optind
;
extern
char
*
mh_optarg
;
int
mh_getopt
(
int
argc
,
char
**
argv
,
struct
mh_option
*
mh_opt
);
int
mh_argp_parse
(
int
argc
,
char
**
argv
,
struct
argp_option
*
option
,
struct
mh_option
*
mh_option
,
char
*
argp_doc
,
char
*
doc
,
int
(
*
handler
)(),
void
*
closure
,
int
*
index
);
void
mh_help
(
struct
mh_option
*
mh_option
);
void
mh_license
(
const
char
*
name
);
int
mh_getopt
__P
((
int
argc
,
char
**
argv
,
struct
mh_option
*
mh_opt
,
const
char
*
doc
));
int
mh_argp_parse
__P
((
int
argc
,
char
**
argv
,
struct
argp_option
*
option
,
struct
mh_option
*
mh_option
,
char
*
argp_doc
,
char
*
doc
,
int
(
*
handler
)(),
void
*
closure
,
int
*
index
));
void
mh_help
__P
((
struct
mh_option
*
mh_option
,
const
char
*
doc
));
void
mh_license
__P
((
const
char
*
name
));
...
...
Please
register
or
sign in
to post a comment