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
860ac637
...
860ac637bf56553a324f10491346c882a0dfeb1c
authored
2002-03-08 22:41:31 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Use mu_argp_parse.
1 parent
955b5b09
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
85 additions
and
28 deletions
comsat/comsat.c
frm/frm.c
guimb/main.c
imap4d/imap4d.c
mail/mail.c
messages/messages.c
pop3d/pop3d.c
comsat/comsat.c
View file @
860ac63
...
...
@@ -53,6 +53,8 @@ static char doc[] = "GNU comsatd";
static
struct
argp_option
options
[]
=
{
{
NULL
,
0
,
NULL
,
0
,
"comsatd specific switches:"
,
0
},
{
"config"
,
'c'
,
"FILE"
,
0
,
"Read configuration from FILE"
,
0
},
{
NULL
,
0
,
NULL
,
0
,
NULL
,
0
}
};
...
...
@@ -64,10 +66,17 @@ static struct argp argp = {
comsatd_parse_opt
,
NULL
,
doc
,
mu_daemon_argp_child
,
NULL
,
NULL
,
NULL
};
static
const
char
*
comsat_argp_capa
[]
=
{
"mailutils"
,
"daemon"
,
"logging"
,
NULL
};
#define SUCCESS 0
#define NOT_HERE 1
#define PERMISSION_DENIED 2
...
...
@@ -106,7 +115,7 @@ comsatd_parse_opt (int key, char *arg, struct argp_state *state)
switch
(
key
)
{
case
ARGP_KEY_INIT
:
state
->
child_inputs
[
0
]
=
state
->
input
;
state
->
child_inputs
[
1
]
=
state
->
input
;
break
;
case
'c'
:
...
...
@@ -124,9 +133,9 @@ int
main
(
int
argc
,
char
**
argv
)
{
int
c
;
mu_
create_argcv
(
argc
,
argv
,
&
argc
,
&
argv
);
argp_parse
(
&
argp
,
argc
,
argv
,
0
,
0
,
&
daemon_param
);
mu_
argp_parse
(
&
argp
,
&
argc
,
&
argv
,
0
,
comsat_argp_capa
,
NULL
,
&
daemon_param
);
if
(
daemon_param
.
timeout
>
0
&&
daemon_param
.
mode
==
MODE_DAEMON
)
{
...
...
frm/frm.c
View file @
860ac63
...
...
@@ -58,6 +58,8 @@ const char *argp_program_bug_address = "<bug-mailutils@gnu.org>";
static
char
doc
[]
=
"GNU frm -- display From: lines"
;
static
struct
argp_option
options
[]
=
{
{
NULL
,
0
,
NULL
,
0
,
"frm specific switches:"
,
0
},
{
"debug"
,
'd'
,
NULL
,
0
,
"Enable debugging output"
,
0
},
{
"field"
,
'f'
,
"NAME"
,
0
,
"Header field to display"
,
0
},
...
...
@@ -148,10 +150,14 @@ static struct argp argp = {
parse_opt
,
NULL
,
doc
,
mu_common_argp_child
,
NULL
,
NULL
,
NULL
};
static
const
char
*
frm_argp_capa
[]
=
{
"mailutils"
,
NULL
};
/* Retrieve the Personal Name from the header To: or From: */
static
int
...
...
@@ -292,8 +298,7 @@ main(int argc, char **argv)
int
c
;
int
status
=
0
;
mu_create_argcv
(
argc
,
argv
,
&
argc
,
&
argv
);
argp_parse
(
&
argp
,
argc
,
argv
,
0
,
&
c
,
NULL
);
mu_argp_parse
(
&
argp
,
&
argc
,
&
argv
,
0
,
frm_argp_capa
,
&
c
,
NULL
);
/* have an argument */
argc
-=
c
;
...
...
guimb/main.c
View file @
860ac63
...
...
@@ -77,11 +77,13 @@ parse_opt (int key, char *arg, struct argp_state *state)
{
case
'c'
:
program_expr
=
optarg
;
*
(
int
*
)
state
->
input
=
state
->
next
;
state
->
next
=
state
->
argc
;
break
;
case
's'
:
program_file
=
optarg
;
*
(
int
*
)
state
->
input
=
state
->
next
;
state
->
next
=
state
->
argc
;
break
;
...
...
@@ -127,10 +129,11 @@ static struct argp argp = {
parse_opt
,
args_doc
,
doc
,
mu_common_argp_child
,
NULL
,
NULL
,
NULL
};
static
const
char
*
guimb_argp_capa
[]
=
{
"mailutils"
,
NULL
};
int
main
(
int
argc
,
char
*
argv
[])
...
...
@@ -140,9 +143,8 @@ main (int argc, char *argv[])
struct
guimb_data
gd
;
append_arg
(
""
);
mu_create_argcv
(
argc
,
argv
,
&
argc
,
&
argv
);
argp_parse
(
&
argp
,
argc
,
argv
,
0
,
&
c
,
NULL
);
mu_argp_parse
(
&
argp
,
&
argc
,
&
argv
,
0
,
guimb_argp_capa
,
NULL
,
&
c
);
for
(;
c
<
argc
;
c
++
)
append_arg
(
argv
[
c
]);
...
...
imap4d/imap4d.c
View file @
860ac63
...
...
@@ -42,6 +42,8 @@ static char doc[] = "GNU imap4d -- the IMAP4D daemon";
static
struct
argp_option
options
[]
=
{
{
NULL
,
0
,
NULL
,
0
,
"imap4d specific switches:"
,
0
},
{
"other-namespace"
,
'O'
,
"PATHLIST"
,
0
,
"set the `other' namespace"
,
0
},
{
"shared-namespace"
,
'S'
,
"PATHLIST"
,
0
,
...
...
@@ -56,10 +58,18 @@ static struct argp argp = {
imap4d_parse_opt
,
NULL
,
doc
,
mu_daemon_argp_child
,
NULL
,
NULL
,
NULL
};
static
const
char
*
imap4d_capa
[]
=
{
"mailutils"
,
"daemon"
,
"logging"
,
"auth"
,
NULL
};
static
int
imap4d_mainloop
__P
((
int
,
int
));
static
void
imap4d_daemon_init
__P
((
void
));
static
void
imap4d_daemon
__P
((
unsigned
int
,
unsigned
int
));
...
...
@@ -71,7 +81,7 @@ imap4d_parse_opt (int key, char *arg, struct argp_state *state)
switch
(
key
)
{
case
ARGP_KEY_INIT
:
state
->
child_inputs
[
0
]
=
state
->
input
;
state
->
child_inputs
[
1
]
=
state
->
input
;
break
;
case
'O'
:
...
...
@@ -96,8 +106,7 @@ main (int argc, char **argv)
state
=
STATE_NONAUTH
;
/* Starting state in non-auth. */
mu_create_argcv
(
argc
,
argv
,
&
argc
,
&
argv
);
argp_parse
(
&
argp
,
argc
,
argv
,
0
,
0
,
&
daemon_param
);
mu_argp_parse
(
&
argp
,
&
argc
,
&
argv
,
0
,
imap4d_capa
,
NULL
,
&
daemon_param
);
#ifdef USE_LIBPAM
if
(
!
pam_service
)
...
...
mail/mail.c
View file @
860ac63
...
...
@@ -31,6 +31,8 @@ static char doc[] = "GNU mail -- the standard /bin/mail interface";
static
char
args_doc
[]
=
"[address...]"
;
static
struct
argp_option
options
[]
=
{
{
NULL
,
0
,
NULL
,
0
,
"mail specific switches:"
,
0
},
{
"exist"
,
'e'
,
0
,
0
,
"Return true if mail exists"
,
0
},
{
"file"
,
'f'
,
"FILE"
,
OPTION_ARG_OPTIONAL
,
"Operate on mailbox FILE (default ~/mbox)"
,
0
},
...
...
@@ -129,10 +131,12 @@ static struct argp argp = {
parse_opt
,
args_doc
,
doc
,
mu_common_argp_child
,
NULL
,
NULL
,
NULL
};
static
const
char
*
mail_capa
[]
=
{
"mailutils"
,
NULL
};
static
char
*
mail_cmdline
(
void
*
closure
,
int
cont
)
{
...
...
@@ -287,9 +291,8 @@ main (int argc, char **argv)
args
.
user
=
NULL
;
/* argument parsing */
mu_create_argcv
(
argc
,
argv
,
&
argc
,
&
argv
);
argp_parse
(
&
argp
,
argc
,
argv
,
0
,
0
,
&
args
);
mu_argp_parse
(
&
argp
,
&
argc
,
&
argv
,
0
,
mail_capa
,
NULL
,
&
args
);
/* read system-wide mail.rc and user's .mailrc */
if
((
util_find_env
(
"rc"
))
->
set
)
...
...
messages/messages.c
View file @
860ac63
...
...
@@ -11,11 +11,18 @@ static char doc[] = "GNU messages -- count the number of messages in a mailbox";
static
char
args_doc
[]
=
"[mailbox...]"
;
static
struct
argp_option
options
[]
=
{
{
NULL
,
0
,
NULL
,
0
,
"messages specific switches:"
,
0
},
{
"quiet"
,
'q'
,
0
,
0
,
"Only display number of messages"
},
{
"silent"
,
's'
,
0
,
0
,
"Same as -q"
},
{
0
}
};
static
const
char
*
argp_capa
[]
=
{
"mailutils"
,
NULL
};
struct
arguments
{
int
argc
;
...
...
@@ -53,7 +60,7 @@ static struct argp argp = {
parse_opt
,
args_doc
,
doc
,
mu_common_argp_child
,
NULL
,
NULL
,
NULL
};
...
...
@@ -65,8 +72,7 @@ main (int argc, char **argv)
int
err
=
0
;
struct
arguments
args
=
{
0
,
NULL
};
mu_create_argcv
(
argc
,
argv
,
&
argc
,
&
argv
);
argp_parse
(
&
argp
,
argc
,
argv
,
0
,
0
,
&
args
);
mu_argp_parse
(
&
argp
,
&
argc
,
&
argv
,
0
,
argp_capa
,
NULL
,
&
args
);
registrar_get_list
(
&
bookie
);
list_append
(
bookie
,
path_record
);
...
...
pop3d/pop3d.c
View file @
860ac63
...
...
@@ -41,20 +41,44 @@ volatile size_t children;
static
int
pop3d_mainloop
__P
((
int
,
int
));
static
void
pop3d_daemon_init
__P
((
void
));
static
void
pop3d_daemon
__P
((
unsigned
int
,
unsigned
int
));
static
error_t
pop3d_parse_opt
__P
((
int
key
,
char
*
arg
,
struct
argp_state
*
state
));
const
char
*
argp_program_version
=
"pop3d ("
PACKAGE
") "
VERSION
;
const
char
*
argp_program_bug_address
=
"<bug-mailutils@gnu.org>"
;
static
char
doc
[]
=
"GNU pop3d -- the POP3 daemon"
;
static
struct
argp
argp
=
{
NULL
,
NULL
,
pop3d_parse_opt
,
NULL
,
doc
,
mu_daemon_argp_child
,
NULL
,
NULL
,
NULL
};
static
const
char
*
pop3d_argp_capa
[]
=
{
"mailutils"
,
"daemon"
,
"logging"
,
"auth"
,
NULL
};
static
error_t
pop3d_parse_opt
(
int
key
,
char
*
arg
,
struct
argp_state
*
state
)
{
switch
(
key
)
{
case
ARGP_KEY_INIT
:
state
->
child_inputs
[
1
]
=
state
->
input
;
break
;
default:
return
ARGP_ERR_UNKNOWN
;
}
return
0
;
}
int
main
(
int
argc
,
char
**
argv
)
...
...
@@ -62,8 +86,7 @@ main (int argc, char **argv)
struct
group
*
gr
;
int
status
=
OK
;
mu_create_argcv
(
argc
,
argv
,
&
argc
,
&
argv
);
argp_parse
(
&
argp
,
argc
,
argv
,
0
,
0
,
&
daemon_param
);
mu_argp_parse
(
&
argp
,
&
argc
,
&
argv
,
0
,
pop3d_argp_capa
,
NULL
,
&
daemon_param
);
#ifdef USE_LIBPAM
if
(
!
pam_service
)
...
...
Please
register
or
sign in
to post a comment