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
a2f3bd9d
...
a2f3bd9d825be08f1eb922a327e047a154c0677d
authored
2004-11-18 16:18:03 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Emacs-iteraction mode (--emacs)
1 parent
f5e458e1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
11 deletions
movemail/movemail.c
movemail/movemail.c
View file @
a2f3bd9
...
...
@@ -29,16 +29,19 @@ const char *program_version = "movemail (" PACKAGE_STRING ")";
static
char
doc
[]
=
N_
(
"GNU movemail"
);
static
char
args_doc
[]
=
N_
(
"inbox-url destfile [POP-password]"
);
#define OPT_EMACS 256
static
struct
argp_option
options
[]
=
{
{
"preserve"
,
'p'
,
NULL
,
0
,
N_
(
"Preserve the source mailbox"
),
0
},
{
"keep-messages"
,
0
,
NULL
,
OPTION_ALIAS
,
NULL
},
{
"reverse"
,
'r'
,
NULL
,
0
,
N_
(
"Reverse the sorting order"
),
0
},
{
"emacs"
,
OPT_EMACS
,
NULL
,
0
,
N_
(
"Output information used by Emacs rmail interface"
),
0
},
{
NULL
,
0
,
NULL
,
0
,
NULL
,
0
}
};
static
int
reverse_order
;
static
int
preserve_mail
;
static
int
emacs_mode
;
static
error_t
parse_opt
(
int
key
,
char
*
arg
,
struct
argp_state
*
state
)
...
...
@@ -53,6 +56,10 @@ parse_opt (int key, char *arg, struct argp_state *state)
preserve_mail
++
;
break
;
case
OPT_EMACS
:
emacs_mode
++
;
break
;
default:
return
ARGP_ERR_UNKNOWN
;
}
...
...
@@ -78,12 +85,30 @@ static const char *mail_capa[] = {
NULL
};
int
movemail_error_printer
(
const
char
*
fmt
,
va_list
ap
)
{
int
n
;
n
=
fprintf
(
stderr
,
"%s: "
,
program_invocation_short_name
);
n
+=
vfprintf
(
stderr
,
fmt
,
ap
);
fputc
(
'\n'
,
stderr
);
return
n
+
1
;
}
void
die
(
mailbox_t
mbox
,
char
*
msg
,
int
status
)
{
url_t
url
=
NULL
;
mailbox_get_url
(
mbox
,
&
url
);
if
(
emacs_mode
)
mu_error
(
_
(
"%s:mailbox '%s': %s: %s"
),
mu_errname
(
status
),
url_to_string
(
url
),
msg
,
mu_strerror
(
status
));
else
mu_error
(
_
(
"mailbox '%s': %s: %s"
),
url_to_string
(
url
),
msg
,
mu_strerror
(
status
));
exit
(
1
);
...
...
@@ -227,16 +252,6 @@ compatibility_mode (mailbox_t *mbx, char *source_name, char *password,
}
int
movemail_error_printer
(
const
char
*
fmt
,
va_list
ap
)
{
int
n
;
n
=
fprintf
(
stderr
,
"%s: "
,
program_invocation_short_name
);
n
+=
vfprintf
(
stderr
,
fmt
,
ap
);
fputc
(
'\n'
,
stderr
);
return
n
+
1
;
}
int
main
(
int
argc
,
char
**
argv
)
{
int
index
;
...
...
Please
register
or
sign in
to post a comment