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
108f892c
...
108f892cb999e8efb96ea56c3c09c83ab7307cba
authored
2002-05-11 01:15:04 +0000
by
Sam Roberts
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
From now uses mu_argp, and has a debug flag.
1 parent
f72ce76e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
8 deletions
from/from.c
from/from.c
View file @
108f892
...
...
@@ -34,6 +34,7 @@
#include <unistd.h>
#include <mailutils/address.h>
#include <mailutils/debug.h>
#include <mailutils/errno.h>
#include <mailutils/header.h>
#include <mailutils/list.h>
...
...
@@ -41,6 +42,47 @@
#include <mailutils/message.h>
#include <mailutils/registrar.h>
#include <mailutils/stream.h>
#include "mu_argp.h"
const
char
*
argp_program_version
=
"from ("
PACKAGE
") "
VERSION
;
const
char
*
argp_program_bug_address
=
"<bug-mailutils@gnu.org>"
;
static
char
doc
[]
=
"GNU from -- display from and subject"
;
static
struct
argp_option
options
[]
=
{
{
"debug"
,
'd'
,
NULL
,
0
,
"Enable debugging output"
,
0
},
{
0
,
0
,
0
,
0
}
};
static
int
debug
;
static
error_t
parse_opt
(
int
key
,
char
*
arg
,
struct
argp_state
*
state
)
{
switch
(
key
)
{
case
'd'
:
debug
++
;
break
;
default:
return
ARGP_ERR_UNKNOWN
;
}
return
0
;
}
static
struct
argp
argp
=
{
options
,
parse_opt
,
NULL
,
doc
,
};
static
const
char
*
capa
[]
=
{
"common"
,
"license"
,
"mailbox"
,
NULL
};
int
main
(
int
argc
,
char
**
argv
)
...
...
@@ -55,9 +97,11 @@ main(int argc, char **argv)
char
personal
[
128
];
int
status
;
/* have an argument */
if
(
argc
>
1
)
mailbox_name
=
argv
[
1
];
{
int
opt
;
mu_argp_parse
(
&
argp
,
&
argc
,
&
argv
,
0
,
capa
,
&
opt
,
NULL
);
mailbox_name
=
argv
[
opt
];
}
/* Register the desire formats. */
{
...
...
@@ -71,20 +115,27 @@ main(int argc, char **argv)
if
((
status
=
mailbox_create_default
(
&
mbox
,
mailbox_name
))
!=
0
)
{
fprintf
(
stderr
,
"could not create/open: %s
\n
"
,
mu_errstring
(
status
));
fprintf
(
stderr
,
"opening %s failed: %s
\n
"
,
mailbox_name
,
mu_errstring
(
status
)
);
exit
(
1
);
}
/* Debuging Trace. */
if
(
debug
)
{
//
mu_debug_t debug;
//
mailbox_get_debug (mbox, &debug);
//
mu_debug_set_level (debug, MU_DEBUG_TRACE|MU_DEBUG_PROT);
mu_debug_t
debug
;
mailbox_get_debug
(
mbox
,
&
debug
);
mu_debug_set_level
(
debug
,
MU_DEBUG_TRACE
|
MU_DEBUG_PROT
);
}
if
((
status
=
mailbox_open
(
mbox
,
MU_STREAM_READ
))
!=
0
)
{
fprintf
(
stderr
,
"could not create/open: %s
\n
"
,
mu_errstring
(
status
));
fprintf
(
stderr
,
"opening %s failed: %s
\n
"
,
mailbox_name
,
mu_errstring
(
status
)
);
exit
(
1
);
}
...
...
Please
register
or
sign in
to post a comment