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
c7f34674
...
c7f34674d461d773f178efe4c90822ebe1ac9115
authored
2003-02-13 16:37:02 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Finished
1 parent
9044e249
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
16 deletions
mh/mhl.c
mh/mhl.c
View file @
c7f3467
...
...
@@ -23,7 +23,6 @@
const
char
*
argp_program_version
=
"mhl ("
PACKAGE_STRING
")"
;
static
char
doc
[]
=
N_
(
"GNU MH mhl
\v
"
"Options marked with `*' are not yet implemented.
\n
"
"Use -help to obtain the list of traditional MH options."
);
static
char
args_doc
[]
=
N_
(
"[files]"
);
...
...
@@ -32,17 +31,17 @@ static struct argp_option options[] = {
{
"folder"
,
ARG_FOLDER
,
N_
(
"FOLDER"
),
0
,
N_
(
"Specify folder to operate upon"
)},
{
"bell"
,
ARG_BELL
,
N_
(
"BOOL"
),
OPTION_ARG_OPTIONAL
,
N_
(
"
*
Ring the bell at the end of each output page"
)
},
N_
(
"Ring the bell at the end of each output page"
)
},
{
"nobell"
,
ARG_NOBELL
,
NULL
,
OPTION_HIDDEN
,
""
},
{
"clear"
,
ARG_CLEAR
,
N_
(
"BOOL"
),
OPTION_ARG_OPTIONAL
,
N_
(
"
*
Clear the screen after each page of output"
)},
N_
(
"Clear the screen after each page of output"
)},
{
"noclear"
,
ARG_NOCLEAR
,
NULL
,
OPTION_HIDDEN
,
""
},
{
"form"
,
ARG_FORM
,
N_
(
"FILE"
),
0
,
N_
(
"
*
Read format from given file"
)},
N_
(
"Read format from given file"
)},
{
"width"
,
ARG_WIDTH
,
N_
(
"NUMBER"
),
0
,
N_
(
"
*
Set output width"
)},
N_
(
"Set output width"
)},
{
"length"
,
ARG_LENGTH
,
N_
(
"NUMBER"
),
0
,
N_
(
"
*
Set output screen length"
)},
N_
(
"Set output screen length"
)},
{
"moreproc"
,
ARG_MOREPROC
,
N_
(
"PROG"
),
0
,
N_
(
"Use given PROG instead of the default"
)
},
{
"nomoreproc"
,
ARG_NOMOREPROC
,
NULL
,
0
,
...
...
@@ -67,10 +66,12 @@ static int bell = 1; /* Ring the bell after each page of output */
static
int
clear
=
0
;
/* Clear the screen after each page of output */
static
int
length
=
40
;
/* Length of output page */
static
int
width
=
80
;
/* Width of output page */
static
char
*
formfile
=
"
mhl.format"
;
static
char
*
formfile
=
MHLIBDIR
"/
mhl.format"
;
static
char
*
moreproc
;
static
int
nomoreproc
;
static
list_t
format
;
static
int
opt_handler
(
int
key
,
char
*
arg
,
void
*
unused
)
{
...
...
@@ -139,7 +140,7 @@ open_output ()
int
rc
;
stream_t
output
;
if
(
interactive
&&
!
nomoreproc
)
if
(
interactive
&&
!
moreproc
&&
!
nomoreproc
)
moreproc
=
mh_global_profile_get
(
"moreproc"
,
getenv
(
"PAGER"
));
else
moreproc
=
NULL
;
...
...
@@ -166,13 +167,12 @@ open_output ()
static
void
list_message
(
char
*
name
,
stream_t
output
)
{
stream_t
input
;
int
rc
;
char
buf
[
512
]
;
size_t
n
;
stream_t
input
;
message_t
msg
;
if
(
!
name
)
rc
=
stdio_stream_create
(
&
input
,
stdin
,
0
);
rc
=
stdio_stream_create
(
&
input
,
stdin
,
MU_STREAM_SEEKABLE
);
else
rc
=
file_stream_create
(
&
input
,
name
,
MU_STREAM_READ
);
if
(
rc
)
...
...
@@ -188,12 +188,19 @@ list_message (char *name, stream_t output)
return
;
}
while
(
stream_sequential_readline
(
input
,
buf
,
sizeof
buf
,
&
n
)
==
0
&&
n
>
0
)
stream_sequential_write
(
output
,
buf
,
n
);
msg
=
mh_stream_to_message
(
input
);
if
(
!
msg
)
{
mh_error
(
_
(
"input stream %s is not a message (%s)"
),
name
,
mu_strerror
(
rc
));
stream_close
(
input
);
stream_destroy
(
&
input
,
stream_get_owner
(
input
));
}
else
{
mhl_format_run
(
format
,
width
,
length
,
clear
,
bell
,
msg
,
output
);
message_unref
(
msg
);
}
}
int
...
...
@@ -208,12 +215,19 @@ main (int argc, char **argv)
mh_argp_parse
(
argc
,
argv
,
options
,
mh_option
,
args_doc
,
doc
,
opt_handler
,
NULL
,
&
index
);
format
=
mhl_format_compile
(
formfile
);
if
(
!
format
)
exit
(
1
);
argc
-=
index
;
argv
+=
index
;
if
(
argc
==
0
)
nomoreproc
=
1
;
if
(
!
interactive
)
bell
=
0
;
output
=
open_output
();
if
(
argc
==
0
)
...
...
@@ -222,5 +236,6 @@ main (int argc, char **argv)
while
(
argc
--
)
list_message
(
*
argv
++
,
output
);
stream_close
(
output
);
return
0
;
}
...
...
Please
register
or
sign in
to post a comment