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([ ...@@ -1397,6 +1397,7 @@ AC_CONFIG_FILES([
1397 libmailutils/Makefile 1397 libmailutils/Makefile
1398 messages/Makefile 1398 messages/Makefile
1399 mh/Makefile 1399 mh/Makefile
1400 mh/etc/Makefile
1400 mimeview/Makefile 1401 mimeview/Makefile
1401 movemail/Makefile 1402 movemail/Makefile
1402 po/Makefile.in 1403 po/Makefile.in
......
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
15 ## You should have received a copy of the GNU General Public License 15 ## You should have received a copy of the GNU General Public License
16 ## along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. 16 ## along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
17 17
18 SUBDIRS = . tests 18 SUBDIRS = . etc tests
19 bindir = @MH_BIN_DIR@ 19 bindir = @MH_BIN_DIR@
20 mhlibdir = $(pkgdatadir)/mh 20
21 bin_PROGRAMS = \ 21 bin_PROGRAMS = \
22 ali\ 22 ali\
23 anno\ 23 anno\
...@@ -83,10 +83,6 @@ libmh_a_SOURCES= \ ...@@ -83,10 +83,6 @@ libmh_a_SOURCES= \
83 whatnowenv.c 83 whatnowenv.c
84 noinst_HEADERS = mh.h mh_alias.h mh_format.h mh_getopt.h 84 noinst_HEADERS = mh.h mh_alias.h mh_format.h mh_getopt.h
85 85
86 LISPSRC = mailutils-mh.el
87 lisp_LISP=@lisp_LISP@
88 EXTRA_LISP = mailutils-mh.el
89
90 BUILT_SOURCES= \ 86 BUILT_SOURCES= \
91 mh_fmtgram.c \ 87 mh_fmtgram.c \
92 pick-gram.c \ 88 pick-gram.c \
...@@ -97,17 +93,7 @@ BUILT_SOURCES= \ ...@@ -97,17 +93,7 @@ BUILT_SOURCES= \
97 93
98 MAINTAINERCLEANFILES=$(BUILT_SOURCES) 94 MAINTAINERCLEANFILES=$(BUILT_SOURCES)
99 95
100 mhlib_DATA = components replcomps replgroupcomps mhl.format mhl.forward\ 96 EXTRA_DIST = mailutils-mh.eli mh_fmtgram.y pick.y mh_alias.y mh_alias.l
101 mhl.repl mhl.usenet $(LISPSRC)
102 EXTRA_DIST = components replcomps replgroupcomps mhl.format mhl.forward\
103 mhl.repl mhl.usenet mailutils-mh.eli mh_fmtgram.y pick.y mh_alias.y mh_alias.l
104 DISTCLEANFILES = mailutils-mh.el
105
106 SUFFIXES = .eli .el
107 mailutils-mh.el: mailutils-mh.eli
108
109 .eli.el:
110 sed "s,BINDIR,$(bindir),g;s,MHLIBDIR,$(mhlibdir),g" $< > $@
111 97
112 INCLUDES = @MU_APP_COMMON_INCLUDES@ 98 INCLUDES = @MU_APP_COMMON_INCLUDES@
113 AM_CPPFLAGS = -D_GNU_SOURCE -DMHLIBDIR=\"$(mhlibdir)\" -DMHBINDIR=\"$(bindir)\" 99 AM_CPPFLAGS = -D_GNU_SOURCE -DMHLIBDIR=\"$(mhlibdir)\" -DMHBINDIR=\"$(bindir)\"
......
...@@ -75,7 +75,7 @@ struct mh_option mh_option[] = { ...@@ -75,7 +75,7 @@ struct mh_option mh_option[] = {
75 struct mh_whatnow_env wh_env = { 0 }; 75 struct mh_whatnow_env wh_env = { 0 };
76 static int initial_edit = 1; 76 static int initial_edit = 1;
77 static const char *whatnowproc; 77 static const char *whatnowproc;
78 const char *formfile; 78 char *formfile;
79 static int build_only = 0; /* --build flag */ 79 static int build_only = 0; /* --build flag */
80 static int use_draft = 0; /* --use flag */ 80 static int use_draft = 0; /* --use flag */
81 static char *draftmessage = "new"; 81 static char *draftmessage = "new";
...@@ -110,7 +110,7 @@ opt_handler (int key, char *arg, struct argp_state *state) ...@@ -110,7 +110,7 @@ opt_handler (int key, char *arg, struct argp_state *state)
110 break; 110 break;
111 111
112 case ARG_FORM: 112 case ARG_FORM:
113 formfile = mh_expand_name (MHLIBDIR, arg, 0); 113 mh_find_file (arg, &formfile);
114 break; 114 break;
115 115
116 case ARG_DRAFTMESSAGE: 116 case ARG_DRAFTMESSAGE:
......
...@@ -99,7 +99,7 @@ enum encap_type ...@@ -99,7 +99,7 @@ enum encap_type
99 encap_mime 99 encap_mime
100 }; 100 };
101 101
102 static char *formfile; 102 char *formfile;
103 struct mh_whatnow_env wh_env = { 0 }; 103 struct mh_whatnow_env wh_env = { 0 };
104 static int initial_edit = 1; 104 static int initial_edit = 1;
105 static const char *whatnowproc; 105 static const char *whatnowproc;
...@@ -179,7 +179,7 @@ opt_handler (int key, char *arg, struct argp_state *state) ...@@ -179,7 +179,7 @@ opt_handler (int key, char *arg, struct argp_state *state)
179 break; 179 break;
180 180
181 case ARG_FORM: 181 case ARG_FORM:
182 formfile = arg; 182 mh_find_file (arg, &formfile);
183 break; 183 break;
184 184
185 case ARG_FORMAT: 185 case ARG_FORMAT:
......
...@@ -543,22 +543,18 @@ mh_find_file (const char *name, char **resolved_name) ...@@ -543,22 +543,18 @@ mh_find_file (const char *name, char **resolved_name)
543 (name[0] == '.' && name[1] == '/') || 543 (name[0] == '.' && name[1] == '/') ||
544 (name[0] == '.' && name[1] == '.' && name[2] == '/')) 544 (name[0] == '.' && name[1] == '.' && name[2] == '/'))
545 { 545 {
546 *resolved_name = xstrdup (name);
546 if (access (name, R_OK) == 0) 547 if (access (name, R_OK) == 0)
547 { 548 return 0;
548 *resolved_name = xstrdup (name);
549 return 0;
550 }
551 return errno; 549 return errno;
552 } 550 }
553 551
554 if (name[0] == '~') 552 if (name[0] == '~')
555 { 553 {
556 s = mu_tilde_expansion (name, "/", NULL); 554 s = mu_tilde_expansion (name, "/", NULL);
555 *resolved_name = s;
557 if (access (s, R_OK) == 0) 556 if (access (s, R_OK) == 0)
558 { 557 return 0;
559 *resolved_name = s;
560 return 0;
561 }
562 return errno; 558 return errno;
563 } 559 }
564 560
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
16 16
17 m4_pushdef([MH_KEYWORDS],[comp]) 17 m4_pushdef([MH_KEYWORDS],[comp])
18 m4_pushdef([compcmd],[comp dnl 18 m4_pushdef([compcmd],[comp dnl
19 -form $abs_top_srcdir/mh/components dnl 19 -form components dnl
20 -editor $abs_top_srcdir/mh/tests/mhed]) 20 -editor $abs_top_srcdir/mh/tests/mhed])
21 21
22 MH_CHECK([comp -file],[comp00 comp-file],[ 22 MH_CHECK([comp -file],[comp00 comp-file],[
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
16 16
17 m4_pushdef([MH_KEYWORDS],[forw]) 17 m4_pushdef([MH_KEYWORDS],[forw])
18 m4_pushdef([forwcmd],[forw dnl 18 m4_pushdef([forwcmd],[forw dnl
19 -form $abs_top_srcdir/mh/components dnl 19 -form components dnl
20 -editor $abs_top_srcdir/mh/tests/mhed]) 20 -editor $abs_top_srcdir/mh/tests/mhed])
21 21
22 MH_CHECK([forw msg],[forw00 forw-msg],[ 22 MH_CHECK([forw msg],[forw00 forw-msg],[
......
...@@ -18,7 +18,7 @@ m4_pushdef([MH_KEYWORDS],[mhl]) ...@@ -18,7 +18,7 @@ m4_pushdef([MH_KEYWORDS],[mhl])
18 18
19 MH_CHECK([mhl],[mhl00],[ 19 MH_CHECK([mhl],[mhl00],[
20 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail/inbox]) 20 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail/inbox])
21 mhl -form $abs_top_srcdir/mh/mhl.format Mail/inbox/2 21 mhl -form mhl.format Mail/inbox/2
22 ], 22 ],
23 [0], 23 [0],
24 [ -- using template mhl.format -- 24 [ -- using template mhl.format --
...@@ -36,7 +36,7 @@ I don't see any wine ...@@ -36,7 +36,7 @@ I don't see any wine
36 36
37 MH_CHECK([mhl repl],[mhl01 mhl.repl],[ 37 MH_CHECK([mhl repl],[mhl01 mhl.repl],[
38 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail/inbox]) 38 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail/inbox])
39 mhl -form $abs_top_srcdir/mh/mhl.repl Mail/inbox/15 39 mhl -form mhl.repl Mail/inbox/15
40 ], 40 ],
41 [0], 41 [0],
42 [ 42 [
...@@ -47,7 +47,7 @@ mhl -form $abs_top_srcdir/mh/mhl.repl Mail/inbox/15 ...@@ -47,7 +47,7 @@ mhl -form $abs_top_srcdir/mh/mhl.repl Mail/inbox/15
47 47
48 MH_CHECK([mhl usenet],[mhl02 mhl.usenet],[ 48 MH_CHECK([mhl usenet],[mhl02 mhl.usenet],[
49 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail/inbox]) 49 MUT_MBCOPY($abs_top_srcdir/testsuite/mh/teaparty,[Mail/inbox])
50 mhl -form $abs_top_srcdir/mh/mhl.usenet Mail/inbox/15 50 mhl -form mhl.usenet Mail/inbox/15
51 ], 51 ],
52 [0], 52 [0],
53 [ 53 [
......
...@@ -23,7 +23,7 @@ MH=$dir/mh_profile ...@@ -23,7 +23,7 @@ MH=$dir/mh_profile
23 export MH 23 export MH
24 cat > $MH <<EOT 24 cat > $MH <<EOT
25 Path: $dir/Mail 25 Path: $dir/Mail
26 mhetcdir: $abs_top_srcdir/mh 26 mhetcdir: $abs_top_srcdir/mh/etc
27 EOT 27 EOT
28 exec <&- 28 exec <&-
29 ]) 29 ])
......