Commit e53b5587 e53b55870dd3c4166ea6658ea679d608e500172a by Sergey Poznyakoff

mh: move format files to a separate directory.

* mh/etc: New directory.
* mh/Makefile.am: New file.
* mh/components: Move to mh/etc.
* mh/mailutils-mh.eli: Move to mh/etc.
* mh/mhl.format: Move to mh/etc.
* mh/mhl.forward: Move to mh/etc.
* mh/mhl.repl: Move to mh/etc.
* mh/mhl.usenet: Move to mh/etc.
* mh/replcomps: Move to mh/etc.
* mh/replgroupcomps: Move to mh/etc.
* configure.ac (AC_CONFIG_FILES): Add mh/etc/Makefile.
* mh/Makefile.am (SUBDIRS): Add etc.
Move mhlib_DATA and related statements to mh/etc/Makefile.am
* mh/comp.c (formfile): Remove const qualifier.
(opt_handler): Use mh_find_file to set formfile.
* mh/forw.c: Likewise.
* mh/mh_init.c (mh_find_file): Make sure *resolved_name is always
set to the last tried name.

* mh/tests/comp.at: Remove directory components from the -from argument.
* mh/tests/forw.at: Likewise.
* mh/tests/mhl.at: Likewise.
* mh/tests/testsuite.at (MH_SETUP): Change mhetcdir value.
1 parent bd228fc3
......@@ -1397,6 +1397,7 @@ AC_CONFIG_FILES([
libmailutils/Makefile
messages/Makefile
mh/Makefile
mh/etc/Makefile
mimeview/Makefile
movemail/Makefile
po/Makefile.in
......
......@@ -15,9 +15,9 @@
## You should have received a copy of the GNU General Public License
## along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
SUBDIRS = . tests
SUBDIRS = . etc tests
bindir = @MH_BIN_DIR@
mhlibdir = $(pkgdatadir)/mh
bin_PROGRAMS = \
ali\
anno\
......@@ -83,10 +83,6 @@ libmh_a_SOURCES= \
whatnowenv.c
noinst_HEADERS = mh.h mh_alias.h mh_format.h mh_getopt.h
LISPSRC = mailutils-mh.el
lisp_LISP=@lisp_LISP@
EXTRA_LISP = mailutils-mh.el
BUILT_SOURCES= \
mh_fmtgram.c \
pick-gram.c \
......@@ -97,17 +93,7 @@ BUILT_SOURCES= \
MAINTAINERCLEANFILES=$(BUILT_SOURCES)
mhlib_DATA = components replcomps replgroupcomps mhl.format mhl.forward\
mhl.repl mhl.usenet $(LISPSRC)
EXTRA_DIST = components replcomps replgroupcomps mhl.format mhl.forward\
mhl.repl mhl.usenet mailutils-mh.eli mh_fmtgram.y pick.y mh_alias.y mh_alias.l
DISTCLEANFILES = mailutils-mh.el
SUFFIXES = .eli .el
mailutils-mh.el: mailutils-mh.eli
.eli.el:
sed "s,BINDIR,$(bindir),g;s,MHLIBDIR,$(mhlibdir),g" $< > $@
EXTRA_DIST = mailutils-mh.eli mh_fmtgram.y pick.y mh_alias.y mh_alias.l
INCLUDES = @MU_APP_COMMON_INCLUDES@
AM_CPPFLAGS = -D_GNU_SOURCE -DMHLIBDIR=\"$(mhlibdir)\" -DMHBINDIR=\"$(bindir)\"
......
......@@ -75,7 +75,7 @@ struct mh_option mh_option[] = {
struct mh_whatnow_env wh_env = { 0 };
static int initial_edit = 1;
static const char *whatnowproc;
const char *formfile;
char *formfile;
static int build_only = 0; /* --build flag */
static int use_draft = 0; /* --use flag */
static char *draftmessage = "new";
......@@ -110,7 +110,7 @@ opt_handler (int key, char *arg, struct argp_state *state)
break;
case ARG_FORM:
formfile = mh_expand_name (MHLIBDIR, arg, 0);
mh_find_file (arg, &formfile);
break;
case ARG_DRAFTMESSAGE:
......
......@@ -99,7 +99,7 @@ enum encap_type
encap_mime
};
static char *formfile;
char *formfile;
struct mh_whatnow_env wh_env = { 0 };
static int initial_edit = 1;
static const char *whatnowproc;
......@@ -179,7 +179,7 @@ opt_handler (int key, char *arg, struct argp_state *state)
break;
case ARG_FORM:
formfile = arg;
mh_find_file (arg, &formfile);
break;
case ARG_FORMAT:
......
......@@ -543,22 +543,18 @@ mh_find_file (const char *name, char **resolved_name)
(name[0] == '.' && name[1] == '/') ||
(name[0] == '.' && name[1] == '.' && name[2] == '/'))
{
if (access (name, R_OK) == 0)
{
*resolved_name = xstrdup (name);
if (access (name, R_OK) == 0)
return 0;
}
return errno;
}
if (name[0] == '~')
{
s = mu_tilde_expansion (name, "/", NULL);
if (access (s, R_OK) == 0)
{
*resolved_name = s;
if (access (s, R_OK) == 0)
return 0;
}
return errno;
}
......
......@@ -16,7 +16,7 @@
m4_pushdef([MH_KEYWORDS],[comp])
m4_pushdef([compcmd],[comp dnl
-form $abs_top_srcdir/mh/components dnl
-form components dnl
-editor $abs_top_srcdir/mh/tests/mhed])
MH_CHECK([comp -file],[comp00 comp-file],[
......
......@@ -16,7 +16,7 @@
m4_pushdef([MH_KEYWORDS],[forw])
m4_pushdef([forwcmd],[forw dnl
-form $abs_top_srcdir/mh/components dnl
-form components dnl
-editor $abs_top_srcdir/mh/tests/mhed])
MH_CHECK([forw msg],[forw00 forw-msg],[
......
......@@ -18,7 +18,7 @@ m4_pushdef([MH_KEYWORDS],[mhl])
MH_CHECK([mhl],[mhl00],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail/inbox])
mhl -form $abs_top_srcdir/mh/mhl.format Mail/inbox/2
mhl -form mhl.format Mail/inbox/2
],
[0],
[ -- using template mhl.format --
......@@ -36,7 +36,7 @@ I don't see any wine
MH_CHECK([mhl repl],[mhl01 mhl.repl],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail/inbox])
mhl -form $abs_top_srcdir/mh/mhl.repl Mail/inbox/15
mhl -form mhl.repl Mail/inbox/15
],
[0],
[
......@@ -47,7 +47,7 @@ mhl -form $abs_top_srcdir/mh/mhl.repl Mail/inbox/15
MH_CHECK([mhl usenet],[mhl02 mhl.usenet],[
MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail/inbox])
mhl -form $abs_top_srcdir/mh/mhl.usenet Mail/inbox/15
mhl -form mhl.usenet Mail/inbox/15
],
[0],
[
......
......@@ -23,7 +23,7 @@ MH=$dir/mh_profile
export MH
cat > $MH <<EOT
Path: $dir/Mail
mhetcdir: $abs_top_srcdir/mh
mhetcdir: $abs_top_srcdir/mh/etc
EOT
exec <&-
])
......