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
7096a7d8
...
7096a7d8ca6bcafc23e037b24bd9bc7a4554ecaf
authored
2000-09-05 10:50:54 +0000
by
Jakob Kaivo
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Implement mailx pipe command, alphabetize command table, merge relist and reply
1 parent
5f620059
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
84 additions
and
65 deletions
mail/Makefile.am
mail/delete.c
mail/mail.c
mail/mail.h
mail/pipe.c
mail/relist.c
mail/reply.c
mail/table.c
mail/Makefile.am
View file @
7096a7d
...
...
@@ -8,6 +8,6 @@ mail_LDADD = ../mailbox/libmailbox.la ../lib/libmailutils.a -lreadline
mail_SOURCES
=
alias.c alt.c bang.c cd.c copy.c delete.c discard.c dp.c
\
echo.c edit.c eq.c exit.c file.c folders.c followup.c from.c hash.c
\
headers.c help.c hold.c
if
.c list.c mail.c mail.h mbox.c next.c pipe.c
\
previous.c print.c quit.c re
list.c re
ply.c retain.c save.c
\
previous.c print.c quit.c reply.c retain.c save.c
\
send.c set.c shell.c size.c source.c top.c touch.c unalias.c
\
undelete.c unset.c util.c visual.c write.c z.c table.c
...
...
mail/delete.c
View file @
7096a7d
...
...
@@ -25,9 +25,7 @@ int
mail_delete
(
int
argc
,
char
**
argv
)
{
if
(
argc
>
1
)
{
return
util_msglist_command
(
mail_delete
,
argc
,
argv
);
}
else
if
(
/* mailbox_delete (mbox, list[cursor]) == */
0
)
return
0
;
return
1
;
...
...
mail/mail.c
View file @
7096a7d
...
...
@@ -127,6 +127,8 @@ main (int argc, char **argv)
cursor
=
1
;
realcursor
=
cursor
;
signal
(
SIGPIPE
,
SIG_IGN
);
/* set defaults for execution */
util_do_command
(
"set noallnet"
);
util_do_command
(
"set noappend"
);
...
...
@@ -154,7 +156,7 @@ main (int argc, char **argv)
util_do_command
(
"set noonehop"
);
util_do_command
(
"set nooutfolder"
);
util_do_command
(
"set nopage"
);
util_do_command
(
"set prompt=?
"
);
/* FIXME: "set prompt=\"? \"" */
util_do_command
(
"set prompt=?"
);
/* FIXME: "set prompt=\"? \"" */
util_do_command
(
"set noquiet"
);
util_do_command
(
"set norecord"
);
util_do_command
(
"set save"
);
...
...
@@ -216,6 +218,7 @@ main (int argc, char **argv)
}
/* initial commands */
if
((
util_find_env
(
"header"
))
->
set
)
util_do_command
(
"from *"
);
prompt
=
util_find_env
(
"prompt"
);
...
...
mail/mail.h
View file @
7096a7d
...
...
@@ -30,6 +30,7 @@
#include <sys/wait.h>
#include <sys/types.h>
#include <stdarg.h>
#include <signal.h>
#include <argp.h>
...
...
mail/pipe.c
View file @
7096a7d
...
...
@@ -25,6 +25,58 @@
int
mail_pipe
(
int
argc
,
char
**
argv
)
{
printf
(
"Function not implemented in %s line %d
\n
"
,
__FILE__
,
__LINE__
);
message_t
msg
;
stream_t
stream
;
char
*
cmd
;
FILE
*
pipe
;
int
*
list
,
num
=
0
;
char
buffer
[
BUFSIZ
];
off_t
off
=
0
;
size_t
n
=
0
;
if
(
argc
>
1
)
cmd
=
argv
[
--
argc
];
else
if
((
util_find_env
(
"cmd"
))
->
set
)
cmd
=
(
util_find_env
(
"cmd"
))
->
value
;
else
return
1
;
pipe
=
popen
(
cmd
,
"w"
);
if
((
num
=
util_expand_msglist
(
argc
,
argv
,
&
list
))
>
0
)
{
int
i
=
0
;
for
(
i
=
0
;
i
<
num
;
i
++
)
{
if
(
mailbox_get_message
(
mbox
,
list
[
i
],
&
msg
)
==
0
)
{
printf
(
"message %d
\n
"
,
list
[
i
]);
message_get_stream
(
msg
,
&
stream
);
off
=
0
;
while
(
stream_read
(
stream
,
buffer
,
sizeof
(
buffer
)
-
1
,
off
,
&
n
)
==
0
&&
n
!=
0
)
{
buffer
[
n
]
=
'\0'
;
fprintf
(
pipe
,
"%s"
,
buffer
);
off
=+
n
;
}
if
((
util_find_env
(
"page"
))
->
set
)
fprintf
(
pipe
,
"
\f
"
);
}
}
}
else
if
(
mailbox_get_message
(
mbox
,
cursor
,
&
msg
)
==
0
)
{
message_get_stream
(
msg
,
&
stream
);
while
(
stream_read
(
stream
,
buffer
,
sizeof
(
buffer
)
-
1
,
off
,
&
n
)
==
0
&&
n
!=
0
)
{
buffer
[
n
]
=
'\0'
;
fprintf
(
pipe
,
"%s"
,
buffer
);
off
+=
n
;
}
}
free
(
list
);
pclose
(
pipe
);
return
0
;
}
...
...
mail/relist.c
deleted
100644 → 0
View file @
5f62005
/* GNU mailutils - a suite of utilities for electronic mail
Copyright (C) 1999 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "mail.h"
/*
* R[eply] [msglist]
* R[espond] [msglist]
*/
int
mail_relist
(
int
argc
,
char
**
argv
)
{
printf
(
"Function not implemented in %s line %d
\n
"
,
__FILE__
,
__LINE__
);
return
1
;
}
mail/reply.c
View file @
7096a7d
...
...
@@ -20,6 +20,8 @@
/*
* r[eply] [message]
* r[espond] [message]
* R[eply] [msglist]
* R[espond] [msglist]
*/
int
...
...
mail/table.c
View file @
7096a7d
...
...
@@ -20,85 +20,78 @@
const
struct
mail_command_entry
mail_command_table
[]
=
{
{
"a"
,
"alias"
,
mail_alias
,
"a[lias] [alias [address...]]"
},
{
"g"
,
"group"
,
mail_alias
,
"g[roup] [alias [address...]]"
},
{
"alt"
,
"alternates"
,
mail_alt
,
"alt[ernates] name..."
},
{
"C"
,
"Copy"
,
mail_copy
,
"C[opy] [msglist]"
},
{
"cd"
,
"cd"
,
mail_cd
,
"cd [directory]"
},
{
"ch"
,
"chdir"
,
mail_cd
,
"ch[dir] directory"
},
{
"c"
,
"copy"
,
mail_copy
,
"c[opy] [file]
\n
c[opy] [msglist] file"
},
{
"C"
,
"Copy"
,
mail_copy
,
"C[opy] [msglist]"
},
{
"d"
,
"delete"
,
mail_delete
,
"d[elete] [msglist]"
},
{
"di"
,
"discard"
,
mail_discard
,
"di[scard] [header-field...]"
},
{
"ig"
,
"ignore"
,
mail_discard
,
"ig[nore] [header-field...]"
},
{
"dp"
,
"dp"
,
mail_dp
,
"dp [msglist]"
},
{
"dt"
,
"dt"
,
mail_dp
,
"dt [msglist]"
},
{
"ec"
,
"echo"
,
mail_echo
,
"ec[ho] string ..."
},
{
"e"
,
"edit"
,
mail_edit
,
"e[dit] [msglist]"
},
{
"el"
,
"else"
,
mail_if
,
"el[se]"
},
/* FIXME */
{
"en"
,
"endif"
,
mail_if
,
"en[dif]"
},
/* FIXME */
{
"ex"
,
"exit"
,
mail_exit
,
"ex[it]"
},
{
"
x"
,
"xit"
,
mail_exit
,
"x[i
t]"
},
{
"
F"
,
"Followup"
,
mail_followup
,
"F[ollowup] [msglis
t]"
},
{
"fi"
,
"file"
,
mail_file
,
"fi[le] [file]"
},
{
"fold"
,
"folder"
,
mail_file
,
"fold[er] [file]"
},
{
"folders"
,
"folders"
,
mail_folders
,
"folders"
},
{
"fo"
,
"followup"
,
mail_followup
,
"fo[llowup] [message]"
},
{
"F"
,
"Followup"
,
mail_followup
,
"F[ollowup] [msglist]"
},
{
"f"
,
"from"
,
mail_from
,
"f[rom] [msglist]"
},
{
"g"
,
"group"
,
mail_alias
,
"g[roup] [alias [address...]]"
},
{
"h"
,
"headers"
,
mail_headers
,
"h[eaders] [message]"
},
{
"hel"
,
"help"
,
mail_help
,
"hel[p] [command]"
},
{
"?"
,
"?"
,
mail_help
,
"? [command]"
},
{
"ho"
,
"hold"
,
mail_hold
,
"ho[ld] [msglist]"
},
{
"pre"
,
"preserve"
,
mail_hold
,
"pre[server] [msglist]"
},
/* Should if be handled in the main loop rather than a function? */
{
"i"
,
"if"
,
mail_if
,
"i[f] s|r"
},
{
"el"
,
"else"
,
mail_if
,
"el[se]"
},
{
"en"
,
"endif"
,
mail_if
,
"en[dif]"
},
{
"i"
,
"if"
,
mail_if
,
"i[f] s|r"
},
/* FIXME */
{
"ig"
,
"ignore"
,
mail_discard
,
"ig[nore] [header-field...]"
},
{
"l"
,
"list"
,
mail_list
,
"l[ist]"
},
{
"*"
,
"*"
,
mail_list
,
"*"
},
{
"m"
,
"mail"
,
mail_send
,
"m[ail] [address...]"
},
{
"mb"
,
"mbox"
,
mail_mbox
,
"mb[ox] [msglist]"
},
{
"n"
,
"next"
,
mail_next
,
"n[ext] [message]"
},
{
"+"
,
"+"
,
mail_next
,
"+ [message]"
},
{
"pi"
,
"pipe"
,
mail_pipe
,
"pi[pe] [[msglist] command]"
},
{
"|"
,
"|"
,
mail_pipe
,
"| [[msglist] command]"
},
{
"P"
,
"Print"
,
mail_print
,
"P[rint] [msglist]"
},
{
"T"
,
"Type"
,
mail_print
,
"T[ype] [msglist]"
},
{
"p"
,
"print"
,
mail_print
,
"p[rint] [msglist]"
},
{
"t"
,
"type"
,
mail_print
,
"t[ype] [msglist]"
},
{
"pi"
,
"pipe"
,
mail_pipe
,
"pi[pe] [[msglist] command]"
},
{
"pre"
,
"preserve"
,
mail_hold
,
"pre[server] [msglist]"
},
{
"prev"
,
"previous"
,
mail_previous
,
"prev[ious] [message]"
},
{
"
-"
,
"-"
,
mail_previous
,
"- [message
]"
},
{
"
p"
,
"print"
,
mail_print
,
"p[rint] [msglist
]"
},
{
"q"
,
"quit"
,
mail_quit
,
"q[uit]"
},
/* Hmm... will this work? */
/* { "", "", mail_quit, "<EOF>" }, */
{
"R"
,
"Reply"
,
mail_relist
,
"R[eply] [msglist]"
},
{
"R"
,
"Respond"
,
mail_relist
,
"R[espond] [msglist]"
},
{
"R"
,
"Reply"
,
mail_reply
,
"R[eply] [msglist]"
},
{
"R"
,
"Respond"
,
mail_reply
,
"R[espond] [msglist]"
},
{
"r"
,
"reply"
,
mail_reply
,
"r[eply] [message]"
},
{
"r"
,
"respond"
,
mail_reply
,
"r[espond] [message]"
},
{
"ret"
,
"retain"
,
mail_retain
,
"ret[ain] [header-field]"
},
{
"S"
,
"Save"
,
mail_save
,
"S[ave] [msglist]"
},
{
"s"
,
"save"
,
mail_save
,
"s[ave] [file]
\n
s[ave] [msglist] file"
},
{
"S"
,
"Save"
,
mail_save
,
"S[ave] [msglist]"
},
{
"se"
,
"set"
,
mail_set
,
"se[t] [name[=[string]]...] [name=number...] [noname...]"
},
{
"sh"
,
"shell"
,
mail_shell
,
"sh[ell]"
},
{
"si"
,
"size"
,
mail_size
,
"si[ze] [msglist]"
},
{
"so"
,
"source"
,
mail_source
,
"so[urce] file"
},
{
"T"
,
"Type"
,
mail_print
,
"T[ype] [msglist]"
},
{
"to"
,
"top"
,
mail_top
,
"to[p] [msglist]"
},
{
"tou"
,
"touch"
,
mail_touch
,
"tou[ch] [msglist]"
},
{
"t"
,
"type"
,
mail_print
,
"t[ype] [msglist]"
},
{
"una"
,
"unalias"
,
mail_unalias
,
"una[lias] [alias]..."
},
{
"u"
,
"undelete"
,
mail_undelete
,
"u[ndelete] [msglist]"
},
{
"uns"
,
"unset"
,
mail_unset
,
"uns[et] name..."
},
{
"v"
,
"visual"
,
mail_visual
,
"v[isual] [msglist]"
},
{
"W"
,
"Write"
,
mail_write
,
"W[rite] [msglist]"
},
{
"w"
,
"write"
,
mail_write
,
"w[rite] [file]
\n
w[rite] [msglist] file"
},
{
"
W"
,
"Write"
,
mail_write
,
"W[rite] [msglis
t]"
},
{
"
x"
,
"xit"
,
mail_exit
,
"x[i
t]"
},
{
"z"
,
""
,
mail_z
,
"z[+|-]"
},
{
"?"
,
"?"
,
mail_help
,
"? [command]"
},
{
"!"
,
""
,
mail_bang
,
"!command"
},
{
"="
,
"="
,
mail_eq
,
"="
},
{
"#"
,
"#"
,
NULL
,
"# comment"
},
{
"*"
,
"*"
,
mail_list
,
"*"
},
{
"+"
,
"+"
,
mail_next
,
"+ [message]"
},
{
"|"
,
"|"
,
mail_pipe
,
"| [[msglist] command]"
},
{
"-"
,
"-"
,
mail_previous
,
"- [message]"
},
{
0
,
0
,
0
,
0
,}
};
...
...
Please
register
or
sign in
to post a comment