* Makefile.in: Move most logic around gindex.pl into gindex.pl.

Don't use maintainer-only rules since mc.hlp won't be removed
now if perl is missing or gindex.pl fails.
* gindex.pl: Run man2hlp internally.  Use files given as
arguments instead of stdin and stdout.
This commit is contained in:
Pavel Roskin 2001-07-31 05:25:30 +00:00
parent a6f868a6cf
commit 1ae4e4e1cb
3 changed files with 44 additions and 15 deletions

View File

@ -1,3 +1,11 @@
2001-07-31 Pavel Roskin <proski@gnu.org>
* Makefile.in: Move most logic around gindex.pl into gindex.pl.
Don't use maintainer-only rules since mc.hlp won't be removed
now if perl is missing or gindex.pl fails.
* gindex.pl: Run man2hlp internally. Use files given as
arguments instead of stdin and stdout.
2001-07-30 Pavel Roskin <proski@gnu.org>
* mad.c: Don't use g_calloc - it's missing in glib 1.2.x.

View File

@ -90,13 +90,10 @@ man2hlp: man2hlp.o
mcmfmt: mfmt.o
$(CC) $(LDFLAGS) mfmt.o -o mcmfmt
$(srcdir)/mc.hlp: @MAINT@ $(docdir)/mc.1.in $(mcsrclibdir)/xnc.hlp $(srcdir)/gindex.pl man2hlp.c
@MAINT@ $(MAKE) man2hlp
@MAINT@ - ./man2hlp 58 $(docdir)/mc.1.in | cat - $(mcsrclibdir)/xnc.hlp | \
@MAINT@ perl $(srcdir)/gindex.pl > $(srcdir)/mc.hlp.tmp && \
@MAINT@ mv -f $(srcdir)/mc.hlp.tmp $(srcdir)/mc.hlp; \
@MAINT@ rm -f $(srcdir)/mc.hlp.tmp; \
@MAINT@ touch $(srcdir)/mc.hlp
$(srcdir)/mc.hlp: $(docdir)/mc.1.in $(mcsrclibdir)/xnc.hlp $(srcdir)/gindex.pl man2hlp.c
- $(MAKE) man2hlp
- perl $(srcdir)/gindex.pl $(docdir)/mc.1.in $(mcsrclibdir)/xnc.hlp $(srcdir)/mc.hlp
- touch $(srcdir)/mc.hlp
mc.html: $(docdir)/mc.1.in man2hlp
./man2hlp 0 $(docdir)/mc.1.in > body.html

View File

@ -3,7 +3,24 @@
# the warranty are quite big, we leave them at the end of the help file,
# the index will be consulted quite frequently, so we put it at the beginning.
@help_file = <>;
if ($#ARGV != 2) {
die "Three arguments required";
}
$man_file = "$ARGV[0]";
$tmpl_file = "$ARGV[1]";
$out_file = "$ARGV[2]";
$help_width = 58;
open (HELP1, "./man2hlp $help_width $man_file |") or
die "Cannot open read output of man2hlp: $!\n";;
@help_file = <HELP1>;
close (HELP1);
open (HELP2, "< $tmpl_file") or die "Cannot open $tmpl_file: $!\n";
push @help_file, <HELP2>;
close (HELP2);
foreach $line (@help_file){
if ($line =~ /\x04\[(.*)\]/ && $line !~ /\x04\[main\]/){
@ -12,15 +29,22 @@ foreach $line (@help_file){
}
}
print "\x04[Contents]\nTopics:\n\n";
unlink ("$out_file");
if (-e "$out_file") {
die "Cannot remove $out_file\n";
}
open (OUTPUT, "> $out_file") or die "Cannot open $out_file: $!\n";
print OUTPUT "\x04[Contents]\nTopics:\n\n";
foreach $node (@nodes){
if (length $node){
$node =~ m/^( *)(.*)$/;
printf (" %s\x01 %s \x02%s\x03", $1, $2, $2);
printf OUTPUT (" %s\x01 %s \x02%s\x03", $1, $2, $2);
}
print "\n";
print OUTPUT "\n";
}
#foreach $line (@help_file){
# $line =~ s/%NEW_NODE%/\004/g;
#}
print @help_file;
print OUTPUT @help_file;
close (OUTPUT);