summaryrefslogtreecommitdiffstats
path: root/contrib/groff/src
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2001-07-10 17:09:00 +0000
committerru <ru@FreeBSD.org>2001-07-10 17:09:00 +0000
commit509648687568379aa73928b01295f92b31f340d0 (patch)
tree48f82ecc62866b510511d840037bd0c8dad377ff /contrib/groff/src
parenta8b501863ad5b196a10db9fa64dd61eb742bafeb (diff)
parent8d6dea3a5542a987c08a218c28776d3751d6878d (diff)
downloadFreeBSD-src-509648687568379aa73928b01295f92b31f340d0.zip
FreeBSD-src-509648687568379aa73928b01295f92b31f340d0.tar.gz
This commit was generated by cvs2svn to compensate for changes in r79543,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'contrib/groff/src')
-rw-r--r--contrib/groff/src/devices/grodvi/dvi.cc7
-rw-r--r--contrib/groff/src/devices/grodvi/grodvi.man8
-rw-r--r--contrib/groff/src/devices/grohtml/Makefile.sub1
-rw-r--r--contrib/groff/src/devices/grohtml/grohtml.man33
-rw-r--r--contrib/groff/src/devices/grohtml/html-text.cc4
-rw-r--r--contrib/groff/src/devices/grohtml/html-text.h2
-rw-r--r--contrib/groff/src/devices/grohtml/output.cc5
-rw-r--r--contrib/groff/src/devices/grohtml/post-html.cc29
-rw-r--r--contrib/groff/src/devices/grolbp/lbp.cc7
-rw-r--r--contrib/groff/src/devices/grolbp/lbp.h8
-rw-r--r--contrib/groff/src/devices/grolj4/grolj4.man8
-rw-r--r--contrib/groff/src/devices/grolj4/lj4.cc9
-rw-r--r--contrib/groff/src/devices/grops/grops.man8
-rw-r--r--contrib/groff/src/devices/grops/ps.cc6
-rw-r--r--contrib/groff/src/devices/grops/psrm.cc11
-rw-r--r--contrib/groff/src/devices/grotty/tty.cc3
-rw-r--r--contrib/groff/src/include/getopt.h17
-rw-r--r--contrib/groff/src/include/groff-getopt.h28
-rw-r--r--contrib/groff/src/include/lib.h16
-rw-r--r--contrib/groff/src/include/nonposix.h3
-rw-r--r--contrib/groff/src/libs/libbib/index.cc6
-rw-r--r--contrib/groff/src/libs/libgroff/Makefile.sub4
-rw-r--r--contrib/groff/src/libs/libgroff/font.cc5
-rw-r--r--contrib/groff/src/libs/libgroff/getopt.c17
-rw-r--r--contrib/groff/src/libs/libgroff/maxfilename.cc67
-rw-r--r--contrib/groff/src/libs/libgroff/tmpfile.cc65
-rw-r--r--contrib/groff/src/preproc/eqn/eqn.man8
-rw-r--r--contrib/groff/src/preproc/eqn/lex.cc5
-rw-r--r--contrib/groff/src/preproc/eqn/main.cc2
-rw-r--r--contrib/groff/src/preproc/eqn/neqn.man22
-rw-r--r--contrib/groff/src/preproc/eqn/over.cc4
-rw-r--r--contrib/groff/src/preproc/grn/grn.man9
-rw-r--r--contrib/groff/src/preproc/grn/main.cc3
-rw-r--r--contrib/groff/src/preproc/html/Makefile.sub1
-rw-r--r--contrib/groff/src/preproc/html/pre-html.cc508
-rw-r--r--contrib/groff/src/preproc/html/pushbackbuffer.cc5
-rw-r--r--contrib/groff/src/preproc/pic/main.cc2
-rw-r--r--contrib/groff/src/preproc/pic/pic.man8
-rw-r--r--contrib/groff/src/preproc/pic/pic.y12
-rw-r--r--contrib/groff/src/preproc/refer/command.cc5
-rw-r--r--contrib/groff/src/preproc/refer/ref.cc8
-rw-r--r--contrib/groff/src/preproc/refer/refer.cc3
-rw-r--r--contrib/groff/src/preproc/refer/refer.man8
-rw-r--r--contrib/groff/src/preproc/refer/token.cc4
-rw-r--r--contrib/groff/src/preproc/soelim/soelim.cc14
-rw-r--r--contrib/groff/src/preproc/soelim/soelim.man8
-rw-r--r--contrib/groff/src/preproc/tbl/main.cc5
-rw-r--r--contrib/groff/src/preproc/tbl/tbl.man8
-rw-r--r--contrib/groff/src/roff/groff/groff.cc3
-rw-r--r--contrib/groff/src/roff/groff/pipeline.c10
-rw-r--r--contrib/groff/src/roff/grog/Makefile.sub1
-rw-r--r--contrib/groff/src/roff/grog/grog.man8
-rw-r--r--contrib/groff/src/roff/grog/grog.pl27
-rw-r--r--contrib/groff/src/roff/grog/grog.sh23
-rw-r--r--contrib/groff/src/roff/troff/dictionary.cc8
-rw-r--r--contrib/groff/src/roff/troff/div.cc39
-rw-r--r--contrib/groff/src/roff/troff/div.h2
-rw-r--r--contrib/groff/src/roff/troff/env.cc21
-rw-r--r--contrib/groff/src/roff/troff/env.h3
-rw-r--r--contrib/groff/src/roff/troff/input.cc191
-rw-r--r--contrib/groff/src/roff/troff/input.h4
-rw-r--r--contrib/groff/src/roff/troff/node.h2
-rw-r--r--contrib/groff/src/roff/troff/reg.cc5
-rw-r--r--contrib/groff/src/roff/troff/token.h2
-rw-r--r--contrib/groff/src/roff/troff/troff.man35
-rw-r--r--contrib/groff/src/utils/addftinfo/addftinfo.cc9
-rw-r--r--contrib/groff/src/utils/addftinfo/addftinfo.man8
-rw-r--r--contrib/groff/src/utils/afmtodit/afmtodit.man8
-rw-r--r--contrib/groff/src/utils/afmtodit/afmtodit.pl2
-rw-r--r--contrib/groff/src/utils/hpftodit/hpftodit.cc23
-rw-r--r--contrib/groff/src/utils/hpftodit/hpftodit.man8
-rw-r--r--contrib/groff/src/utils/indxbib/Makefile.sub2
-rw-r--r--contrib/groff/src/utils/indxbib/indxbib.cc74
-rw-r--r--contrib/groff/src/utils/indxbib/indxbib.man8
-rw-r--r--contrib/groff/src/utils/lkbib/lkbib.cc7
-rw-r--r--contrib/groff/src/utils/lkbib/lkbib.man8
-rw-r--r--contrib/groff/src/utils/lookbib/lookbib.cc4
-rw-r--r--contrib/groff/src/utils/lookbib/lookbib.man8
-rw-r--r--contrib/groff/src/utils/pfbtops/pfbtops.c23
-rw-r--r--contrib/groff/src/utils/pfbtops/pfbtops.man8
-rw-r--r--contrib/groff/src/utils/tfmtodit/tfmtodit.cc11
-rw-r--r--contrib/groff/src/utils/tfmtodit/tfmtodit.man8
-rw-r--r--contrib/groff/src/xditview/ChangeLog4
-rw-r--r--contrib/groff/src/xditview/Imakefile.in11
-rw-r--r--contrib/groff/src/xditview/gxditview.man5
85 files changed, 1233 insertions, 419 deletions
diff --git a/contrib/groff/src/devices/grodvi/dvi.cc b/contrib/groff/src/devices/grodvi/dvi.cc
index 74422f8..b5b7c49 100644
--- a/contrib/groff/src/devices/grodvi/dvi.cc
+++ b/contrib/groff/src/devices/grodvi/dvi.cc
@@ -22,6 +22,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "driver.h"
#include "nonposix.h"
+extern "C" const char *Version_string;
+
#define DEFAULT_LINEWIDTH 40
static int linewidth = DEFAULT_LINEWIDTH;
@@ -521,8 +523,8 @@ void dvi_printer::moveto(int h, int v)
void dvi_printer::draw(int code, int *p, int np, const environment *env)
{
if (code == 'l') {
- int x, y;
- int height = 0, width;
+ int x = 0, y = 0;
+ int height = 0, width = 0;
int thickness;
if (line_thickness < 0)
thickness = env->size*RES_7227*linewidth/1000;
@@ -863,7 +865,6 @@ int main(int argc, char **argv)
switch(c) {
case 'v':
{
- extern const char *Version_string;
printf("GNU grodvi (groff) version %s\n", Version_string);
exit(0);
break;
diff --git a/contrib/groff/src/devices/grodvi/grodvi.man b/contrib/groff/src/devices/grodvi/grodvi.man
index 7aa4431..a4488ce 100644
--- a/contrib/groff/src/devices/grodvi/grodvi.man
+++ b/contrib/groff/src/devices/grodvi/grodvi.man
@@ -1,5 +1,5 @@
-.ig \"-*- nroff -*-
-Copyright (C) 1989-2000 Free Software Foundation, Inc.
+.ig
+Copyright (C) 1989-2000, 2001 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -172,3 +172,7 @@ and widths of rules be rounded.
.BR groff_out (@MAN5EXT@),
.BR groff_font (@MAN5EXT@),
.BR groff_char (@MAN7EXT@)
+.
+.\" Local Variables:
+.\" mode: nroff
+.\" End:
diff --git a/contrib/groff/src/devices/grohtml/Makefile.sub b/contrib/groff/src/devices/grohtml/Makefile.sub
index 2c3a55a..10f28ce 100644
--- a/contrib/groff/src/devices/grohtml/Makefile.sub
+++ b/contrib/groff/src/devices/grohtml/Makefile.sub
@@ -12,5 +12,4 @@ CCSRCS=\
$(srcdir)/output.cc
HDRS=\
$(srcdir)/html.h \
- $(srcdir)/html-chars.h \
$(srcdir)/html-text.h
diff --git a/contrib/groff/src/devices/grohtml/grohtml.man b/contrib/groff/src/devices/grohtml/grohtml.man
index 8796d8f..7b0f5e1 100644
--- a/contrib/groff/src/devices/grohtml/grohtml.man
+++ b/contrib/groff/src/devices/grohtml/grohtml.man
@@ -1,4 +1,4 @@
-.ig \"-*- nroff -*-
+.ig
Copyright (C) 1999-2000, 2001 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of this
@@ -37,8 +37,10 @@ grohtml \- html driver for groff
.el .RB "[\ " "\\$1" "\ ]"
..
.OP \-v?lrn
+.OP \-D dir
.OP \-F dir
.OP \-i resolution
+.OP \-I image stem
.OP \-o image vertical offset
.RI "[\ " files\|.\|.\|. "\ ]"
.br
@@ -88,8 +90,9 @@ Turns off the automatic header and footer line (html rule).
.TP
.B -n
Generate simple heading anchors whenever a section/number heading is found.
-Without the option the anchor value is the textual heading. This can cause problems
-when a heading contains a `?' on some brousers (netscape).
+Without the option the anchor value is the textual heading.
+This can cause problems when a heading contains a `?' on some brousers
+(netscape).
This flag is automatically turned on if a heading contains an image.
.TP
.BI \-F dir
@@ -101,10 +104,23 @@ is the name of the device, usually
.BR html .
.TP
.BI \-i resolution
-select the resolution for all images.
+Select the resolution for all images.
By default this is 80 pixels per inch.
Example: -i100 indicates 100 pixels per inch.
.TP
+.BI \-I stem
+Determine the image stem name.
+If omitted grohtml uses
+.BI grohtml- XXX
+.RI ( XXX
+is the process ID).
+.TP
+.BI \-D dir
+Inform
+.B grohtml
+to place all image files into directory
+.IR dir .
+.TP
.B \-v
Print the version number.
.TP
@@ -120,7 +136,10 @@ and
mounted at font positions 1 to 4.
.SH DEPENDENCIES
.B grohtml
-is dependent upon the png utilities and gs.
+is dependent upon the png utilities
+.RB ( \&\%pnmcut ,\ \%pnmtopng )
+and GhostScript
+.RB ( gs ).
Images are generated whenever a table, picture, equation or line is
encountered.
.SH BUGS
@@ -135,3 +154,7 @@ It is still alpha code.
.BR groff_out (@MAN5EXT@),
.BR groff_font (@MAN5EXT@),
.BR groff_char (@MAN7EXT@)
+.
+.\" Local Variables:
+.\" mode: nroff
+.\" End:
diff --git a/contrib/groff/src/devices/grohtml/html-text.cc b/contrib/groff/src/devices/grohtml/html-text.cc
index 0b63aa0..56d6c78 100644
--- a/contrib/groff/src/devices/grohtml/html-text.cc
+++ b/contrib/groff/src/devices/grohtml/html-text.cc
@@ -350,7 +350,7 @@ void html_text::do_pre (void)
done_bold();
done_italic();
done_tt();
- char *type = done_para();
+ (void)done_para();
if (! is_present(PRE_TAG)) {
push_para(PRE_TAG, "");
}
@@ -661,7 +661,7 @@ int html_text::emitted_text (void)
* emit_space - writes a space providing that text was written beforehand.
*/
-int html_text::emit_space (void)
+void html_text::emit_space (void)
{
if (space_emitted) {
if (is_present(PRE_TAG)) {
diff --git a/contrib/groff/src/devices/grohtml/html-text.h b/contrib/groff/src/devices/grohtml/html-text.h
index c8ab2ac..5bbcd43 100644
--- a/contrib/groff/src/devices/grohtml/html-text.h
+++ b/contrib/groff/src/devices/grohtml/html-text.h
@@ -78,7 +78,7 @@ public:
void done_big (void);
void do_indent (char *arg, int indent, int pageoff, int linelen);
int emitted_text (void);
- int emit_space (void);
+ void emit_space (void);
int is_in_pre (void);
void remove_tag (HTML_TAG tag);
void remove_sub_sup (void);
diff --git a/contrib/groff/src/devices/grohtml/output.cc b/contrib/groff/src/devices/grohtml/output.cc
index 4c72bba..88ab7d6 100644
--- a/contrib/groff/src/devices/grohtml/output.cc
+++ b/contrib/groff/src/devices/grohtml/output.cc
@@ -71,7 +71,7 @@ word::~word ()
*/
word_list::word_list ()
- : head(0), tail(0), length(0)
+ : length(0), head(0), tail(0)
{
}
@@ -208,6 +208,7 @@ simple_output &simple_output::check_newline(int n)
fputc('\n', fp);
col = last_word.flush(fp);
}
+ return *this;
}
/*
@@ -236,6 +237,7 @@ simple_output &simple_output::space_or_newline (void)
col += last_word.flush(fp);
}
}
+ return *this;
}
/*
@@ -303,6 +305,7 @@ simple_output &simple_output::enable_newlines (int auto_newlines)
check_newline(0);
newlines = auto_newlines;
check_newline(0);
+ return *this;
}
/*
diff --git a/contrib/groff/src/devices/grohtml/post-html.cc b/contrib/groff/src/devices/grohtml/post-html.cc
index 0237bfc..0c36941 100644
--- a/contrib/groff/src/devices/grohtml/post-html.cc
+++ b/contrib/groff/src/devices/grohtml/post-html.cc
@@ -27,7 +27,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "stringclass.h"
#include "cset.h"
#include "html.h"
-#include "html-chars.h"
#include "html-text.h"
#include <time.h>
@@ -39,6 +38,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <stdio.h>
#include <fcntl.h>
+extern "C" const char *Version_string;
+
#if !defined(TRUE)
# define TRUE (1==1)
#endif
@@ -102,11 +103,13 @@ static int max (int a, int b)
* is_subsection - returns TRUE if a1..a2 is within b1..b2
*/
+#if 0
static int is_subsection (int a1, int a2, int b1, int b2)
{
// easier to see whether this is not the case
return( !((a1 < b1) || (a1 > b2) || (a2 < b1) || (a2 > b2)) );
}
+#endif
/*
* is_intersection - returns TRUE if range a1..a2 intersects with b1..b2
@@ -357,11 +360,11 @@ public:
style text_style;
char *text_string;
unsigned int text_length;
- int minv, maxv, minh, maxh;
+ int minv, minh, maxv, maxh;
int is_raw_command; // should the text be sent directly to the device?
int is_tag; // is this a .br, .sp, .tl etc
- int is_line; // is the command a <line>?
int is_img_auto; // image created by eqn delim
+ int is_line; // is the command a <line>?
int thickness; // the thickness of a line
};
@@ -379,7 +382,7 @@ text_glob::text_glob (style *s, char *string, unsigned int length,
}
text_glob::text_glob ()
- : text_string(0), text_length(0), minv(-1), maxv(-1), minh(-1), maxh(-1),
+ : text_string(0), text_length(0), minv(-1), minh(-1), maxv(-1), maxh(-1),
is_raw_command(FALSE), is_tag(FALSE), is_line(FALSE), thickness(0)
{
}
@@ -455,7 +458,7 @@ struct element_list {
element_list *left;
text_glob *datum;
int lineno;
- int minv, maxv, minh, maxh;
+ int minv, minh, maxv, maxh;
element_list (text_glob *d,
int line_number,
@@ -465,7 +468,7 @@ struct element_list {
};
element_list::element_list ()
- : right(0), left(0), datum(0), lineno(0), minv(-1), maxv(-1), minh(-1), maxh(-1)
+ : right(0), left(0), datum(0), lineno(0), minv(-1), minh(-1), maxv(-1), maxh(-1)
{
}
@@ -2283,10 +2286,10 @@ html_printer::html_printer()
end_tempindent(0),
next_tag(INLINE),
fill_on(TRUE),
+ linelength(0),
pageoffset(0),
indentation(0),
prev_indent(0),
- linelength(0),
line_number(0)
{
#if defined(DEBUGGING)
@@ -2769,7 +2772,6 @@ html_printer::~html_printer()
header.write_headings(stdout, FALSE);
write_rule();
{
- extern const char *Version_string;
html.begin_comment("Creator : ")
.put_string("groff ")
.put_string("version ")
@@ -2877,12 +2879,11 @@ int main(int argc, char **argv)
{ "version", no_argument, 0, 'v' },
{ NULL, 0, 0, 0 }
};
- while ((c = getopt_long(argc, argv, "o:i:F:vd?lrn", long_options, NULL))
+ while ((c = getopt_long(argc, argv, "o:i:I:D:F:vd?lrn", long_options, NULL))
!= EOF)
switch(c) {
case 'v':
{
- extern const char *Version_string;
printf("GNU post-grohtml (groff) version %s\n", Version_string);
exit(0);
break;
@@ -2902,6 +2903,12 @@ int main(int argc, char **argv)
case 'i':
/* handled by pre-html */
break;
+ case 'I':
+ /* handled by pre-html */
+ break;
+ case 'D':
+ /* handled by pre-html */
+ break;
case 'n':
simple_anchors = TRUE;
break;
@@ -2928,6 +2935,6 @@ int main(int argc, char **argv)
static void usage(FILE *stream)
{
- fprintf(stream, "usage: %s [-vld?n] [-F dir] [files ...]\n",
+ fprintf(stream, "usage: %s [-vld?n] [-D dir] [-I image_stem] [-F dir] [files ...]\n",
program_name);
}
diff --git a/contrib/groff/src/devices/grolbp/lbp.cc b/contrib/groff/src/devices/grolbp/lbp.cc
index 69196af..ec8c7b1 100644
--- a/contrib/groff/src/devices/grolbp/lbp.cc
+++ b/contrib/groff/src/devices/grolbp/lbp.cc
@@ -33,6 +33,8 @@ TODO
#include "nonposix.h"
+extern "C" const char *Version_string;
+
static short int papersize = -1, // papersize
orientation = -1 , // orientation
paperlength = 0, // Custom Paper size
@@ -151,7 +153,7 @@ void lbp_font::handle_unknown_font_command(const char *command,
static void wp54charset()
{
- int i;
+ unsigned int i;
lbpputs("\033[714;100;29;0;32;120.}");
for (i = 0; i < sizeof(symset) ; i++) lbpputc(symset[i]);
@@ -561,7 +563,7 @@ static struct
static int set_papersize(const char *papersize)
{
- int i;
+ unsigned int i;
// First test for a standard (i.e. supported directly by the printer)
// papersize
@@ -715,7 +717,6 @@ int main(int argc, char **argv)
case 'l' : orientation = 1;
break;
case 'v' : {
- extern const char *Version_string;
printf("GNU grolbp (groff) version %s\n",
Version_string);
exit(0);
diff --git a/contrib/groff/src/devices/grolbp/lbp.h b/contrib/groff/src/devices/grolbp/lbp.h
index 6a11b19..cacf3ea 100644
--- a/contrib/groff/src/devices/grolbp/lbp.h
+++ b/contrib/groff/src/devices/grolbp/lbp.h
@@ -36,7 +36,7 @@ lbpinit(FILE *outfile)
static inline void
-lbpprintf(char *format, ... )
+lbpprintf(const char *format, ... )
{ /* Taken from cjet */
va_list stuff;
@@ -46,7 +46,7 @@ lbpprintf(char *format, ... )
};
static inline void
-lbpputs(char *data)
+lbpputs(const char *data)
{
fputs(data,lbpoutput);
};
@@ -123,7 +123,7 @@ lbpruleabs(int x, int y, int hsize, int vsize)
fprintf(lbpoutput,"\033[9r");
};
-static inline void vdmprintf(char *format, ... );
+static inline void vdmprintf(const char *format, ... );
static inline char *
vdmnum(int num,char *result)
@@ -179,7 +179,7 @@ vdmend()
};
static inline void
-vdmprintf(char *format, ... )
+vdmprintf(const char *format, ... )
{ /* Taken from cjet */
va_list stuff;
diff --git a/contrib/groff/src/devices/grolj4/grolj4.man b/contrib/groff/src/devices/grolj4/grolj4.man
index 891d7dc..414ad78 100644
--- a/contrib/groff/src/devices/grolj4/grolj4.man
+++ b/contrib/groff/src/devices/grolj4/grolj4.man
@@ -1,5 +1,5 @@
-.ig \"-*- nroff -*-
-Copyright (C) 1994-2000 Free Software Foundation, Inc.
+.ig
+Copyright (C) 1994-2000, 2001 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -142,3 +142,7 @@ Small dots.
.BR groff_out (@MAN5EXT@),
.BR groff_font (@MAN5EXT@),
.BR groff_char (@MAN7EXT@)
+.
+.\" Local Variables:
+.\" mode: nroff
+.\" End:
diff --git a/contrib/groff/src/devices/grolj4/lj4.cc b/contrib/groff/src/devices/grolj4/lj4.cc
index 9fbc6af..6829acb 100644
--- a/contrib/groff/src/devices/grolj4/lj4.cc
+++ b/contrib/groff/src/devices/grolj4/lj4.cc
@@ -35,6 +35,8 @@ X command to include bitmap graphics
#include "driver.h"
#include "nonposix.h"
+extern "C" const char *Version_string;
+
static struct {
const char *name;
int code;
@@ -123,7 +125,8 @@ void lj4_font::handle_unknown_font_command(const char *command,
const char *arg,
const char *filename, int lineno)
{
- for (int i = 0; i < sizeof(command_table)/sizeof(command_table[0]); i++) {
+ for (unsigned int i = 0;
+ i < sizeof(command_table)/sizeof(command_table[0]); i++) {
if (strcmp(command, command_table[i].s) == 0) {
if (arg == 0)
fatal_with_file_and_line(filename, lineno,
@@ -568,7 +571,8 @@ printer *make_printer()
static
int lookup_paper_size(const char *s)
{
- for (int i = 0; i < sizeof(paper_table)/sizeof(paper_table[0]); i++) {
+ for (unsigned int i = 0;
+ i < sizeof(paper_table)/sizeof(paper_table[0]); i++) {
// FIXME Perhaps allow unique prefix.
if (strcasecmp(s, paper_table[i].name) == 0)
return i;
@@ -645,7 +649,6 @@ int main(int argc, char **argv)
}
case 'v':
{
- extern const char *Version_string;
printf("GNU grolj4 (groff) version %s\n", Version_string);
exit(0);
break;
diff --git a/contrib/groff/src/devices/grops/grops.man b/contrib/groff/src/devices/grops/grops.man
index 1dac725..e9c6be4 100644
--- a/contrib/groff/src/devices/grops/grops.man
+++ b/contrib/groff/src/devices/grops/grops.man
@@ -1,5 +1,5 @@
-.ig \"-*- nroff -*-
-Copyright (C) 1989-2000 Free Software Foundation, Inc.
+.ig
+Copyright (C) 1989-2000, 2001 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -859,3 +859,7 @@ Temporary file.
.BR groff_out (@MAN5EXT@),
.BR groff_font (@MAN5EXT@),
.BR groff_char (@MAN7EXT@)
+.
+.\" Local Variables:
+.\" mode: nroff
+.\" End:
diff --git a/contrib/groff/src/devices/grops/ps.cc b/contrib/groff/src/devices/grops/ps.cc
index 98b1a91..a467f04 100644
--- a/contrib/groff/src/devices/grops/ps.cc
+++ b/contrib/groff/src/devices/grops/ps.cc
@@ -33,6 +33,8 @@ extern "C" {
}
#endif /* NEED_DECLARATION_PUTENV */
+extern "C" const char *Version_string;
+
static int landscape_flag = 0;
static int manual_feed_flag = 0;
static int ncopies = 1;
@@ -1119,7 +1121,6 @@ ps_printer::~ps_printer()
putchar('\n');
out.set_file(stdout);
{
- extern const char *Version_string;
out.begin_comment("Creator:")
.comment_arg("groff")
.comment_arg("version")
@@ -1248,7 +1249,7 @@ void ps_printer::special(char *arg, const environment *env, char type)
error("X command without `ps:' tag ignored");
return;
}
- for (int i = 0; i < sizeof(proc_table)/sizeof(proc_table[0]); i++)
+ for (unsigned int i = 0; i < sizeof(proc_table)/sizeof(proc_table[0]); i++)
if (strncmp(command, proc_table[i].name, p - command) == 0) {
(this->*(proc_table[i].proc))(p, env);
return;
@@ -1495,7 +1496,6 @@ int main(int argc, char **argv)
switch(c) {
case 'v':
{
- extern const char *Version_string;
printf("GNU grops (groff) version %s\n", Version_string);
exit(0);
break;
diff --git a/contrib/groff/src/devices/grops/psrm.cc b/contrib/groff/src/devices/grops/psrm.cc
index b816c6b..5f232c0 100644
--- a/contrib/groff/src/devices/grops/psrm.cc
+++ b/contrib/groff/src/devices/grops/psrm.cc
@@ -1,5 +1,6 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001
+ Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -174,7 +175,7 @@ resource *resource_manager::lookup_font(const char *name)
resource *r;
for (r = resource_list; r; r = r->next)
if (r->type == RESOURCE_FONT
- && strlen(name) == r->name.length()
+ && strlen(name) == (size_t)r->name.length()
&& memcmp(name, r->name.contents(), r->name.length()) == 0)
return r;
string s(name);
@@ -535,7 +536,7 @@ resource *resource_manager::read_resource_arg(const char **ptr)
}
int ri;
for (ri = 0; ri < NRESOURCES; ri++)
- if (strlen(resource_table[ri]) == *ptr - name
+ if (strlen(resource_table[ri]) == size_t(*ptr - name)
&& memcmp(resource_table[ri], name, *ptr - name) == 0)
break;
if (ri >= NRESOURCES) {
@@ -717,7 +718,7 @@ int read_one_of(const char **ptr, const char **s, int n)
++(*ptr);
} while (**ptr != '\0' && !white_space(**ptr));
for (int i = 0; i < n; i++)
- if (strlen(s[i]) == *ptr - start
+ if (strlen(s[i]) == size_t(*ptr - start)
&& memcmp(s[i], start, *ptr - start) == 0)
return i;
return -1;
@@ -859,7 +860,7 @@ static unsigned parse_extensions(const char *ptr)
} while (*ptr != '\0' && !white_space(*ptr));
int i;
for (i = 0; i < NEXTENSIONS; i++)
- if (strlen(extension_table[i]) == ptr - name
+ if (strlen(extension_table[i]) == size_t(ptr - name)
&& memcmp(extension_table[i], name, ptr - name) == 0) {
flags |= (1 << i);
break;
diff --git a/contrib/groff/src/devices/grotty/tty.cc b/contrib/groff/src/devices/grotty/tty.cc
index a8ee065..d13adbf 100644
--- a/contrib/groff/src/devices/grotty/tty.cc
+++ b/contrib/groff/src/devices/grotty/tty.cc
@@ -21,6 +21,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "driver.h"
#include "device.h"
+extern "C" const char *Version_string;
+
#ifndef SHRT_MIN
#define SHRT_MIN (-32768)
#endif
@@ -442,7 +444,6 @@ int main(int argc, char **argv)
switch(c) {
case 'v':
{
- extern const char *Version_string;
printf("GNU grotty (groff) version %s\n", Version_string);
exit(0);
break;
diff --git a/contrib/groff/src/include/getopt.h b/contrib/groff/src/include/getopt.h
index b0147e9..c2f0180 100644
--- a/contrib/groff/src/include/getopt.h
+++ b/contrib/groff/src/include/getopt.h
@@ -1,5 +1,5 @@
/* Declarations for getopt.
- Copyright (C) 1989,90,91,92,93,94,96,97,98 Free Software Foundation, Inc.
+ Copyright (C) 1989-1994, 1996-1999, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -23,6 +23,17 @@
# define _GETOPT_H 1
#endif
+/* If __GNU_LIBRARY__ is not already defined, either we are being used
+ standalone, or this is the first header included in the source file.
+ If we are being used with glibc, we need to include <features.h>, but
+ that does not exist if we are standalone. So: if __GNU_LIBRARY__ is
+ not defined, include <ctype.h>, which will pull in <features.h> for us
+ if it's from glibc. (Why ctype.h? It's guaranteed to exist and it
+ doesn't flood the namespace with stuff the way some other headers do.) */
+#if !defined __GNU_LIBRARY__
+# include <ctype.h>
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -82,7 +93,7 @@ extern int optopt;
struct option
{
-# if defined __STDC__ && __STDC__
+# if (defined __STDC__ && __STDC__) || defined __cplusplus
const char *name;
# else
char *name;
@@ -126,7 +137,7 @@ struct option
arguments to the option '\0'. This behavior is specific to the GNU
`getopt'. */
-#if defined __STDC__ && __STDC__
+#if (defined __STDC__ && __STDC__) || defined __cplusplus
# ifdef __GNU_LIBRARY__
/* Many other libraries have conflicting prototypes for getopt, with
differences in the consts, in stdlib.h. To avoid compilation
diff --git a/contrib/groff/src/include/groff-getopt.h b/contrib/groff/src/include/groff-getopt.h
index 1807fc7..a30e197 100644
--- a/contrib/groff/src/include/groff-getopt.h
+++ b/contrib/groff/src/include/groff-getopt.h
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 2000 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
Written by Werner Lemberg (wl@gnu.org)
This file is part of groff.
@@ -47,19 +47,19 @@ struct option
#define required_argument 1
#define optional_argument 2
-extern int getopt(int __argc,
- char *const *__argv,
- const char *__shortopts);
-extern int getopt_long(int __argc,
- char *const *__argv,
- const char *__shortopts,
- const struct option *__longopts,
- int *__longind);
-extern int getopt_long_only(int __argc,
- char *const *__argv,
- const char *__shortopts,
- const struct option *__longopts,
- int *__longind);
+extern int getopt(int, // __argc
+ char *const *, // __argv
+ const char *); // __shortopts
+extern int getopt_long(int, // __argc
+ char *const *, // __argv
+ const char *, // __shortopts
+ const struct option *, // __longopts
+ int *); // __longind
+extern int getopt_long_only(int, // __argc
+ char *const *, // __argv
+ const char *, // __shortopts
+ const struct option *, // __longopts
+ int *); // __longind
#ifdef __cplusplus
}
diff --git a/contrib/groff/src/include/lib.h b/contrib/groff/src/include/lib.h
index ad416e0..db5277c 100644
--- a/contrib/groff/src/include/lib.h
+++ b/contrib/groff/src/include/lib.h
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989-2000 Free Software Foundation, Inc.
+/* Copyright (C) 1989-2000, 2001 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -19,16 +19,18 @@ with groff; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
extern "C" {
-#ifndef strerror
+#ifndef HAVE_STRERROR
char *strerror(int);
#endif
const char *i_to_a(int);
const char *if_to_a(int, int);
}
-/* stdio.h on IRIX and OSF/1 include getopt.h */
+/* stdio.h on IRIX, OSF/1, and UWIN includes getopt.h */
-#if !(defined(__sgi) || (defined(__osf__) && defined(__alpha)))
+#if !(defined(__sgi) \
+ || (defined(__osf__) && defined(__alpha)) \
+ || defined(_UWIN))
#include <groff-getopt.h>
#endif
@@ -41,8 +43,8 @@ int is_prime(unsigned);
#include <strings.h>
#endif
-FILE *xtmpfile(char **namep=0, char *postfix=0, int do_unlink=1);
-char *xtmptemplate(char *extension=0);
+FILE *xtmpfile(char **namep = 0, char *postfix = 0, int do_unlink = 1);
+char *xtmptemplate(char *extension = 0);
#ifdef NEED_DECLARATION_POPEN
@@ -56,6 +58,8 @@ extern "C" { int pclose (FILE *); }
#endif /* NEED_DECLARATION_PCLOSE */
+size_t file_name_max(const char *fname);
+
int interpret_lf_args(const char *p);
extern char illegal_char_table[];
diff --git a/contrib/groff/src/include/nonposix.h b/contrib/groff/src/include/nonposix.h
index 5144983..abd7d1e 100644
--- a/contrib/groff/src/include/nonposix.h
+++ b/contrib/groff/src/include/nonposix.h
@@ -27,7 +27,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
# define setmode(f,m) _setmode(f,m)
#endif
-#if defined(__MSDOS__) || (defined(_WIN32) && !defined(__CYGWIN32__))
+#if defined(__MSDOS__) \
+ || (defined(_WIN32) && !defined(_UWIN) && !defined(__CYGWIN32__))
/* Binary I/O nuisances. Note: "setmode" is right for DJGPP and
Borland; Windows compilers might need _setmode or some such. */
diff --git a/contrib/groff/src/libs/libbib/index.cc b/contrib/groff/src/libs/libbib/index.cc
index 5573771..4d836a0 100644
--- a/contrib/groff/src/libs/libbib/index.cc
+++ b/contrib/groff/src/libs/libbib/index.cc
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2001 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -408,7 +408,7 @@ int index_search_item_iterator::get_tag(int tagno,
buflen = length + 2;
buf = new char[buflen];
}
- if (fread(buf + 1, 1, length, fp) != length)
+ if (fread(buf + 1, 1, length, fp) != (size_t)length)
error("fread on `%1' failed: %2", filename, strerror(errno));
else {
buf[0] = '\n';
@@ -487,7 +487,7 @@ const int *index_search_item::search1(const char **pp, const char *end)
for (int h = hc % common_words_table_size;
common_words_table[h];
--h) {
- if (strlen(common_words_table[h]) == len
+ if (strlen(common_words_table[h]) == (size_t)len
&& memcmp(common_words_table[h], key_buffer, len) == 0)
return 0;
if (h == 0)
diff --git a/contrib/groff/src/libs/libgroff/Makefile.sub b/contrib/groff/src/libs/libgroff/Makefile.sub
index 5ce0691..ff5c655 100644
--- a/contrib/groff/src/libs/libgroff/Makefile.sub
+++ b/contrib/groff/src/libs/libgroff/Makefile.sub
@@ -18,6 +18,7 @@ OBJS=\
lf.o \
lineno.o \
macropath.o \
+ maxfilename.o \
nametoindex.o \
new.o \
prime.o \
@@ -49,6 +50,7 @@ CCSRCS=\
$(srcdir)/lf.cc \
$(srcdir)/lineno.cc \
$(srcdir)/macropath.cc \
+ $(srcdir)/maxfilename.cc \
$(srcdir)/nametoindex.cc \
$(srcdir)/new.cc \
$(srcdir)/prime.cc \
@@ -80,5 +82,5 @@ version.cc: $(top_srcdir)/VERSION $(top_srcdir)/REVISION
@echo Making version.cc
@echo const char \*version_string = \"$(version)\"\; >$@
@echo const char \*revision_string = \"$(revision)\"\; >>$@
- @echo const char \*Version_string = \"$(version).$(revision)\"\; | \
+ @echo extern \"C\" const char \*Version_string = \"$(version).$(revision)\"\; | \
sed -e 's/\.0\"/\"/' >>$@
diff --git a/contrib/groff/src/libs/libgroff/font.cc b/contrib/groff/src/libs/libgroff/font.cc
index 6cdd647..aa602b4 100644
--- a/contrib/groff/src/libs/libgroff/font.cc
+++ b/contrib/groff/src/libs/libgroff/font.cc
@@ -1,5 +1,6 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001
+ Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -751,7 +752,7 @@ int font::load_desc()
while (t.next()) {
char *p = strtok(t.buf, WS);
int found = 0;
- int idx;
+ unsigned int idx;
for (idx = 0; !found && idx < sizeof(table)/sizeof(table[0]); idx++)
if (strcmp(table[idx].command, p) == 0)
found = 1;
diff --git a/contrib/groff/src/libs/libgroff/getopt.c b/contrib/groff/src/libs/libgroff/getopt.c
index 4744e43..0ecad38 100644
--- a/contrib/groff/src/libs/libgroff/getopt.c
+++ b/contrib/groff/src/libs/libgroff/getopt.c
@@ -77,11 +77,12 @@
#endif
#ifndef _
-/* This is for other GNU distributions with internationalized messages.
- When compiling libc, the _ macro is predefined. */
-# ifdef HAVE_LIBINTL_H
+/* This is for other GNU distributions with internationalized messages. */
+# if defined HAVE_LIBINTL_H || defined _LIBC
# include <libintl.h>
-# define _(msgid) gettext (msgid)
+# ifndef _
+# define _(msgid) gettext (msgid)
+# endif
# else
# define _(msgid) (msgid)
# endif
@@ -521,6 +522,9 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
if (optstring[0] == ':')
print_errors = 0;
+ if (argc < 1)
+ return -1;
+
optarg = NULL;
if (optind == 0 || !__getopt_initialized)
@@ -670,7 +674,10 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
pfound = p;
indfound = option_index;
}
- else
+ else if (long_only
+ || pfound->has_arg != p->has_arg
+ || pfound->flag != p->flag
+ || pfound->val != p->val)
/* Second or later nonexact match found. */
ambig = 1;
}
diff --git a/contrib/groff/src/libs/libgroff/maxfilename.cc b/contrib/groff/src/libs/libgroff/maxfilename.cc
new file mode 100644
index 0000000..c5a03d7
--- /dev/null
+++ b/contrib/groff/src/libs/libgroff/maxfilename.cc
@@ -0,0 +1,67 @@
+// -*- C++ -*-
+/* Copyright (C) 1992, 2001 Free Software Foundation, Inc.
+ Written by James Clark (jjc@jclark.com)
+
+This file is part of groff.
+
+groff 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.
+
+groff 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 groff; see the file COPYING. If not, write to the Free Software
+Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+/* file_name_max(dir) does the same as pathconf(dir, _PC_NAME_MAX) */
+
+#include <sys/types.h>
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif /* HAVE_UNISTD_H */
+
+#ifdef _POSIX_VERSION
+
+size_t file_name_max(const char *fname)
+{
+ return pathconf(fname, _PC_NAME_MAX);
+}
+
+#else /* not _POSIX_VERSION */
+
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif /* HAVE_LIMITS_H */
+
+#ifdef HAVE_DIRENT_H
+#include <dirent.h>
+#else /* not HAVE_DIRENT_H */
+#ifdef HAVE_SYS_DIR_H
+#include <sys/dir.h>
+#endif /* HAVE_SYS_DIR_H */
+#endif /* not HAVE_DIRENT_H */
+
+#ifndef NAME_MAX
+#ifdef MAXNAMLEN
+#define NAME_MAX MAXNAMLEN
+#else /* !MAXNAMLEN */
+#ifdef MAXNAMELEN
+#define NAME_MAX MAXNAMELEN
+#else /* !MAXNAMELEN */
+#define NAME_MAX 14
+#endif /* !MAXNAMELEN */
+#endif /* !MAXNAMLEN */
+#endif /* !NAME_MAX */
+
+size_t file_name_max(const char *)
+{
+ return NAME_MAX;
+}
+
+#endif /* not _POSIX_VERSION */
diff --git a/contrib/groff/src/libs/libgroff/tmpfile.cc b/contrib/groff/src/libs/libgroff/tmpfile.cc
index a6c2010..8508c59 100644
--- a/contrib/groff/src/libs/libgroff/tmpfile.cc
+++ b/contrib/groff/src/libs/libgroff/tmpfile.cc
@@ -1,5 +1,6 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001
+ Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -29,12 +30,11 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "error.h"
#include "nonposix.h"
+#ifndef HAVE_MKSTEMP_PROTO
extern "C" {
- // Solaris 2.5.1 has these functions,
- // but its stdlib.h fails to declare them.
- char *mktemp(char *);
- int mkstemp(char *);
+ extern int mkstemp (char *);
}
+#endif
// If this is set, create temporary files there
#define GROFF_TMPDIR_ENVVAR "GROFF_TMPDIR"
@@ -48,7 +48,11 @@ extern "C" {
# define DEFAULT_TMPDIR "/tmp"
#endif
// Use this as the prefix for temporary filenames.
-#define TMPFILE_PREFIX "groff"
+#ifdef __MSDOS__
+#define TMPFILE_PREFIX ""
+#else
+#define TMPFILE_PREFIX "groff"
+#endif
/*
* Generate a temporary name template with a postfix
@@ -104,14 +108,13 @@ static void remove_tmp_files()
{
struct xtmpfile_list *p = xtmpfiles_to_delete;
- while (p)
- {
- if (unlink(p->fname) < 0)
- error("cannot unlink `%1': %2", p->fname, strerror(errno));
- struct xtmpfile_list *old = p;
- p = p->next;
- free(old);
- }
+ while (p) {
+ if (unlink(p->fname) < 0)
+ error("cannot unlink `%1': %2", p->fname, strerror(errno));
+ struct xtmpfile_list *old = p;
+ p = p->next;
+ free(old);
+ }
}
static void add_tmp_file(const char *name)
@@ -122,11 +125,10 @@ static void add_tmp_file(const char *name)
struct xtmpfile_list *p
= (struct xtmpfile_list *)malloc(sizeof(struct xtmpfile_list)
+ strlen (name));
- if (p == NULL)
- {
- error("cannot unlink `%1': %2", name, strerror(errno));
- return;
- }
+ if (p == NULL) {
+ error("cannot unlink `%1': %2", name, strerror(errno));
+ return;
+ }
p->next = xtmpfiles_to_delete;
strcpy(p->fname, name);
xtmpfiles_to_delete = p;
@@ -134,8 +136,6 @@ static void add_tmp_file(const char *name)
// Open a temporary file and with fatal error on failure.
-#ifndef _MSC_VER
-
FILE *xtmpfile(char **namep, char *postfix, int do_unlink)
{
char *templ = xtmptemplate(postfix);
@@ -159,28 +159,9 @@ FILE *xtmpfile(char **namep, char *postfix, int do_unlink)
#endif /* not HAVE_MKSTEMP */
if (do_unlink)
add_tmp_file(templ);
- if ((namep != 0) && ((*namep) != 0)) {
+ if ((namep != 0) && ((*namep) != 0))
*namep = templ;
- } else {
+ else
a_delete templ;
- }
return fp;
}
-
-#else
-
-// FIXME: does MSVC have mktemp or mkstemp? If so, it should now
-// use the version above, as it no longer removes an open file.
-// The version below will NOT work with grohtml, since grohtml
-// wants to know the name of the file opened by xtmpfile!!
-
-// If you're not running Unix, the following will do:
-FILE *xtmpfile(char **namep, char *postfix, int do_unlink)
-{
- FILE *fp = tmpfile();
- if (!fp)
- fatal("couldn't create temporary file");
- return fp;
-}
-
-#endif /* _MSC_VER */
diff --git a/contrib/groff/src/preproc/eqn/eqn.man b/contrib/groff/src/preproc/eqn/eqn.man
index 381d97d..bc7dc7e 100644
--- a/contrib/groff/src/preproc/eqn/eqn.man
+++ b/contrib/groff/src/preproc/eqn/eqn.man
@@ -1,5 +1,5 @@
-.ig \"-*- nroff -*-
-Copyright (C) 1989-2000 Free Software Foundation, Inc.
+.ig
+Copyright (C) 1989-2000, 2001 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -880,3 +880,7 @@ beginning of the input line.
.BR @g@troff (@MAN1EXT@),
.BR groff_font (@MAN5EXT@),
.I The\ \*(txbook
+.
+.\" Local Variables:
+.\" mode: nroff
+.\" End:
diff --git a/contrib/groff/src/preproc/eqn/lex.cc b/contrib/groff/src/preproc/eqn/lex.cc
index 25faec2..e14053d 100644
--- a/contrib/groff/src/preproc/eqn/lex.cc
+++ b/contrib/groff/src/preproc/eqn/lex.cc
@@ -1,5 +1,6 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001
+ Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -251,7 +252,7 @@ static struct {
void init_table(const char *device)
{
- int i;
+ unsigned int i;
for (i = 0; i < sizeof(token_table)/sizeof(token_table[0]); i++) {
definition *def = new definition;
def->is_macro = 0;
diff --git a/contrib/groff/src/preproc/eqn/main.cc b/contrib/groff/src/preproc/eqn/main.cc
index 6dc03f0..f53ffa3 100644
--- a/contrib/groff/src/preproc/eqn/main.cc
+++ b/contrib/groff/src/preproc/eqn/main.cc
@@ -30,6 +30,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define STARTUP_FILE "eqnrc"
extern int yyparse();
+extern "C" const char *Version_string;
static char *delim_search (char *, int);
static int inline_equation (FILE *, string &, string &);
@@ -303,7 +304,6 @@ int main(int argc, char **argv)
break;
case 'v':
{
- extern const char *Version_string;
printf("GNU eqn (groff) version %s\n", Version_string);
exit(0);
break;
diff --git a/contrib/groff/src/preproc/eqn/neqn.man b/contrib/groff/src/preproc/eqn/neqn.man
index bca7dc2..27261c4 100644
--- a/contrib/groff/src/preproc/eqn/neqn.man
+++ b/contrib/groff/src/preproc/eqn/neqn.man
@@ -1,3 +1,21 @@
+.ig
+Copyright (C) 2001 Free Software Foundation, Inc.
+
+Permission is granted to make and distribute verbatim copies of
+this manual provided the copyright notice and this permission notice
+are preserved on all copies.
+
+Permission is granted to copy and distribute modified versions of this
+manual under the conditions for verbatim copying, provided that the
+entire resulting derived work is distributed under the terms of a
+permission notice identical to this one.
+
+Permission is granted to copy and distribute translations of this
+manual into another language, under the above conditions for modified
+versions, except that this permission notice may be included in
+translations approved by the Free Software Foundation instead of in
+the original English.
+..
.TH @G@NEQN @MAN1EXT@ "@MDATE@" "Groff Version @VERSION@"
.SH NAME
@g@neqn \- format equations for ascii output
@@ -19,3 +37,7 @@ does not support low-resolution, typewriter-like devices (although it may
work adequately for very simple input).
.SH "SEE ALSO"
.BR @g@eqn (@MAN1EXT@)
+.
+.\" Local Variables:
+.\" mode: nroff
+.\" End:
diff --git a/contrib/groff/src/preproc/eqn/over.cc b/contrib/groff/src/preproc/eqn/over.cc
index 06b0321..4c544d1 100644
--- a/contrib/groff/src/preproc/eqn/over.cc
+++ b/contrib/groff/src/preproc/eqn/over.cc
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2001 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -65,7 +65,7 @@ int over_box::compute_metrics(int style)
set_script_size();
printf(".nr " SMALL_SIZE_FORMAT " \\n[.s]\n", uid);
}
- int mark_uid;
+ int mark_uid = 0;
int res = num->compute_metrics(style);
if (res)
mark_uid = num->uid;
diff --git a/contrib/groff/src/preproc/grn/grn.man b/contrib/groff/src/preproc/grn/grn.man
index f2613da..82e43cf 100644
--- a/contrib/groff/src/preproc/grn/grn.man
+++ b/contrib/groff/src/preproc/grn/grn.man
@@ -1,5 +1,6 @@
-.ig \"-*- nroff -*-
-Copyright (C) 2000 Free Software Foundation, Inc.
+'\" t
+.ig
+Copyright (C) 2000, 2001 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -634,3 +635,7 @@ David Slattengren and Barry Roitblat wrote the original Berkeley
.PP
Daniel Senderowicz and Werner Lemberg modified it for
.IR groff .
+.
+.\" Local Variables:
+.\" mode: nroff
+.\" End:
diff --git a/contrib/groff/src/preproc/grn/main.cc b/contrib/groff/src/preproc/grn/main.cc
index 92e64c6..efb33a9 100644
--- a/contrib/groff/src/preproc/grn/main.cc
+++ b/contrib/groff/src/preproc/grn/main.cc
@@ -82,6 +82,8 @@
#include "error.h"
#include "defs.h"
+extern "C" const char *Version_string;
+
/* database imports */
extern void HGPrintElt(ELT *element, int baseline);
@@ -282,7 +284,6 @@ main(int argc,
case '-':
if (strcmp(*argv,"--version")==0) {
case 'v':
- extern const char *Version_string;
printf("GNU grn (groff) version %s\n", Version_string);
exit(0);
break;
diff --git a/contrib/groff/src/preproc/html/Makefile.sub b/contrib/groff/src/preproc/html/Makefile.sub
index 9d5045a..8ecd332 100644
--- a/contrib/groff/src/preproc/html/Makefile.sub
+++ b/contrib/groff/src/preproc/html/Makefile.sub
@@ -4,4 +4,3 @@ MAN1=
XLIBS=$(LIBGROFF)
OBJS=pre-html.o pushbackbuffer.o
CCSRCS=$(srcdir)/pre-html.cc $(srcdir)/pushbackbuffer.cc
-NAMEPREFIX=$(g)
diff --git a/contrib/groff/src/preproc/html/pre-html.cc b/contrib/groff/src/preproc/html/pre-html.cc
index 8357dd6..2a36740 100644
--- a/contrib/groff/src/preproc/html/pre-html.cc
+++ b/contrib/groff/src/preproc/html/pre-html.cc
@@ -23,7 +23,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <stdio.h>
#include <signal.h>
#include <ctype.h>
-#include <string.h>
#include <assert.h>
#include <stdlib.h>
#include <errno.h>
@@ -47,7 +46,11 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define PID_T int
#endif /* not _POSIX_VERSION */
-extern char *strerror();
+#include <stdarg.h>
+
+#include "nonposix.h"
+
+extern "C" const char *Version_string;
#include "pre-html.h"
#include "pushbackbuffer.h"
@@ -59,9 +62,20 @@ extern char *strerror();
#define IMAGE_BOARDER_PIXELS 0
#define MAX_WIDTH 8 // inches
#define INLINE_LEADER_CHAR '\\'
+#define MAX_RETRIES 4096 // number of different page directory names to try before giving up
#define TRANSPARENT "-background \"#FFF\" -transparent \"#FFF\""
+#ifdef __MSDOS__
+#define PAGE_TEMPLATE "pg"
+#define PS_TEMPLATE "ps"
+#define REGION_TEMPLATE "rg"
+#else
+#define PAGE_TEMPLATE "-page-"
+#define PS_TEMPLATE "-ps-"
+#define REGION_TEMPLATE "-regions-"
+#endif
+
#if 0
# define DEBUGGING
# define DEBUG_HTML
@@ -82,20 +96,21 @@ static int stdoutfd = 1; // output file descriptor - norm
// -1 means closed
static int copyofstdoutfd =-1; // a copy of stdout, so we can restore stdout when
// writing to post-html
-static char *psFileName = 0; // name of postscript file
-static char *regionFileName = 0; // name of file containing all image regions
-static char *imagePageStem = 0; // stem of all files containing page images
+static char *psFileName = NULL; // name of postscript file
+static char *regionFileName = NULL; // name of file containing all image regions
+static char *imagePageStem = NULL; // stem of all files containing page images
static char *image_device = "pnmraw";
static int image_res = DEFAULT_IMAGE_RES;
static int vertical_offset= DEFAULT_VERTICAL_OFFSET;
-static char *image_template = 0; // image template filename
+static char *image_template = NULL; // image template filename
static int troff_arg = 0; // troff arg index
-static char *command_prefix = 0; // optional prefix for some installations.
-static char *troff_command = 0;
+static char *command_prefix = NULL; // optional prefix for some installations.
+static char *troff_command = NULL;
+static char *image_dir = NULL; // user specified image directory
#if defined(DEBUGGING)
static int debug = FALSE;
-static char *troffFileName = 0; // output of pre-html output which is sent to troff -Tps
-static char *htmlFileName = 0; // output of pre-html output which is sent to troff -Thtml
+static char *troffFileName = NULL; // output of pre-html output which is sent to troff -Tps
+static char *htmlFileName = NULL; // output of pre-html output which is sent to troff -Thtml
#endif
@@ -111,7 +126,8 @@ static char *htmlFileName = 0; // output of pre-html output whi
static int do_file(const char *filename);
/*
- * sys_fatal - writes a fatal error message. Taken from src/roff/groff/pipeline.c
+ * sys_fatal - writes a fatal error message.
+ * Taken from src/roff/groff/pipeline.c.
*/
void sys_fatal (const char *s)
@@ -120,6 +136,222 @@ void sys_fatal (const char *s)
}
/*
+ * html_system - a wrapper for system()
+ */
+void html_system(const char *s, int redirect_stdout)
+{
+ // Redirect standard error to the null device. This is more
+ // portable than using "2> /dev/null", since it doesn't require a
+ // Unixy shell.
+ int save_stderr = dup(2);
+ int save_stdout = dup(1);
+ int fdnull = open(NULL_DEV, O_WRONLY|O_BINARY, 0666);
+ if (save_stderr > 2 && fdnull > 2)
+ dup2(fdnull, 2);
+ if (redirect_stdout && save_stdout > 1 && fdnull > 1)
+ dup2(fdnull, 1);
+ if (fdnull >= 0)
+ close(fdnull);
+ int status = system(s);
+ dup2(save_stderr, 2);
+ if (redirect_stdout)
+ dup2(save_stdout, 1);
+ if (status == -1)
+ fprintf(stderr, "Calling `%s' failed\n", s);
+ else if (status)
+ fprintf(stderr, "Calling `%s' returned status %d\n", s, status);
+}
+
+#if 0
+
+/*
+ * if/when vsnprintf becomes available on all *NIX machines we can use this function,
+ * until then we must use the more complex function below which performs hand built
+ * %d, %s and %%.
+ */
+
+/*
+ * make_message - taken from man printf(3), creates a string via malloc
+ * and places the result of the va args into string.
+ * Finally the new string is returned.
+ */
+
+char *
+make_message (const char *fmt, ...)
+{
+ /* Guess we need no more than 100 bytes. */
+ int n, size = 100;
+ char *p;
+ char *np;
+ va_list ap;
+ if ((p = (char *)malloc (size)) == NULL)
+ return NULL;
+ while (1) {
+ /* Try to print in the allocated space. */
+ va_start(ap, fmt);
+ n = vsnprintf (p, size, fmt, ap);
+ va_end(ap);
+ /* If that worked, return the string. */
+ if (n > -1 && n < size) {
+ if (size > n+1) {
+ np = strdup(p);
+ if (np == NULL)
+ sys_fatal("strdup");
+ free(p);
+ return np;
+ }
+ return p;
+ }
+ /* Else try again with more space. */
+ if (n > -1) /* glibc 2.1 */
+ size = n+1; /* precisely what is needed */
+ else /* glibc 2.0 */
+ size *= 2; /* twice the old size */
+ if ((np = (char *)realloc (p, size)) == NULL) {
+ free(p); /* realloc failed, free old, p. */
+ return NULL;
+ }
+ p = np; /* use realloc'ed, p */
+ }
+}
+#else
+
+/*
+ * lengthOfintToStr - returns the length of the proposed string value of i.
+ * Hand built log10.
+ */
+
+int
+lengthOfintToStr (int i)
+{
+ int n=0;
+
+ if (i < 0)
+ sys_fatal("expecting positive integer value");
+
+ do {
+ i /= 10;
+ n++;
+ } while (i > 0);
+ return n;
+}
+
+/*
+ * intToStr - returns a string containing the positive value of i.
+ * (int i is assumed to be positive).
+ */
+
+char *
+intToStr (int i)
+{
+ int n=lengthOfintToStr(i)+1;
+ char *p = (char *)malloc(n);
+
+ if (p == NULL)
+ sys_fatal("malloc");
+
+ if (i < 0)
+ sys_fatal("expecting positive integer value");
+
+ n--;
+ p[n] = (char)0;
+ do {
+ n--;
+ p[n] = (char)((i % 10) + (int)'0');
+ i /= 10;
+ } while (i > 0);
+ return( p );
+}
+
+/*
+ * make_message - returns a string built from a format specifier.
+ * This function does not use vsnprintf; it only
+ * understands primitive %%, %s, and %d specifiers.
+ */
+
+char *
+make_message (const char *fmt, ...)
+{
+ char *p = strdup(fmt); /* so we can splat a nul anywhere in the string */
+ char *np;
+ char *l;
+ char *s;
+ char *num;
+ int search=0;
+ va_list ap;
+
+ if (p == NULL)
+ sys_fatal("strdup");
+
+ va_start(ap, fmt);
+ while (p) {
+ int lenp=strlen(p);
+ char *f = strchr(p+search, '%');
+
+ search = f-p;
+ np = p;
+
+ if (f == NULL) {
+ va_end(ap);
+ return p;
+ }
+ switch (*(f+1)) {
+
+ case 'd':
+ l = strdup(f+2);
+ if (l == NULL)
+ sys_fatal("strdup");
+ *f = (char)0;
+ num = intToStr(va_arg(ap, int));
+ np = (char *)malloc(strlen(p)+strlen(num)+strlen(l)+1);
+ if (np == NULL)
+ sys_fatal("malloc");
+ strcpy(np, p);
+ strcat(np, num);
+ strcat(np, l);
+ search += strlen(np)-lenp;
+ free(num);
+ free(l);
+ break;
+ case 's':
+ /* concat */
+ l = f+2;
+ if (l == NULL)
+ sys_fatal("strdup");
+ s = va_arg(ap, char *);
+ *f = (char)0;
+ np = (char *)malloc(strlen(l)+1+strlen(p)+strlen(s));
+ if (np == NULL)
+ sys_fatal("malloc");
+ strcpy(np, p);
+ strcat(np, s);
+ strcat(np, l);
+ search += strlen(s);
+ break;
+ case '%':
+ /* remove one of the two % that we have seen */
+ *f = (char)0;
+ l = f+1;
+ np = (char *)malloc(strlen(l)+1+strlen(p));
+ if (np == NULL)
+ sys_fatal("malloc");
+ strcpy(np, p);
+ strcat(np, l);
+ search++;
+ break;
+ default:
+ sys_fatal("unexpected format specifier");
+ return NULL;
+ }
+ free(p);
+ p = np;
+ }
+ va_end(ap);
+ return NULL;
+}
+#endif
+
+/*
* the class and methods for retaining ascii text
*/
@@ -174,7 +406,7 @@ char_buffer::char_buffer()
char_buffer::~char_buffer()
{
- while (head != 0) {
+ while (head != NULL) {
char_block *temp = head;
head = head->next;
delete temp;
@@ -187,12 +419,10 @@ char_buffer::~char_buffer()
int char_buffer::read_file (FILE *fp)
{
- int i=0;
- unsigned int old_used;
int n;
while (! feof(fp)) {
- if (tail == 0) {
+ if (tail == NULL) {
tail = new char_block;
head = tail;
} else {
@@ -246,14 +476,55 @@ static void writeString (char *s)
* makeFileName - creates the image filename template.
*/
-void makeFileName ()
+static void makeFileName (void)
{
- char buffer[8192];
+ char *s;
+
+ if ((image_dir != NULL) && (strchr(image_dir, '%') != NULL)) {
+ error("cannot use a `%%' within the image directory name");
+ exit(1);
+ }
- sprintf(buffer, "grohtml-%d", (int)getpid());
- strcat(buffer, "-%d");
- image_template = (char *)malloc(strlen(buffer)+1);
- strcpy(image_template, buffer);
+ if ((image_template != NULL) && (strchr(image_template, '%') != NULL)) {
+ error("cannot use a `%%' within the image template");
+ exit(1);
+ }
+
+ if (image_dir == NULL) {
+ image_dir = "";
+ } else if ((strlen(image_dir)>0) && (image_dir[strlen(image_dir)-1] != '/')) {
+ image_dir = make_message("%s/", image_dir);
+ if (image_dir == NULL)
+ sys_fatal("make_message");
+ }
+
+ if (image_template == NULL)
+ s = make_message("%sgrohtml-%d", image_dir, (int)getpid());
+ else {
+ s = make_message("%s%s", image_dir, image_template);
+ }
+ if (s == NULL)
+ sys_fatal("make_message");
+
+ image_template = (char *)malloc(strlen("-%d")+strlen(s)+1);
+ if (image_template == NULL)
+ sys_fatal("malloc");
+ strcpy(image_template, s);
+ strcat(image_template, "-%d");
+ free(s);
+}
+
+/*
+ * checkImageDir - checks to see whether the image directory is available.
+ */
+
+static void checkImageDir (void)
+{
+ if ((image_dir != NULL) && (strcmp(image_dir, "") != 0))
+ if (! ((mkdir(image_dir, 0700) == 0) || (errno == EEXIST))) {
+ error("cannot create directory `%1'", image_dir);
+ exit(1);
+ }
}
/*
@@ -266,12 +537,12 @@ static void write_end_image (int is_html)
/*
* emit image name and enable output
*/
- writeString("\\O2\\O1\\O4\n");
+ writeString("\\O[2]\\O[1]\\O[4]\n");
} else {
/*
* postscript, therefore emit image boundaries
*/
- writeString("\\O2\\O4\n");
+ writeString("\\O[2]\\O[4]\n");
}
}
@@ -286,8 +557,8 @@ static void write_end_image (int is_html)
static void write_start_image (IMAGE_ALIGNMENT pos, int is_html)
{
if (pos == INLINE) {
- writeString("\\O3\\O5'");
- writeString(image_template); writeString(".png'");
+ writeString("\\O[3]\\O[5 ");
+ writeString(image_template); writeString(".png]");
} else {
writeString(".begin \\{\\\n");
switch (pos) {
@@ -310,10 +581,10 @@ static void write_start_image (IMAGE_ALIGNMENT pos, int is_html)
writeString("\\}\n");
}
if (is_html) {
- writeString("\\O0\n");
+ writeString("\\O[0]\n");
} else {
// reset min/max registers
- writeString("\\O0\\O1\n");
+ writeString("\\O[0]\\O[1]\n");
}
}
@@ -456,10 +727,9 @@ void char_buffer::skip_to_newline (char_block **t, int *i)
void char_buffer::write_file_troff (void)
{
char_block *t=head;
- int r;
int i=0;
- if (t != 0) {
+ if (t != NULL) {
do {
/*
* remember to check the shortest string last
@@ -479,7 +749,7 @@ void char_buffer::write_file_troff (void)
} else {
write_upto_newline(&t, &i, FALSE);
}
- } while (t != 0);
+ } while (t != NULL);
}
if (close(stdoutfd) < 0)
sys_fatal("close");
@@ -526,7 +796,7 @@ imageItem::imageItem (int x1, int y1, int x2, int y2, int page, int res, int max
resolution = res;
maxx = max_width;
imageName = name;
- next = 0;
+ next = NULL;
}
/*
@@ -567,7 +837,7 @@ imageList::imageList ()
imageList::~imageList ()
{
- while (head != 0) {
+ while (head != NULL) {
imageItem *i = head;
head = head->next;
delete i;
@@ -578,21 +848,54 @@ imageList::~imageList ()
* createAllPages - creates a set of images, one per page.
*/
-static void createAllPages (void)
+static int createAllPages (void)
{
char buffer[4096];
+ char *s;
+ int retries = MAX_RETRIES;
+
+ imagePageStem = xtmptemplate(PAGE_TEMPLATE);
+ strcpy(buffer, imagePageStem);
- sprintf(buffer,
- "echo showpage | gs -q -dSAFER -sDEVICE=%s -r%d -sOutputFile=%s%%d %s - > /dev/null 2>&1 \n",
- image_device,
- image_res,
- imagePageStem,
- psFileName);
+ do {
+ if (mktemp(imagePageStem) == NULL) {
+ sys_fatal("mktemp");
+ return -1;
+ }
+ if (mkdir(imagePageStem, 0700) == 0) break;
+ if (errno == EEXIST) {
+ // directory already exists, try another name
+ retries--;
+ if (retries == 0) {
+ // time to give up
+ sys_fatal("mkdir");
+ return -1;
+ }
+ } else {
+ // another error, quit
+ sys_fatal("mkdir");
+ return -1;
+ }
+ strcpy(imagePageStem, buffer);
+ } while (1);
+
+ s = make_message("echo showpage | "
+ "gs%s -q -dSAFER -sDEVICE=%s -r%d "
+ "-sOutputFile=%s/%%d %s -",
+ EXE_EXT,
+ image_device,
+ image_res,
+ imagePageStem,
+ psFileName);
+ if (s == NULL)
+ sys_fatal("make_message");
#if defined(DEBUGGING)
- fwrite(buffer, sizeof(char), strlen(buffer), stderr);
+ fwrite(s, sizeof(char), strlen(s), stderr);
fflush(stderr);
#endif
- system(buffer);
+ html_system(s, 1);
+ free(s);
+ return 0;
}
/*
@@ -602,30 +905,22 @@ static void createAllPages (void)
static void removeAllPages (void)
{
#if !defined(DEBUGGING)
- char buffer[4096];
+ char *s=NULL;
int i=1;
do {
- sprintf(buffer, "%s%d", imagePageStem, i);
+ if (s)
+ free(s);
+ s = make_message("%s/%d", imagePageStem, i);
+ if (s == NULL)
+ sys_fatal("make_message");
i++;
- } while (remove(buffer) == 0);
+ } while (unlink(s) == 0);
+ rmdir(imagePageStem);
#endif
}
/*
- * abs - returns the absolute value.
- */
-
-int abs (int x)
-{
- if (x < 0) {
- return( -x );
- } else {
- return( x );
- }
-}
-
-/*
* min - returns the minimum of two numbers.
*/
@@ -658,23 +953,28 @@ int max (int x, int y)
static void createImage (imageItem *i)
{
if (i->X1 != -1) {
- char buffer[4096];
+ char *s;
int x1 = max(min(i->X1, i->X2)*image_res/POSTSCRIPTRES-1*IMAGE_BOARDER_PIXELS, 0);
int y1 = max((image_res*vertical_offset/72)+min(i->Y1, i->Y2)*image_res/POSTSCRIPTRES-IMAGE_BOARDER_PIXELS, 0);
int x2 = max(i->X1, i->X2)*image_res/POSTSCRIPTRES+1*IMAGE_BOARDER_PIXELS;
int y2 = (image_res*vertical_offset/72)+max(i->Y1, i->Y2)*image_res/POSTSCRIPTRES+1*IMAGE_BOARDER_PIXELS;
- sprintf(buffer,
- "pnmcut %d %d %d %d < %s%d | pnmtopng %s > %s \n",
- x1, y1, x2-x1+1, y2-y1+1,
- imagePageStem,
- i->pageNo,
- TRANSPARENT,
- i->imageName);
+ s = make_message("pnmcut%s %d %d %d %d < %s/%d | pnmtopng%s %s > %s \n",
+ EXE_EXT,
+ x1, y1, x2-x1+1, y2-y1+1,
+ imagePageStem,
+ i->pageNo,
+ EXE_EXT,
+ TRANSPARENT,
+ i->imageName);
+ if (s == NULL)
+ sys_fatal("make_message");
+
#if defined(DEBUGGING)
- fprintf(stderr, buffer);
+ fprintf(stderr, s);
#endif
- system(buffer);
+ html_system(s, 0);
+ free(s);
#if defined(DEBUGGING)
} else {
fprintf(stderr, "ignoring image as x1 coord is -1\n");
@@ -691,7 +991,7 @@ void imageList::add (int x1, int y1, int x2, int y2, int page, int res, int maxx
{
imageItem *i = new imageItem(x1, y1, x2, y2, page, res, maxx, name);
- if (head == 0) {
+ if (head == NULL) {
head = i;
tail = i;
} else {
@@ -712,10 +1012,9 @@ static imageList listOfImages; // list of images defined by the region file.
void char_buffer::write_file_html (void)
{
char_block *t =head;
- char *name;
int i=0;
- if (t != 0) {
+ if (t != NULL) {
stop();
do {
/*
@@ -737,7 +1036,7 @@ void char_buffer::write_file_html (void)
} else {
write_upto_newline(&t, &i, TRUE);
}
- } while (t != 0);
+ } while (t != NULL);
}
if (close(stdoutfd) < 0)
sys_fatal("close");
@@ -760,7 +1059,6 @@ void char_buffer::write_file_html (void)
static void generateImages (char *regionFileName)
{
pushBackBuffer *f=new pushBackBuffer(regionFileName);
- char ch;
while (f->putPB(f->getPB()) != eof) {
if (f->isString("grohtml-info:page")) {
@@ -775,10 +1073,10 @@ static void generateImages (char *regionFileName)
listOfImages.add(x1, y1, x2, y2, page, res, maxx, name);
while ((f->putPB(f->getPB()) != '\n') &&
(f->putPB(f->getPB()) != eof)) {
- ch = f->getPB();
+ (void)f->getPB();
}
if (f->putPB(f->getPB()) == '\n') {
- ch = f->getPB();
+ (void)f->getPB();
}
} else {
/*
@@ -931,6 +1229,9 @@ char **addps4html (int argc, char *argv[])
char **new_argv = (char **)malloc((argc+2)*sizeof(char *));
int i=0;
+ if (new_argv == NULL)
+ sys_fatal("malloc");
+
while (i<argc) {
new_argv[i] = argv[i];
i++;
@@ -1006,13 +1307,15 @@ static char_buffer inputFile;
void usage(FILE *stream)
{
- fprintf(stream, "usage: %s troffname [-P-o vertical_image_offset] [-P-i image_resolution] [troff flags] [files]\n", program_name);
+ fprintf(stream, "usage: %s troffname [-Iimage_name] [-Dimage_directory] [-P-o vertical_image_offset] [-P-i image_resolution] [troff flags] [files]\n", program_name);
fprintf(stream, " vertical_image_offset (default %d/72 of an inch)\n", vertical_offset);
fprintf(stream, " image_resolution (default %d) pixels per inch\n", image_res);
+ fprintf(stream, " image_name is the name of the stem for all images (default is grohtml-<pid>)\n");
+ fprintf(stream, " place all png files into image_directory\n");
}
/*
- * scanArguments - scans for -P-i and -P-o arguments.
+ * scanArguments - scans for -P-i, -P-o, -P-D and -P-I arguments.
*/
int scanArguments (int argc, char **argv)
@@ -1020,13 +1323,16 @@ int scanArguments (int argc, char **argv)
int i=1;
while (i<argc) {
- if (strncmp(argv[i], "-i", 2) == 0) {
+ if (strncmp(argv[i], "-D", 2) == 0) {
+ image_dir = (char *)(argv[i]+2);
+ } else if (strncmp(argv[i], "-I", 2) == 0) {
+ image_template = (char *)(argv[i]+2);
+ } else if (strncmp(argv[i], "-i", 2) == 0) {
image_res = atoi((char *)(argv[i]+2));
} else if (strncmp(argv[i], "-o", 2) == 0) {
vertical_offset = atoi((char *)(argv[i]+2));
} else if ((strcmp(argv[i], "-v") == 0)
|| (strcmp(argv[i], "--version") == 0)) {
- extern const char *Version_string;
printf("GNU pre-grohtml (groff) version %s\n", Version_string);
exit(0);
} else if ((strcmp(argv[i], "-h") == 0)
@@ -1034,7 +1340,7 @@ int scanArguments (int argc, char **argv)
|| (strcmp(argv[i], "-?") == 0)) {
usage(stdout);
exit(0);
- } else if (strcmp(argv[i], "troff") == 0) {
+ } else if (strcmp(argv[i], troff_command) == 0) {
/* remember troff argument number */
troff_arg = i;
#if defined(DEBUGGING)
@@ -1053,7 +1359,7 @@ int scanArguments (int argc, char **argv)
* makeTempFiles - name the temporary files
*/
-static void makeTempFiles (void)
+static int makeTempFiles (void)
{
#if defined(DEBUGGING)
psFileName = "/tmp/prehtml-ps";
@@ -1062,10 +1368,21 @@ static void makeTempFiles (void)
troffFileName = "/tmp/prehtml-troff";
htmlFileName = "/tmp/prehtml-html";
#else
- psFileName = mktemp(xtmptemplate("-ps-"));
- regionFileName = mktemp(xtmptemplate("-regions-"));
- imagePageStem = mktemp(xtmptemplate("-page-"));
+ int fd;
+
+ if ((fd = mkstemp(psFileName = xtmptemplate(PS_TEMPLATE))) == -1) {
+ sys_fatal("mkstemp");
+ return -1;
+ }
+ close(fd);
+ if ((fd = mkstemp(regionFileName = xtmptemplate(REGION_TEMPLATE))) == -1) {
+ sys_fatal("mkstemp");
+ unlink(psFileName);
+ return -1;
+ }
+ close(fd);
#endif
+ return 0;
}
/*
@@ -1075,8 +1392,8 @@ static void makeTempFiles (void)
static void removeTempFiles (void)
{
#if !defined(DEBUGGING)
- remove(psFileName);
- remove(regionFileName);
+ unlink(psFileName);
+ unlink(regionFileName);
#endif
}
@@ -1091,6 +1408,9 @@ static void findPrefix (void)
if (!command_prefix)
command_prefix = PROG_PREFIX;
troff_command = (char *)malloc(strlen("troff")+strlen(command_prefix)+1);
+ if (troff_command == NULL)
+ sys_fatal("malloc");
+
strcpy(troff_command, command_prefix);
strcat(troff_command, "troff");
}
@@ -1104,8 +1424,9 @@ int main(int argc, char **argv)
int ok=1;
findPrefix();
- makeFileName();
i = scanArguments(argc, argv);
+ checkImageDir();
+ makeFileName();
while (i < argc) {
if (argv[i][0] != '-') {
/* found source file */
@@ -1123,13 +1444,16 @@ int main(int argc, char **argv)
if (! found) {
do_file("-");
}
- makeTempFiles();
+ if (makeTempFiles())
+ return 1;
ok = inputFile.do_image(argc, argv);
if (ok == 0) {
- createAllPages();
- generateImages(regionFileName);
- ok = inputFile.do_html(argc, argv);
- removeAllPages();
+ ok = createAllPages();
+ if (ok == 0) {
+ generateImages(regionFileName);
+ ok = inputFile.do_html(argc, argv);
+ removeAllPages();
+ }
}
removeTempFiles();
return ok;
@@ -1155,6 +1479,6 @@ static int do_file(const char *filename)
if (fp != stdin)
fclose(fp);
- current_filename = 0;
+ current_filename = NULL;
return 1;
}
diff --git a/contrib/groff/src/preproc/html/pushbackbuffer.cc b/contrib/groff/src/preproc/html/pushbackbuffer.cc
index 1d380f4..4bea451 100644
--- a/contrib/groff/src/preproc/html/pushbackbuffer.cc
+++ b/contrib/groff/src/preproc/html/pushbackbuffer.cc
@@ -48,7 +48,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
# define FALSE (1==0)
#endif
-# define ERROR(X) (fprintf(stderr, "%s:%d error %s\n", __FILE__, __LINE__, X) && \
+# define ERROR(X) (void)(fprintf(stderr, "%s:%d error %s\n", __FILE__, __LINE__, X) && \
(fflush(stderr)) && localexit(1))
@@ -195,7 +195,6 @@ int pushBackBuffer::isString (char *s)
{
int length=strlen(s);
int i=0;
- int j;
while ((i<length) && (putPB(getPB())==s[i])) {
if (getPB() != s[i]) {
@@ -230,10 +229,12 @@ static int isDigit (char ch)
* isHexDigit - returns TRUE if the character, ch, is a hex digit.
*/
+#if 0
static int isHexDigit (char ch)
{
return( (isDigit(ch)) || ((ch>='a') && (ch<='f')) );
}
+#endif
/*
* readInt - returns an integer from the input stream.
diff --git a/contrib/groff/src/preproc/pic/main.cc b/contrib/groff/src/preproc/pic/main.cc
index 87d2b93..b795d48 100644
--- a/contrib/groff/src/preproc/pic/main.cc
+++ b/contrib/groff/src/preproc/pic/main.cc
@@ -21,6 +21,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "pic.h"
extern int yyparse();
+extern "C" const char *Version_string;
output *out;
@@ -568,7 +569,6 @@ int main(int argc, char **argv)
break;
case 'v':
{
- extern const char *Version_string;
printf("GNU pic (groff) version %s\n", Version_string);
exit(0);
break;
diff --git a/contrib/groff/src/preproc/pic/pic.man b/contrib/groff/src/preproc/pic/pic.man
index e187021..ea53074 100644
--- a/contrib/groff/src/preproc/pic/pic.man
+++ b/contrib/groff/src/preproc/pic/pic.man
@@ -1,5 +1,5 @@
-.ig \"-*- nroff -*-
-Copyright (C) 1989-2000 Free Software Foundation, Inc.
+.ig
+Copyright (C) 1989-2000, 2001 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -881,3 +881,7 @@ is incompatible with the pic in 10th edition Unix,
which interprets 0 as black and 1 as white.
.LP
PostScript\*R is a registered trademark of Adobe Systems Incorporation.
+.
+.\" Local Variables:
+.\" mode: nroff
+.\" End:
diff --git a/contrib/groff/src/preproc/pic/pic.y b/contrib/groff/src/preproc/pic/pic.y
index 38b960a..c0a7315 100644
--- a/contrib/groff/src/preproc/pic/pic.y
+++ b/contrib/groff/src/preproc/pic/pic.y
@@ -1,4 +1,5 @@
-/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001
+ Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -1622,7 +1623,8 @@ void define_variable(const char *name, double val)
if (strcmp(name, "scale") == 0) {
// When the scale changes, reset all scaled pre-defined variables to
// their default values.
- for (int i = 0; i < sizeof(defaults_table)/sizeof(defaults_table[0]); i++)
+ for (unsigned int i = 0;
+ i < sizeof(defaults_table)/sizeof(defaults_table[0]); i++)
if (defaults_table[i].scaled)
define_variable(defaults_table[i].name, val*defaults_table[i].val);
}
@@ -1641,7 +1643,8 @@ void parse_init()
void reset(const char *nm)
{
- for (int i = 0; i < sizeof(defaults_table)/sizeof(defaults_table[0]); i++)
+ for (unsigned int i = 0;
+ i < sizeof(defaults_table)/sizeof(defaults_table[0]); i++)
if (strcmp(nm, defaults_table[i].name) == 0) {
double val = defaults_table[i].val;
if (defaults_table[i].scaled) {
@@ -1661,7 +1664,8 @@ void reset_all()
// aren't scaled because `scale' is not scaled, and changing the
// value of `scale' will reset all the pre-defined variables that
// are scaled.
- for (int i = 0; i < sizeof(defaults_table)/sizeof(defaults_table[0]); i++)
+ for (unsigned int i = 0;
+ i < sizeof(defaults_table)/sizeof(defaults_table[0]); i++)
if (!defaults_table[i].scaled)
define_variable(defaults_table[i].name, defaults_table[i].val);
}
diff --git a/contrib/groff/src/preproc/refer/command.cc b/contrib/groff/src/preproc/refer/command.cc
index 004189e..bf88c89d 100644
--- a/contrib/groff/src/preproc/refer/command.cc
+++ b/contrib/groff/src/preproc/refer/command.cc
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2001 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -755,7 +755,8 @@ static int check_args(const char *types, const char *name,
static void execute_command(const char *name, int argc, argument *argv)
{
- for (int i = 0; i < sizeof(command_table)/sizeof(command_table[0]); i++)
+ for (unsigned int i = 0;
+ i < sizeof(command_table)/sizeof(command_table[0]); i++)
if (strcmp(name, command_table[i].name) == 0) {
if (check_args(command_table[i].arg_types, name, argc, argv))
(*command_table[i].func)(argc, argv);
diff --git a/contrib/groff/src/preproc/refer/ref.cc b/contrib/groff/src/preproc/refer/ref.cc
index c3517b1..9c04078 100644
--- a/contrib/groff/src/preproc/refer/ref.cc
+++ b/contrib/groff/src/preproc/refer/ref.cc
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2001 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -327,13 +327,13 @@ void sortify_title(const char *s, int len, string &key)
break;
}
if (ptr < end) {
- int first_word_len = ptr - s - 1;
+ unsigned int first_word_len = ptr - s - 1;
const char *ae = articles.contents() + articles.length();
for (const char *a = articles.contents();
a < ae;
a = strchr(a, '\0') + 1)
if (first_word_len == strlen(a)) {
- int j;
+ unsigned int j;
for (j = 0; j < first_word_len; j++)
if (a[j] != cmlower(s[j]))
break;
@@ -951,7 +951,7 @@ static int find_month(const char *start, const char *end)
while (ptr < end && csalpha(*ptr))
ptr++;
if (ptr - start >= 3) {
- for (int i = 0; i < sizeof(months)/sizeof(months[0]); i++) {
+ for (unsigned int i = 0; i < sizeof(months)/sizeof(months[0]); i++) {
const char *q = months[i];
const char *p = start;
for (; p < ptr; p++, q++)
diff --git a/contrib/groff/src/preproc/refer/refer.cc b/contrib/groff/src/preproc/refer/refer.cc
index b6cefc5..c39def7 100644
--- a/contrib/groff/src/preproc/refer/refer.cc
+++ b/contrib/groff/src/preproc/refer/refer.cc
@@ -25,6 +25,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "search.h"
#include "command.h"
+extern "C" const char *Version_string;
+
const char PRE_LABEL_MARKER = '\013';
const char POST_LABEL_MARKER = '\014';
const char LABEL_MARKER = '\015'; // label_type is added on
@@ -344,7 +346,6 @@ int main(int argc, char **argv)
}
if (strcmp(opt,"-version")==0) {
case 'v':
- extern const char *Version_string;
printf("GNU refer (groff) version %s\n", Version_string);
exit(0);
break;
diff --git a/contrib/groff/src/preproc/refer/refer.man b/contrib/groff/src/preproc/refer/refer.man
index 13708cf..d8468bb 100644
--- a/contrib/groff/src/preproc/refer/refer.man
+++ b/contrib/groff/src/preproc/refer/refer.man
@@ -1,5 +1,5 @@
-.ig \"-*- nroff -*-
-Copyright (C) 1989-2000 Free Software Foundation, Inc.
+.ig
+Copyright (C) 1989-2000, 2001 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -1300,3 +1300,7 @@ In label expressions,
expressions are ignored inside
.BI . char
expressions.
+.
+.\" Local Variables:
+.\" mode: nroff
+.\" End:
diff --git a/contrib/groff/src/preproc/refer/token.cc b/contrib/groff/src/preproc/refer/token.cc
index 1cf6890..e9fac5d 100644
--- a/contrib/groff/src/preproc/refer/token.cc
+++ b/contrib/groff/src/preproc/refer/token.cc
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2001 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -181,7 +181,7 @@ const token_info *lookup_token(const char *start, const char *end)
for (;;) {
if (token_table[n].tok == 0)
break;
- if (strlen(token_table[n].tok) == end - start
+ if (strlen(token_table[n].tok) == size_t(end - start)
&& memcmp(token_table[n].tok, start, end - start) == 0)
return &(token_table[n].ti);
if (n == 0)
diff --git a/contrib/groff/src/preproc/soelim/soelim.cc b/contrib/groff/src/preproc/soelim/soelim.cc
index e05f240..a604004 100644
--- a/contrib/groff/src/preproc/soelim/soelim.cc
+++ b/contrib/groff/src/preproc/soelim/soelim.cc
@@ -30,12 +30,13 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "stringclass.h"
#include "nonposix.h"
-static int include_list_length;
+static size_t include_list_length;
static char **include_list;
int compatible_flag = 0;
extern int interpret_lf_args(const char *);
+extern "C" const char *Version_string;
int do_file(const char *filename);
@@ -77,7 +78,6 @@ int main(int argc, char **argv)
switch (opt) {
case 'v':
{
- extern const char *Version_string;
printf("GNU soelim (groff) version %s\n", Version_string);
exit(0);
break;
@@ -183,18 +183,18 @@ int do_file(const char *filename)
{
char *path = include_list[j];
if (0 == strcmp(path, "."))
- whole_filename = filename;
+ whole_filename = filename;
else
- whole_filename = string(path) + "/" + filename;
+ whole_filename = string(path) + "/" + filename;
whole_filename += '\0';
errno = 0;
fp = fopen(whole_filename.contents(), "r");
if (fp != 0)
- break;
+ break;
if (errno != ENOENT) {
- error("can't open `%1': %2",
+ error("can't open `%1': %2",
whole_filename.contents(), strerror(errno));
- return 0;
+ return 0;
}
}
if (j >= include_list_length)
diff --git a/contrib/groff/src/preproc/soelim/soelim.man b/contrib/groff/src/preproc/soelim/soelim.man
index b97ea61..cf363d5 100644
--- a/contrib/groff/src/preproc/soelim/soelim.man
+++ b/contrib/groff/src/preproc/soelim/soelim.man
@@ -1,5 +1,5 @@
-.ig \"-*- nroff -*-
-Copyright (C) 1989-2000 Free Software Foundation, Inc.
+.ig
+Copyright (C) 1989-2000, 2001 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -83,3 +83,7 @@ No directory search is performed for files specified using an absolute path.
Print the version number.
.SH "SEE ALSO"
.BR groff (@MAN1EXT@)
+.
+.\" Local Variables:
+.\" mode: nroff
+.\" End:
diff --git a/contrib/groff/src/preproc/tbl/main.cc b/contrib/groff/src/preproc/tbl/main.cc
index a08ea0b..b1b14a7 100644
--- a/contrib/groff/src/preproc/tbl/main.cc
+++ b/contrib/groff/src/preproc/tbl/main.cc
@@ -25,6 +25,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define MAX_POINT_SIZE 99
#define MAX_VERTICAL_SPACING 72
+extern "C" const char *Version_string;
+
static int compatible_flag = 0;
class table_input {
@@ -731,7 +733,7 @@ format *process_format(table_input &in, options *opt,
int pre_vline = 0;
int got_format = 0;
int got_period = 0;
- format_type t;
+ format_type t = FORMAT_LEFT;
for (;;) {
if (c == EOF) {
error("end of input while processing format");
@@ -1470,7 +1472,6 @@ int main(int argc, char **argv)
break;
case 'v':
{
- extern const char *Version_string;
printf("GNU tbl (groff) version %s\n", Version_string);
exit(0);
break;
diff --git a/contrib/groff/src/preproc/tbl/tbl.man b/contrib/groff/src/preproc/tbl/tbl.man
index 6016ddf..42dac25 100644
--- a/contrib/groff/src/preproc/tbl/tbl.man
+++ b/contrib/groff/src/preproc/tbl/tbl.man
@@ -1,5 +1,5 @@
-.ig \"-*- nroff -*-
-Copyright (C) 1989-1995 Free Software Foundation, Inc.
+.ig
+Copyright (C) 1989-1995, 2001 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -176,3 +176,7 @@ A\e*a;B
.SH "SEE ALSO"
.BR groff (@MAN1EXT@),
.BR @g@troff (@MAN1EXT@)
+.
+.\" Local Variables:
+.\" mode: nroff
+.\" End:
diff --git a/contrib/groff/src/roff/groff/groff.cc b/contrib/groff/src/roff/groff/groff.cc
index aaca4e1..7e95c33 100644
--- a/contrib/groff/src/roff/groff/groff.cc
+++ b/contrib/groff/src/roff/groff/groff.cc
@@ -82,6 +82,8 @@ public:
void print(int is_last, FILE *fp);
};
+extern "C" const char *Version_string;
+
int lflag = 0;
char *spooler = 0;
char *postdriver = 0;
@@ -175,7 +177,6 @@ int main(int argc, char **argv)
case 'v':
vflag = 1;
{
- extern const char *Version_string;
printf("GNU groff version %s\n", Version_string);
printf("Copyright (C) 1989-2001 Free Software Foundation, Inc.\n"
"GNU groff comes with ABSOLUTELY NO WARRANTY.\n"
diff --git a/contrib/groff/src/roff/groff/pipeline.c b/contrib/groff/src/roff/groff/pipeline.c
index a4573ba..f26608f 100644
--- a/contrib/groff/src/roff/groff/pipeline.c
+++ b/contrib/groff/src/roff/groff/pipeline.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001
+ Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -34,7 +35,11 @@ Compile options are:
#include <unistd.h>
#endif
+#ifdef HAVE_STRERROR
+#include <string.h>
+#else
extern char *strerror();
+#endif
#ifdef _POSIX_VERSION
@@ -98,7 +103,8 @@ static char *i_to_a P((int));
have a workable groff by using the good-ole DOS pipe simulation
via temporary files... */
-#if defined(__MSDOS__) || (defined(_WIN32) && !defined(__CYGWIN32__))
+#if defined(__MSDOS__) \
+ || (defined(_WIN32) && !defined(_UWIN) && !defined(__CYGWIN32__))
#include <process.h>
#include <fcntl.h>
diff --git a/contrib/groff/src/roff/grog/Makefile.sub b/contrib/groff/src/roff/grog/Makefile.sub
index 054d06e..85e2ad5 100644
--- a/contrib/groff/src/roff/grog/Makefile.sub
+++ b/contrib/groff/src/roff/grog/Makefile.sub
@@ -1,6 +1,5 @@
MAN1=grog.n
CLEANADD=grog
-NAMEPREFIX=$(g)
all: grog
diff --git a/contrib/groff/src/roff/grog/grog.man b/contrib/groff/src/roff/grog/grog.man
index 4a2d311..8cd0bb2 100644
--- a/contrib/groff/src/roff/grog/grog.man
+++ b/contrib/groff/src/roff/grog/grog.man
@@ -1,5 +1,5 @@
-.ig \"-*- nroff -*-
-Copyright (C) 1989-2000 Free Software Foundation, Inc.
+.ig
+Copyright (C) 1989-2000, 2001 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -84,3 +84,7 @@ option.
.BR @g@grn (@MAN1EXT@),
.BR grap (1),
.BR @g@soelim (@MAN1EXT@)
+.
+.\" Local Variables:
+.\" mode: nroff
+.\" End:
diff --git a/contrib/groff/src/roff/grog/grog.pl b/contrib/groff/src/roff/grog/grog.pl
index 57cd159..a61106c 100644
--- a/contrib/groff/src/roff/grog/grog.pl
+++ b/contrib/groff/src/roff/grog/grog.pl
@@ -113,9 +113,36 @@ sub process {
# closed by `Oc'.
elsif (/^\.Oo$sp/) {
$Oo++;
+ s/^\.Oo/\. /;
+ redo;
+ }
+ # The test for `Oo' and `Oc' not starting a line (as allowed by the
+ # new implementation of -mdoc) is not complete; it assumes that
+ # macro arguments are well behaved, i.e., "" is used within "..." to
+ # indicate a doublequote as a string element, and weird features
+ # like `.foo a"b' are not used.
+ elsif (/^\..* Oo( |$)/) {
+ s/\\\".*//;
+ s/\"[^\"]*\"//g;
+ s/\".*//;
+ if (s/ Oo( |$)/ /) {
+ $Oo++;
+ }
+ redo;
}
elsif (/^\.Oc$sp/) {
$Oo--;
+ s/^\.Oc/\. /;
+ redo;
+ }
+ elsif (/^\..* Oc( |$)/) {
+ s/\\\".*//;
+ s/\"[^\"]*\"//g;
+ s/\".*//;
+ if (s/ Oc( |$)/ /) {
+ $Oo--;
+ }
+ redo;
}
if (/^\.so$sp/) {
chop;
diff --git a/contrib/groff/src/roff/grog/grog.sh b/contrib/groff/src/roff/grog/grog.sh
index 7919dbf..ae269af 100644
--- a/contrib/groff/src/roff/grog/grog.sh
+++ b/contrib/groff/src/roff/grog/grog.sh
@@ -29,12 +29,12 @@ do
esac
done
-egrep -h "^\.(P|PS|[PLI]P|[pnil]p|sh|Dd|Tp|Dp|De|Cx|Cl|Oo|Oc|TS|EQ|TH|SH|so|\[|R1|GS|G1|PH|SA)$sp" $* \
+egrep -h "^\.(P|PS|[PLI]P|[pnil]p|sh|Dd|Tp|Dp|De|Cx|Cl|Oo|.* Oo|Oc|.* Oc|TS|EQ|TH|SH|so|\[|R1|GS|G1|PH|SA)$sp" $* \
| sed -e '/^\.so/s/^.*$/.SO_START\
&\
.SO_END/' \
| $soelim \
-| egrep '^\.(P|PS|[PLI]P|[pnil]p|sh|Dd|Tp|Dp|De|Cx|Cl|Oo|Oc|TS|EQ|TH|SH|\[|R1|GS|G1|PH|SA|SO_START|SO_END)' \
+| egrep '^\.(P|PS|[PLI]P|[pnil]p|sh|Dd|Tp|Dp|De|Cx|Cl|Oo|.* Oo|Oc|.* Oc|TS|EQ|TH|SH|\[|R1|GS|G1|PH|SA|SO_START|SO_END)' \
| awk '
/^\.SO_START$/ { so = 1 }
/^\.SO_END$/ { so = 0 }
@@ -52,8 +52,23 @@ egrep -h "^\.(P|PS|[PLI]P|[pnil]p|sh|Dd|Tp|Dp|De|Cx|Cl|Oo|Oc|TS|EQ|TH|SH|so|\[|R
/^\.([pnil]p|sh)/ { me++ }
/^\.Dd/ { mdoc++ }
/^\.(Tp|Dp|De|Cx|Cl)/ { mdoc_old++ }
-/^\.Oo/ { Oo++ }
-/^\.Oc/ { Oo-- }
+/^\.(O[oc]|.* O[oc]( |$))/ {
+ sub(/\\\".*/, "")
+ gsub(/\"[^\"]*\"/, "")
+ sub(/\".*/, "")
+ sub(/^\.Oo/, " Oo ")
+ sub(/^\.Oc/, " Oc ")
+ sub(/ Oo$/, " Oo ")
+ sub(/ Oc$/, " Oc ")
+ while (/ Oo /) {
+ sub(/ Oo /, " ")
+ Oo++
+ }
+ while (/ Oc /) {
+ sub(/ Oc /, " ")
+ Oo--
+ }
+}
END {
if (files ~ /^-/)
diff --git a/contrib/groff/src/roff/troff/dictionary.cc b/contrib/groff/src/roff/troff/dictionary.cc
index 169536c..bca3845 100644
--- a/contrib/groff/src/roff/troff/dictionary.cc
+++ b/contrib/groff/src/roff/troff/dictionary.cc
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2001 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -25,10 +25,10 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
// is `p' a good size for a hash table
-static int is_good_size(int p)
+static int is_good_size(unsigned int p)
{
- const int SMALL = 10;
- unsigned i;
+ const unsigned int SMALL = 10;
+ unsigned int i;
for (i = 2; i <= p/2; i++)
if (p % i == 0)
return 0;
diff --git a/contrib/groff/src/roff/troff/div.cc b/contrib/groff/src/roff/troff/div.cc
index 281c1af..c885ca8 100644
--- a/contrib/groff/src/roff/troff/div.cc
+++ b/contrib/groff/src/roff/troff/div.cc
@@ -49,7 +49,8 @@ static vunits truncated_space;
static vunits needed_space;
diversion::diversion(symbol s)
-: prev(0), nm(s), vertical_position(V0), high_water_mark(V0), marked_place(V0)
+: prev(0), nm(s), vertical_position(V0), high_water_mark(V0),
+ no_space_mode(0), marked_place(V0)
{
}
@@ -249,6 +250,7 @@ void macro_diversion::transparent_output(node *n)
void macro_diversion::output(node *nd, int retain_size,
vunits vs, vunits post_vs, hunits width)
{
+ no_space_mode = 0;
vertical_size v(vs, post_vs);
while (nd != 0) {
nd->set_vertical_size(&v);
@@ -316,7 +318,7 @@ top_level_diversion::top_level_diversion()
page_length(units_per_inch*11),
prev_page_offset(units_per_inch), page_offset(units_per_inch),
page_trap_list(0), have_next_page_number(0),
- ejecting_page(0), before_first_page(1), no_space_mode(0)
+ ejecting_page(0), before_first_page(1)
{
}
@@ -722,15 +724,13 @@ void begin_page()
void no_space()
{
- if (curdiv == topdiv)
- topdiv->no_space_mode = 1;
+ curdiv->no_space_mode = 1;
skip_line();
}
void restore_spacing()
{
- if (curdiv == topdiv)
- topdiv->no_space_mode = 0;
+ curdiv->no_space_mode = 0;
skip_line();
}
@@ -755,8 +755,8 @@ void space_request()
n = curenv->get_vertical_spacing();
while (!tok.newline() && !tok.eof())
tok.next();
- if (!unpostpone_traps())
- curdiv->space(n);
+ if (!unpostpone_traps() && !curdiv->no_space_mode)
+ curdiv->space(n);
else
// The line might have had line spacing that was truncated.
truncated_space += n;
@@ -767,9 +767,10 @@ void space_request()
void blank_line()
{
curenv->do_break();
- if (!trap_sprung_flag)
+ if (!trap_sprung_flag && !curdiv->no_space_mode) {
curdiv->space(curenv->get_vertical_spacing());
- else
+ curenv->add_html_tag(".sp", 1);
+ } else
truncated_space += curenv->get_vertical_spacing();
}
@@ -1114,6 +1115,23 @@ void nl_reg::set_value(units n)
topdiv->before_first_page = 2;
}
+class no_space_mode_reg : public reg {
+public:
+ int get_value(units *);
+ const char *get_string();
+};
+
+int no_space_mode_reg::get_value(units *val)
+{
+ *val = curdiv->no_space_mode;
+ return 1;
+}
+
+const char *no_space_mode_reg::get_string()
+{
+ return curdiv->no_space_mode ? "1" : "0";
+}
+
void init_div_requests()
{
init_request("wh", when_request);
@@ -1143,6 +1161,7 @@ void init_div_requests()
number_reg_dictionary.define(".z", new diversion_name_reg);
number_reg_dictionary.define(".o", new page_offset_reg);
number_reg_dictionary.define(".p", new page_length_reg);
+ number_reg_dictionary.define(".ns", new no_space_mode_reg);
number_reg_dictionary.define(".d", new vertical_position_reg);
number_reg_dictionary.define(".h", new high_water_mark_reg);
number_reg_dictionary.define(".t", new distance_to_next_trap_reg);
diff --git a/contrib/groff/src/roff/troff/div.h b/contrib/groff/src/roff/troff/div.h
index 83f9e33..3b726c3 100644
--- a/contrib/groff/src/roff/troff/div.h
+++ b/contrib/groff/src/roff/troff/div.h
@@ -33,6 +33,7 @@ protected:
vunits vertical_position;
vunits high_water_mark;
public:
+ int no_space_mode;
vunits marked_place;
diversion(symbol s = NULL_SYMBOL);
virtual ~diversion();
@@ -101,7 +102,6 @@ class top_level_diversion : public diversion {
int ejecting_page; // Is the current page being ejected?
public:
int before_first_page;
- int no_space_mode;
top_level_diversion();
void output(node *nd, int retain_size, vunits vs, vunits post_vs,
hunits width);
diff --git a/contrib/groff/src/roff/troff/env.cc b/contrib/groff/src/roff/troff/env.cc
index 56f357c..c0743441 100644
--- a/contrib/groff/src/roff/troff/env.cc
+++ b/contrib/groff/src/roff/troff/env.cc
@@ -1117,7 +1117,7 @@ void point_size()
void space_size()
{
int n;
- if (get_integer(&n) && !compatible_flag) {
+ if (get_integer(&n)) {
curenv->space_size = n;
if (has_arg() && get_integer(&n))
curenv->sentence_space_size = n;
@@ -2135,7 +2135,7 @@ void environment::add_html_tag_tabs()
}
}
-void environment::do_break()
+void environment::do_break(int spread)
{
if (curdiv == topdiv && topdiv->before_first_page) {
topdiv->begin_page();
@@ -2146,7 +2146,7 @@ void environment::do_break()
if (line) {
line = new space_node(H0, line); // this is so that hyphenation works
space_total++;
- possibly_break_line();
+ possibly_break_line(0, spread);
}
while (line != 0 && line->discardable()) {
width_total -= line->width();
@@ -2185,17 +2185,27 @@ int environment::is_empty()
return !current_tab && line == 0 && pending_lines == 0;
}
-void break_request()
+void do_break_request(int spread)
{
while (!tok.newline() && !tok.eof())
tok.next();
if (break_flag) {
- curenv->do_break();
+ curenv->do_break(spread);
curenv->add_html_tag(".br");
}
tok.next();
}
+void break_request()
+{
+ do_break_request(0);
+}
+
+void break_spread_request()
+{
+ do_break_request(1);
+}
+
void title()
{
if (curdiv == topdiv && topdiv->before_first_page) {
@@ -3014,6 +3024,7 @@ void init_env_requests()
init_request("cc", control_char);
init_request("c2", no_break_control_char);
init_request("br", break_request);
+ init_request("brp", break_spread_request);
init_request("tl", title);
init_request("ta", set_tabs);
init_request("linetabs", line_tabs_request);
diff --git a/contrib/groff/src/roff/troff/env.h b/contrib/groff/src/roff/troff/env.h
index 256db51..851a9a0 100644
--- a/contrib/groff/src/roff/troff/env.h
+++ b/contrib/groff/src/roff/troff/env.h
@@ -275,7 +275,7 @@ public:
void interrupt();
void spread() { spread_flag = 1; }
void possibly_break_line(int start_here = 0, int forced = 0);
- void do_break(); // .br
+ void do_break(int spread = 0); // .br
void final_break();
void add_html_tag_eol();
void add_html_tag(const char *);
@@ -345,6 +345,5 @@ void init_environments();
void read_hyphen_file(const char *name);
extern int break_flag;
-extern int compatible_flag;
extern symbol default_family;
extern int translate_space_to_dummy;
diff --git a/contrib/groff/src/roff/troff/input.cc b/contrib/groff/src/roff/troff/input.cc
index 982e5bd..54aaa3f 100644
--- a/contrib/groff/src/roff/troff/input.cc
+++ b/contrib/groff/src/roff/troff/input.cc
@@ -73,6 +73,8 @@ extern "C" {
// initial size of buffer for reading names; expanded as necessary
#define ABUF_SIZE 16
+extern "C" const char *Version_string;
+
#ifdef COLUMN
void init_column_requests();
#endif /* COLUMN */
@@ -106,7 +108,7 @@ static void disable_warning(const char *);
static int escape_char = '\\';
static symbol end_macro_name;
static symbol blank_line_macro_name;
-int compatible_flag = 0;
+static int compatible_flag = 0;
int ascii_output_flag = 0;
int suppress_output_flag = 0;
int is_html = 0;
@@ -133,6 +135,7 @@ static void interpolate_arg(symbol);
static request_or_macro *lookup_request(symbol);
static int get_delim_number(units *, int);
static int get_delim_number(units *, int, units);
+static symbol get_delim_file_name();
static int get_line_arg(units *res, int si, charinfo **cp);
static int read_size(int *);
static symbol get_delim_name();
@@ -206,6 +209,8 @@ private:
virtual int internal_level() { return 0; }
virtual int is_file() { return 0; }
virtual int is_macro() { return 0; }
+ virtual void save_compatible_flag(int) {}
+ virtual int get_compatible_flag() { return 0; }
};
input_iterator::input_iterator()
@@ -406,6 +411,8 @@ public:
static int get_level();
static void clear();
static void pop_macro();
+ static void save_compatible_flag(int);
+ static int get_compatible_flag();
static int limit;
private:
@@ -626,6 +633,16 @@ void input_stack::pop_macro()
add_return_boundary();
}
+inline void input_stack::save_compatible_flag(int f)
+{
+ top->save_compatible_flag(f);
+}
+
+inline int input_stack::get_compatible_flag()
+{
+ return top->get_compatible_flag();
+}
+
void backtrace_request()
{
input_stack::backtrace_all();
@@ -1272,6 +1289,13 @@ void token::next()
if (cc != escape_char || escape_char == 0) {
handle_normal_char:
switch(cc) {
+ case COMPATIBLE_SAVE:
+ input_stack::save_compatible_flag(compatible_flag);
+ compatible_flag = 0;
+ continue;
+ case COMPATIBLE_RESTORE:
+ compatible_flag = input_stack::get_compatible_flag();
+ continue;
case EOF:
type = TOKEN_EOF;
return;
@@ -2049,14 +2073,14 @@ static void trapping_blank_line()
void do_request()
{
- int saved_compatible_flag = compatible_flag;
+ int old_compatible_flag = compatible_flag;
compatible_flag = 0;
symbol nm = get_name();
if (nm.is_null())
skip_line();
else
interpolate_macro(nm);
- compatible_flag = saved_compatible_flag;
+ compatible_flag = old_compatible_flag;
}
inline int possibly_handle_first_page_transition()
@@ -2701,6 +2725,7 @@ class string_iterator : public input_iterator {
char_block *bp;
int count; // of characters remaining
node *nd;
+ int saved_compatible_flag;
protected:
symbol nm;
string_iterator();
@@ -2710,6 +2735,8 @@ public:
int peek();
int get_location(int, const char **, int *);
void backtrace();
+ void save_compatible_flag(int f) { saved_compatible_flag = f; }
+ int get_compatible_flag() { return saved_compatible_flag; }
};
string_iterator::string_iterator(const macro &m, const char *p, symbol s)
@@ -3447,11 +3474,12 @@ void handle_initial_title()
static symbol dot_symbol(".");
enum define_mode { DEFINE_NORMAL, DEFINE_APPEND, DEFINE_IGNORE };
+enum calling_mode { CALLING_NORMAL, CALLING_INDIRECT, CALLING_DISABLE_COMP };
-void do_define_macro(define_mode mode, int indirect)
+void do_define_macro(define_mode mode, calling_mode calling)
{
symbol nm, term;
- if (indirect) {
+ if (calling == CALLING_INDIRECT) {
symbol temp1 = get_name(1);
if (temp1.is_null()) {
skip_line();
@@ -3497,6 +3525,8 @@ void do_define_macro(define_mode mode, int indirect)
mac = *mm;
}
int bol = 1;
+ if (calling == CALLING_DISABLE_COMP)
+ mac.append(COMPATIBLE_SAVE);
for (;;) {
while (c == ESCAPE_NEWLINE) {
if (mode == DEFINE_NORMAL || mode == DEFINE_APPEND)
@@ -3505,7 +3535,7 @@ void do_define_macro(define_mode mode, int indirect)
}
if (bol && c == '.') {
const char *s = term.contents();
- int d;
+ int d = 0;
// see if it matches term
int i;
for (i = 0; s[i] != 0; i++) {
@@ -3517,25 +3547,27 @@ void do_define_macro(define_mode mode, int indirect)
&& ((i == 2 && compatible_flag)
|| (d = get_copy(&n)) == ' '
|| d == '\n')) { // we found it
- if (d == '\n')
- tok.make_newline();
- else
- tok.make_space();
- if (mode == DEFINE_APPEND || mode == DEFINE_NORMAL) {
- if (!mm) {
- mm = new macro;
- request_dictionary.define(nm, mm);
- }
- *mm = mac;
- }
- if (term != dot_symbol) {
- ignoring = 0;
- interpolate_macro(term);
- }
- else
- skip_line();
- return;
- }
+ if (d == '\n')
+ tok.make_newline();
+ else
+ tok.make_space();
+ if (mode == DEFINE_APPEND || mode == DEFINE_NORMAL) {
+ if (!mm) {
+ mm = new macro;
+ request_dictionary.define(nm, mm);
+ }
+ if (calling == CALLING_DISABLE_COMP)
+ mac.append(COMPATIBLE_RESTORE);
+ *mm = mac;
+ }
+ if (term != dot_symbol) {
+ ignoring = 0;
+ interpolate_macro(term);
+ }
+ else
+ skip_line();
+ return;
+ }
if (mode == DEFINE_APPEND || mode == DEFINE_NORMAL) {
mac.append(c);
for (int j = 0; j < i; j++)
@@ -3575,23 +3607,33 @@ void do_define_macro(define_mode mode, int indirect)
void define_macro()
{
- do_define_macro(DEFINE_NORMAL, 0);
+ do_define_macro(DEFINE_NORMAL, CALLING_NORMAL);
+}
+
+void define_nocomp_macro()
+{
+ do_define_macro(DEFINE_NORMAL, CALLING_DISABLE_COMP);
}
void define_indirect_macro()
{
- do_define_macro(DEFINE_NORMAL, 1);
+ do_define_macro(DEFINE_NORMAL, CALLING_INDIRECT);
}
void append_macro()
{
- do_define_macro(DEFINE_APPEND, 0);
+ do_define_macro(DEFINE_APPEND, CALLING_NORMAL);
+}
+
+void append_nocomp_macro()
+{
+ do_define_macro(DEFINE_APPEND, CALLING_DISABLE_COMP);
}
void ignore()
{
ignoring = 1;
- do_define_macro(DEFINE_IGNORE, 0);
+ do_define_macro(DEFINE_IGNORE, CALLING_NORMAL);
ignoring = 0;
}
@@ -3954,6 +3996,11 @@ static int read_size(int *x)
if (!bad) {
switch (inc) {
case 0:
+ if (val == 0) {
+ // special case -- \s[0] and \s0 means to revert to previous size
+ *x = 0;
+ return 1;
+ }
*x = val;
break;
case 1:
@@ -3965,6 +4012,11 @@ static int read_size(int *x)
default:
assert(0);
}
+ if (*x <= 0) {
+ warning(WARN_RANGE,
+ "\\s request results in non-positive point size; set to 1");
+ *x = 1;
+ }
return 1;
}
else {
@@ -4033,6 +4085,65 @@ static symbol get_delim_name()
}
}
+static symbol get_delim_file_name()
+{
+ token start;
+ start.next();
+ if (start.eof()) {
+ error("end of input at start of delimited file name");
+ return NULL_SYMBOL;
+ }
+ if (start.newline()) {
+ error("can't delimit file name with a newline");
+ return NULL_SYMBOL;
+ }
+ int start_level = input_stack::get_level();
+ char abuf[ABUF_SIZE];
+ char *buf = abuf;
+ int buf_size = ABUF_SIZE;
+ int i = 0;
+ for (;;) {
+ if (i + 1 > buf_size) {
+ if (buf == abuf) {
+ buf = new char[ABUF_SIZE*2];
+ memcpy(buf, abuf, buf_size);
+ buf_size = ABUF_SIZE*2;
+ }
+ else {
+ char *old_buf = buf;
+ buf = new char[buf_size*2];
+ memcpy(buf, old_buf, buf_size);
+ buf_size *= 2;
+ a_delete old_buf;
+ }
+ }
+ tok.next();
+ if (tok.ch() == ']' && input_stack::get_level() == start_level)
+ break;
+ if ((buf[i] = tok.ch()) == 0) {
+ error("missing delimiter (got %1)", tok.description());
+ if (buf != abuf)
+ a_delete buf;
+ return NULL_SYMBOL;
+ }
+ i++;
+ }
+ buf[i] = '\0';
+ if (buf == abuf) {
+ if (i == 0) {
+ error("empty delimited file name");
+ return NULL_SYMBOL;
+ }
+ else
+ return symbol(buf);
+ }
+ else {
+ symbol s(buf);
+ a_delete buf;
+ return s;
+ }
+}
+
// Implement \R
static void do_register()
@@ -4273,6 +4384,14 @@ node *do_suppress()
{
tok.next();
int c = tok.ch();
+ if (c != '[') {
+ error("argument(s) of \\O must be enclosed in brackets (got %1)",
+ char(c));
+ return 0;
+ }
+ tok.next();
+ c = tok.ch();
+ tok.next();
switch (c) {
case '0':
if (begin_level == 1)
@@ -4293,7 +4412,12 @@ node *do_suppress()
begin_level--;
break;
case '5': {
- symbol filename = get_delim_name();
+ symbol filename = get_delim_file_name();
+ tok.next();
+ if (filename.is_null()) {
+ error("missing filename as second argument to \\O");
+ return 0;
+ }
if (begin_level == 1)
return new suppress_node(filename, 'i');
return 0;
@@ -6034,12 +6158,14 @@ struct string_list {
string_list(const char *ss) : s(ss), next(0) {}
};
+#if 0
static void prepend_string(const char *s, string_list **p)
{
string_list *l = new string_list(s);
l->next = *p;
*p = l;
}
+#endif
static void add_string(const char *s, string_list **p)
{
@@ -6095,7 +6221,6 @@ int main(int argc, char **argv)
switch(c) {
case 'v':
{
- extern const char *Version_string;
printf("GNU troff (groff) version %s\n", Version_string);
exit(0);
break;
@@ -6346,7 +6471,9 @@ void init_input_requests()
init_request("as", append_string);
init_request("de", define_macro);
init_request("dei", define_indirect_macro);
+ init_request("de1", define_nocomp_macro);
init_request("am", append_macro);
+ init_request("am1", append_nocomp_macro);
init_request("ig", ignore);
init_request("rm", remove_macro);
init_request("rn", rename_macro);
@@ -6638,7 +6765,7 @@ static struct {
static int lookup_warning(const char *name)
{
- for (int i = 0;
+ for (unsigned int i = 0;
i < sizeof(warning_table)/sizeof(warning_table[0]);
i++)
if (strcmp(name, warning_table[i].name) == 0)
diff --git a/contrib/groff/src/roff/troff/input.h b/contrib/groff/src/roff/troff/input.h
index 525e1ef..8d06574 100644
--- a/contrib/groff/src/roff/troff/input.h
+++ b/contrib/groff/src/roff/troff/input.h
@@ -54,6 +54,8 @@ const int LAST_PAGE_EJECTOR = 0205;
const int ESCAPE_RIGHT_PARENTHESIS = 0206;
const int ESCAPE_TILDE = 0207;
const int ESCAPE_COLON = 0210;
+const int COMPATIBLE_SAVE = 0211;
+const int COMPATIBLE_RESTORE = 0212;
#else /* IS_EBCDIC_HOST */
@@ -88,5 +90,7 @@ const int LAST_PAGE_EJECTOR = 065;
const int ESCAPE_RIGHT_PARENTHESIS = 066;
const int ESCAPE_TILDE = 067;
const int ESCAPE_COLON = 070;
+const int COMPATIBLE_SAVE = 071;
+const int COMPATIBLE_RESTORE = 072;
#endif /* IS_EBCDIC_HOST */
diff --git a/contrib/groff/src/roff/troff/node.h b/contrib/groff/src/roff/troff/node.h
index 1dc0718..a58afed 100644
--- a/contrib/groff/src/roff/troff/node.h
+++ b/contrib/groff/src/roff/troff/node.h
@@ -181,9 +181,9 @@ public:
};
struct width_list {
- width_list *next;
hunits width;
hunits sentence_width;
+ width_list *next;
width_list(hunits, hunits);
width_list(width_list *);
};
diff --git a/contrib/groff/src/roff/troff/reg.cc b/contrib/groff/src/roff/troff/reg.cc
index 254b0ff..8ac20c9 100644
--- a/contrib/groff/src/roff/troff/reg.cc
+++ b/contrib/groff/src/roff/troff/reg.cc
@@ -1,5 +1,6 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001
+ Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -87,7 +88,7 @@ static const char *number_value_to_ascii(int value, char format, int width)
case '1':
if (width <= 0)
return i_to_a(value);
- else if (width > sizeof(buf) - 2)
+ else if (width > int(sizeof(buf) - 2))
sprintf(buf, "%.*d", int(sizeof(buf) - 2), int(value));
else
sprintf(buf, "%.*d", width, int(value));
diff --git a/contrib/groff/src/roff/troff/token.h b/contrib/groff/src/roff/troff/token.h
index 40283ad..b87a0b1 100644
--- a/contrib/groff/src/roff/troff/token.h
+++ b/contrib/groff/src/roff/troff/token.h
@@ -72,7 +72,7 @@ public:
int space(); // is the current token a space?
int stretchable_space(); // is the current token a stretchable space?
int white_space(); // is the current token space or tab?
- int special(); // is the current token a special character?
+ int special(); // is the current token a special character?
int newline(); // is the current token a newline?
int tab(); // is the current token a tab?
int leader();
diff --git a/contrib/groff/src/roff/troff/troff.man b/contrib/groff/src/roff/troff/troff.man
index 7fe052b..ac746dc 100644
--- a/contrib/groff/src/roff/troff/troff.man
+++ b/contrib/groff/src/roff/troff/troff.man
@@ -1,4 +1,4 @@
-.ig \"-*- nroff -*-
+.ig
Copyright (C) 1989-2000, 2001 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
@@ -739,6 +739,12 @@ requests only create a new object if the name of the macro, diversion
or string diversion is currently undefined or if it is defined to be a
request; normally they modify the value of an existing object.
.TP
+.BI .am1\ xx\ yy
+Similar to
+.BR .am ,
+but compatibility mode is switched off during execution.
+On entry, the current compatibility mode is saved and restored at exit.
+.TP
.BI .asciify\ xx
This request `unformats' the diversion
.I xx
@@ -810,6 +816,10 @@ Be sure not to confuse this with the
.B br
request.
.TP
+.B .brp
+This is the same as
+.BR \ep .
+.TP
.BI .cflags\ n\ c1\ c2\|.\|.\|.
Characters
.IR c1 ,
@@ -966,6 +976,12 @@ is equivalent to
\&.de aa bb
.RE
.TP
+.BI .de1\ xx\ yy
+Similar to
+.BR .de ,
+but compatibility mode is switched off during execution.
+On entry, the current compatibility mode is saved and restored at exit.
+.TP
.BI .do\ xxx
Interpret
.I .xxx
@@ -1709,8 +1725,7 @@ one twelfth of the spacewidth parameter for the current font.
Initially both the word space size and the sentence
space size are 12.
Contrary to UNIX troff, GNU troff handles this request in nroff mode
-also (if not in compatibility mode); a given value is then rounded down
-to the nearest multiple of\~12.
+also; a given value is then rounded down to the nearest multiple of\~12.
The sentence space size is used in two circumstances:
if the end of a sentence occurs at the end of a line in fill mode, then
both an inter-word space and a sentence space will be added;
@@ -1857,6 +1872,12 @@ Useful in conjunction with the
.B \en[.trunc]
register.
.TP
+.B \en[.ns]
+.B 1
+if no-space mode is active,
+.B 0
+otherwise.
+.TP
.B \en[.pn]
The number of the next page:
either the value set by a
@@ -2445,6 +2466,10 @@ necessary.
.SH "SEE ALSO"
.
.
+.BR groff (@MAN7EXT@)
+-- This is a short but complete reference of all requests, registers, and
+escapes.
+.PP
.BR groff (@MAN1EXT@),
.BR @g@tbl (@MAN1EXT@),
.BR @g@pic (@MAN1EXT@),
@@ -2460,3 +2485,7 @@ necessary.
.BR groff_font (@MAN5EXT@),
.BR groff_out (@MAN5EXT@),
.BR groff_char (@MAN7EXT@)
+.
+.\" Local Variables:
+.\" mode: nroff
+.\" End:
diff --git a/contrib/groff/src/utils/addftinfo/addftinfo.cc b/contrib/groff/src/utils/addftinfo/addftinfo.cc
index 43a81bc..eb222d9 100644
--- a/contrib/groff/src/utils/addftinfo/addftinfo.cc
+++ b/contrib/groff/src/utils/addftinfo/addftinfo.cc
@@ -31,6 +31,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "cset.h"
#include "guess.h"
+extern "C" const char *Version_string;
+
static void usage(FILE *stream);
static void usage();
static void version();
@@ -67,7 +69,8 @@ static struct {
int main(int argc, char **argv)
{
program_name = argv[0];
- for (int i = 1; i < argc; i++) {
+ int i;
+ for (i = 1; i < argc; i++) {
if (!strcmp(argv[i], "-v") || !strcmp(argv[i],"--version"))
version();
if (!strcmp(argv[i],"--help")) {
@@ -99,7 +102,6 @@ int main(int argc, char **argv)
param.comma_depth = DEFAULT_COMMA_DEPTH;
param.desc_depth = DEFAULT_DESC_DEPTH;
param.body_depth = DEFAULT_BODY_DEPTH;
- int i;
for (i = 1; i < argc && argv[i][0] == '-'; i++) {
if (argv[i][1] == '-' && argv[i][2] == '\0') {
i++;
@@ -107,7 +109,7 @@ int main(int argc, char **argv)
}
if (i + 1 >= argc)
usage();
- int j;
+ size_t j;
for (j = 0;; j++) {
if (j >= sizeof(param_table)/sizeof(param_table[0]))
fatal("parameter `%1' not recognized", argv[i] + 1);
@@ -142,7 +144,6 @@ static void usage()
static void version()
{
- extern const char *Version_string;
printf("GNU addftinfo (groff) version %s\n", Version_string);
exit(0);
}
diff --git a/contrib/groff/src/utils/addftinfo/addftinfo.man b/contrib/groff/src/utils/addftinfo/addftinfo.man
index 921f633..a9b8455 100644
--- a/contrib/groff/src/utils/addftinfo/addftinfo.man
+++ b/contrib/groff/src/utils/addftinfo/addftinfo.man
@@ -1,5 +1,5 @@
-.ig \"-*- nroff -*-
-Copyright (C) 1989-2000 Free Software Foundation, Inc.
+.ig
+Copyright (C) 1989-2000, 2001 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -105,3 +105,7 @@ a Times font.
.BR groff_font (@MAN5EXT@),
.BR groff (@MAN1EXT@),
.BR groff_char (@MAN7EXT@)
+.
+.\" Local Variables:
+.\" mode: nroff
+.\" End:
diff --git a/contrib/groff/src/utils/afmtodit/afmtodit.man b/contrib/groff/src/utils/afmtodit/afmtodit.man
index 03a6e5c..585c229 100644
--- a/contrib/groff/src/utils/afmtodit/afmtodit.man
+++ b/contrib/groff/src/utils/afmtodit/afmtodit.man
@@ -1,5 +1,5 @@
-.ig \"-*- nroff -*-
-Copyright (C) 1989-2000 Free Software Foundation, Inc.
+.ig
+Copyright (C) 1989-2000, 2001 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -223,3 +223,7 @@ Standard mapping.
.BR grops (@MAN1EXT@),
.BR groff_font (@MAN5EXT@),
.BR perl (1)
+.
+.\" Local Variables:
+.\" mode: nroff
+.\" End:
diff --git a/contrib/groff/src/utils/afmtodit/afmtodit.pl b/contrib/groff/src/utils/afmtodit/afmtodit.pl
index 661245a..bfc058a 100644
--- a/contrib/groff/src/utils/afmtodit/afmtodit.pl
+++ b/contrib/groff/src/utils/afmtodit/afmtodit.pl
@@ -25,7 +25,7 @@ $prog =~ s@.*/@@;
do 'getopts.pl';
do Getopts('ve:sd:i:a:n');
-if (opt_v) {
+if ($opt_v) {
print "GNU afmtodit (groff) version @VERSION@\n";
exit 0;
}
diff --git a/contrib/groff/src/utils/hpftodit/hpftodit.cc b/contrib/groff/src/utils/hpftodit/hpftodit.cc
index f81f5ad..15f6f7f 100644
--- a/contrib/groff/src/utils/hpftodit/hpftodit.cc
+++ b/contrib/groff/src/utils/hpftodit/hpftodit.cc
@@ -41,6 +41,8 @@ put filename in error messages (or fix lib)
#include "cset.h"
#include "nonposix.h"
+extern "C" const char *Version_string;
+
#define SIZEOF(v) (sizeof(v)/sizeof(v[0]))
const int MULTIPLIER = 3;
@@ -163,10 +165,10 @@ entry tags[max_tag + 1 - min_tag];
char_info *char_table;
uint32 nchars;
-int msl_name_table_size = 0;
+unsigned int msl_name_table_size = 0;
name_list **msl_name_table = 0;
-int n_symbol_sets;
+unsigned int n_symbol_sets;
symbol_set *symbol_set_table;
static int special_flag = 0;
@@ -226,7 +228,6 @@ int main(int argc, char **argv)
break;
case 'v':
{
- extern const char *Version_string;
printf("GNU hpftodit (groff) version %s\n", Version_string);
exit(0);
}
@@ -337,7 +338,7 @@ void File::skip(int n)
void File::seek(uint32 n)
{
- if (end_ - buf_ < n)
+ if ((uint32)(end_ - buf_) < n)
fatal("unexpected end of file");
ptr_ = buf_ + n;
}
@@ -437,7 +438,7 @@ void read_symbol_sets(File &f)
uint32 symbol_set_dir_length = tag_info(symbol_set_tag).count;
n_symbol_sets = symbol_set_dir_length/14;
symbol_set_table = new symbol_set[n_symbol_sets];
- int i;
+ unsigned int i;
for (i = 0; i < n_symbol_sets; i++) {
f.seek(tag_info(symbol_set_tag).value + i*14);
(void)f.get_uint32();
@@ -445,7 +446,7 @@ void read_symbol_sets(File &f)
uint32 off2 = f.get_uint32();
(void)f.get_uint16(); // what's this for?
f.seek(off1);
- int j;
+ unsigned int j;
uint16 kind = 0;
for (j = 0; j < off2 - off1; j++) {
unsigned char c = f.get_byte();
@@ -465,7 +466,7 @@ void read_symbol_sets(File &f)
? special_symbol_sets
: text_symbol_sets);
for (i = 0; symbol_set_selectors[i] != 0; i++) {
- int j;
+ unsigned int j;
for (j = 0; j < n_symbol_sets; j++)
if (symbol_set_table[j].select == symbol_set_selectors[i])
break;
@@ -610,13 +611,13 @@ void output_ligatures()
};
unsigned ligature_mask = 0;
- int i;
+ unsigned int i;
for (i = 0; i < nchars; i++) {
uint16 msl = char_table[i].msl;
if (msl < msl_name_table_size
&& char_table[i].symbol_set != NO_SYMBOL_SET) {
for (name_list *p = msl_name_table[msl]; p; p = p->next)
- for (int j = 0; j < SIZEOF(ligature_chars); j++)
+ for (unsigned int j = 0; j < SIZEOF(ligature_chars); j++)
if (strcmp(p->name, ligature_chars[j]) == 0) {
ligature_mask |= 1 << j;
break;
@@ -671,7 +672,7 @@ void output_charset()
require_tag(lower_descent_tag);
printf("charset\n");
- int i;
+ unsigned int i;
for (i = 0; i < nchars; i++) {
uint16 msl = char_table[i].msl;
if (msl < msl_name_table_size
@@ -782,7 +783,7 @@ int read_map(const char *file)
fclose(fp);
return 0;
}
- if (n >= msl_name_table_size) {
+ if ((size_t)n >= msl_name_table_size) {
size_t old_size = msl_name_table_size;
name_list **old_table = msl_name_table;
msl_name_table_size = n + 256;
diff --git a/contrib/groff/src/utils/hpftodit/hpftodit.man b/contrib/groff/src/utils/hpftodit/hpftodit.man
index d107e8c..b9ea522 100644
--- a/contrib/groff/src/utils/hpftodit/hpftodit.man
+++ b/contrib/groff/src/utils/hpftodit/hpftodit.man
@@ -1,5 +1,5 @@
-.ig \"-*- nroff -*-
-Copyright (C) 1994-2000 Free Software Foundation, Inc.
+.ig
+Copyright (C) 1994-2000, 2001 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -153,3 +153,7 @@ TrueType tfm files are not supported.
.BR groff (@MAN1EXT@),
.BR grolj4 (@MAN1EXT@),
.BR groff_font (@MAN5EXT@)
+.
+.\" Local Variables:
+.\" mode: nroff
+.\" End:
diff --git a/contrib/groff/src/utils/indxbib/Makefile.sub b/contrib/groff/src/utils/indxbib/Makefile.sub
index add99eb..f45a7a7 100644
--- a/contrib/groff/src/utils/indxbib/Makefile.sub
+++ b/contrib/groff/src/utils/indxbib/Makefile.sub
@@ -4,12 +4,10 @@ XLIBS=$(LIBBIB) $(LIBGROFF)
MLIB=$(LIBM)
OBJS=\
indxbib.o \
- dirnamemax.o \
signal.o
CCSRCS=\
$(srcdir)/indxbib.cc
CSRCS=\
- $(srcdir)/dirnamemax.c \
$(srcdir)/signal.c
NAMEPREFIX=$(g)
diff --git a/contrib/groff/src/utils/indxbib/indxbib.cc b/contrib/groff/src/utils/indxbib/indxbib.cc
index 99a6baf..4b2477f 100644
--- a/contrib/groff/src/utils/indxbib/indxbib.cc
+++ b/contrib/groff/src/utils/indxbib/indxbib.cc
@@ -37,12 +37,13 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "nonposix.h"
+extern "C" const char *Version_string;
+
+#ifndef HAVE_MKSTEMP_PROTO
extern "C" {
- // Solaris 2.5.1 has these functions,
- // but its stdlib.h fails to declare them.
- char *mktemp(char *);
- int mkstemp(char *);
+ extern int mkstemp(char *);
}
+#endif
#define DEFAULT_HASH_TABLE_SIZE 997
#define TEMP_INDEX_TEMPLATE "indxbibXXXXXX"
@@ -114,7 +115,6 @@ static char *get_cwd();
extern "C" {
void cleanup();
- long dir_name_max(const char *);
void catch_fatal_signals();
void ignore_fatal_signals();
}
@@ -179,12 +179,9 @@ int main(int argc, char **argv)
parser = do_whole_file;
break;
case 'v':
- {
- extern const char *Version_string;
- printf("GNU indxbib (groff) version %s\n", Version_string);
- exit(0);
- break;
- }
+ printf("GNU indxbib (groff) version %s\n", Version_string);
+ exit(0);
+ break;
case CHAR_MAX + 1: // --help
usage(stdout);
exit(0);
@@ -215,24 +212,24 @@ int main(int argc, char **argv)
basename = optind < argc ? argv[optind] : DEFAULT_INDEX_NAME;
const char *p = strrchr(basename, DIR_SEPS[0]), *p1;
const char *sep = &DIR_SEPS[1];
- while (*sep)
- {
- p1 = strrchr(basename, *sep);
- if (p1 && (!p || p1 > p))
- p = p1;
- sep++;
- }
- long name_max;
+ while (*sep) {
+ p1 = strrchr(basename, *sep);
+ if (p1 && (!p || p1 > p))
+ p = p1;
+ sep++;
+ }
+ size_t name_max;
if (p) {
char *dir = strsave(basename);
dir[p - basename] = '\0';
- name_max = dir_name_max(dir);
+ name_max = file_name_max(dir);
a_delete dir;
}
else
- name_max = dir_name_max(".");
+ name_max = file_name_max(".");
const char *filename = p ? p + 1 : basename;
- if (name_max >= 0 && strlen(filename) + sizeof(INDEX_SUFFIX) - 1 > name_max)
+ if (name_max >= 0 &&
+ long(strlen(filename) + sizeof(INDEX_SUFFIX) - 1) > name_max)
fatal("`%1.%2' is too long for a filename", filename, INDEX_SUFFIX);
if (p) {
p++;
@@ -303,23 +300,22 @@ int main(int argc, char **argv)
strcpy(index_file, basename);
strcat(index_file, INDEX_SUFFIX);
#ifdef HAVE_RENAME
- if (rename(temp_index_file, index_file) < 0)
- {
+ if (rename(temp_index_file, index_file) < 0) {
#ifdef __MSDOS__
- // RENAME could fail on plain MSDOS filesystems because
- // INDEX_FILE is an invalid filename, e.g. it has multiple dots.
- char *fname = p ? index_file + (p - basename) : 0;
- char *dot = 0;
-
- // Replace the dot with an underscore and try again.
- if (fname
- && (dot = strchr(fname, '.')) != 0
- && strcmp(dot, INDEX_SUFFIX) != 0)
- *dot = '_';
- if (rename(temp_index_file, index_file) < 0)
+ // RENAME could fail on plain MSDOS filesystems because
+ // INDEX_FILE is an invalid filename, e.g. it has multiple dots.
+ char *fname = p ? index_file + (p - basename) : 0;
+ char *dot = 0;
+
+ // Replace the dot with an underscore and try again.
+ if (fname
+ && (dot = strchr(fname, '.')) != 0
+ && strcmp(dot, INDEX_SUFFIX) != 0)
+ *dot = '_';
+ if (rename(temp_index_file, index_file) < 0)
#endif
- fatal("can't rename temporary index file: %1", strerror(errno));
- }
+ fatal("can't rename temporary index file: %1", strerror(errno));
+ }
#else /* not HAVE_RENAME */
ignore_fatal_signals();
if (unlink(index_file) < 0) {
@@ -502,7 +498,7 @@ static int do_file(const char *filename)
// every CR character before a Newline.
if (c == '\r') {
int peek = getc(fp);
- if (peek = '\n') {
+ if (peek == '\n') {
byte_count++;
c = peek;
}
@@ -784,7 +780,7 @@ static void write_hash_table()
static void fwrite_or_die(const void *ptr, int size, int nitems, FILE *fp)
{
- if (fwrite(ptr, size, nitems, fp) != nitems)
+ if (fwrite(ptr, size, nitems, fp) != (size_t)nitems)
fatal("fwrite failed: %1", strerror(errno));
}
diff --git a/contrib/groff/src/utils/indxbib/indxbib.man b/contrib/groff/src/utils/indxbib/indxbib.man
index ed84cca..a566029 100644
--- a/contrib/groff/src/utils/indxbib/indxbib.man
+++ b/contrib/groff/src/utils/indxbib/indxbib.man
@@ -1,5 +1,5 @@
-.ig \"-*- nroff -*-
-Copyright (C) 1989-2000 Free Software Foundation, Inc.
+.ig
+Copyright (C) 1989-2000, 2001 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -205,3 +205,7 @@ Temporary file.
.BR @g@refer (@MAN1EXT@),
.BR lkbib (@MAN1EXT@),
.BR @g@lookbib (@MAN1EXT@)
+.
+.\" Local Variables:
+.\" mode: nroff
+.\" End:
diff --git a/contrib/groff/src/utils/lkbib/lkbib.cc b/contrib/groff/src/utils/lkbib/lkbib.cc
index 4d3cadc..50e4e9b 100644
--- a/contrib/groff/src/utils/lkbib/lkbib.cc
+++ b/contrib/groff/src/utils/lkbib/lkbib.cc
@@ -18,8 +18,8 @@ You should have received a copy of the GNU General Public License along
with groff; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#include <stdlib.h>
#include <stdio.h>
+#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <assert.h>
@@ -32,6 +32,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "refid.h"
#include "search.h"
+extern "C" const char *Version_string;
+
static void usage(FILE *stream)
{
fprintf(stream, "usage: %s [-nv] [-p database] [-i XYZ] [-t N] keys ...\n",
@@ -78,7 +80,6 @@ int main(int argc, char **argv)
}
case 'v':
{
- extern const char *Version_string;
printf("GNU lkbib (groff) version %s\n", Version_string);
exit(0);
break;
@@ -126,7 +127,7 @@ int main(int argc, char **argv)
int len;
int count;
for (count = 0; iter.next(&start, &len); count++) {
- if (fwrite(start, 1, len, stdout) != len)
+ if (fwrite(start, 1, len, stdout) != (size_t)len)
fatal("write error on stdout: %1", strerror(errno));
// Can happen for last reference in file.
if (start[len - 1] != '\n')
diff --git a/contrib/groff/src/utils/lkbib/lkbib.man b/contrib/groff/src/utils/lkbib/lkbib.man
index 872313d..81067d1 100644
--- a/contrib/groff/src/utils/lkbib/lkbib.man
+++ b/contrib/groff/src/utils/lkbib/lkbib.man
@@ -1,5 +1,5 @@
-.ig \"-*- nroff -*-
-Copyright (C) 1989-2000 Free Software Foundation, Inc.
+.ig
+Copyright (C) 1989-2000, 2001 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -108,3 +108,7 @@ Index files.
.BR @g@refer (@MAN1EXT@),
.BR @g@lookbib (@MAN1EXT@),
.BR @g@indxbib (@MAN1EXT@)
+.
+.\" Local Variables:
+.\" mode: nroff
+.\" End:
diff --git a/contrib/groff/src/utils/lookbib/lookbib.cc b/contrib/groff/src/utils/lookbib/lookbib.cc
index dc55ed9..b742a4b 100644
--- a/contrib/groff/src/utils/lookbib/lookbib.cc
+++ b/contrib/groff/src/utils/lookbib/lookbib.cc
@@ -34,6 +34,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
extern "C" {
int isatty(int);
+ const char *Version_string;
}
static void usage(FILE *stream)
@@ -76,7 +77,6 @@ int main(int argc, char **argv)
}
case 'v':
{
- extern const char *Version_string;
printf("GNU lookbib (groff) version %s\n", Version_string);
exit(0);
break;
@@ -120,7 +120,7 @@ int main(int argc, char **argv)
int len;
int count;
for (count = 0; iter.next(&start, &len); count++) {
- if (fwrite(start, 1, len, stdout) != len)
+ if (fwrite(start, 1, len, stdout) != (size_t)len)
fatal("write error on stdout: %1", strerror(errno));
// Can happen for last reference in file.
if (start[len - 1] != '\n')
diff --git a/contrib/groff/src/utils/lookbib/lookbib.man b/contrib/groff/src/utils/lookbib/lookbib.man
index 846798d..3d8ba44 100644
--- a/contrib/groff/src/utils/lookbib/lookbib.man
+++ b/contrib/groff/src/utils/lookbib/lookbib.man
@@ -1,5 +1,5 @@
-.ig \"-*- nroff -*-
-Copyright (C) 1989-2000 Free Software Foundation, Inc.
+.ig
+Copyright (C) 1989-2000, 2001 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -76,3 +76,7 @@ Index files.
.BR @g@refer (@MAN1EXT@),
.BR lkbib (@MAN1EXT@),
.BR @g@indxbib (@MAN1EXT@)
+.
+.\" Local Variables:
+.\" mode: nroff
+.\" End:
diff --git a/contrib/groff/src/utils/pfbtops/pfbtops.c b/contrib/groff/src/utils/pfbtops/pfbtops.c
index 2159dbd..0964ede 100644
--- a/contrib/groff/src/utils/pfbtops/pfbtops.c
+++ b/contrib/groff/src/utils/pfbtops/pfbtops.c
@@ -1,3 +1,22 @@
+/* Copyright (C) 1992, 2001 Free Software Foundation, Inc.
+ Written by James Clark (jjc@jclark.com)
+
+This file is part of groff.
+
+groff 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.
+
+groff 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 groff; see the file COPYING. If not, write to the Free Software
+Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
/* This translates ps fonts in .pfb format to ASCII ps files. */
#include <stdio.h>
@@ -42,12 +61,12 @@ int main(argc, argv)
switch (opt) {
case 'v':
{
- extern char *Version_string;
+ extern const char *Version_string;
printf("GNU pfbtops (groff) version %s\n", Version_string);
exit(0);
break;
}
- case CHAR_MAX + 1: // --help
+ case CHAR_MAX + 1: /* --help */
usage(stdout);
exit(0);
break;
diff --git a/contrib/groff/src/utils/pfbtops/pfbtops.man b/contrib/groff/src/utils/pfbtops/pfbtops.man
index cfef3e0..9c7b2b8 100644
--- a/contrib/groff/src/utils/pfbtops/pfbtops.man
+++ b/contrib/groff/src/utils/pfbtops/pfbtops.man
@@ -1,5 +1,5 @@
-.ig \"-*- nroff -*-
-Copyright (C) 1989-1995 Free Software Foundation, Inc.
+.ig
+Copyright (C) 1989-1995, 2001 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -42,3 +42,7 @@ It must first be listed in
.BR @FONTDIR@/devps/download .
.SH "SEE ALSO"
.BR grops (@MAN1EXT@)
+.
+.\" Local Variables:
+.\" mode: nroff
+.\" End:
diff --git a/contrib/groff/src/utils/tfmtodit/tfmtodit.cc b/contrib/groff/src/utils/tfmtodit/tfmtodit.cc
index 96768d2..06b5d18 100644
--- a/contrib/groff/src/utils/tfmtodit/tfmtodit.cc
+++ b/contrib/groff/src/utils/tfmtodit/tfmtodit.cc
@@ -59,6 +59,8 @@ both be zero. */
#include "cset.h"
#include "nonposix.h"
+extern "C" const char *Version_string;
+
/* Values in the tfm file should be multiplied by this. */
#define MULTIPLIER 1
@@ -289,7 +291,7 @@ int tfm::load(const char *file)
int lf = (c1 << 8) + c2;
int toread = lf*4 - 2;
unsigned char *buf = new unsigned char[toread];
- if (fread(buf, 1, toread, fp) != toread) {
+ if (fread(buf, 1, toread, fp) != (size_t)toread) {
if (feof(fp))
error("unexpected end of file on `%1'", file);
else
@@ -491,7 +493,7 @@ int gf::load(const char *file)
if (len == EOF)
goto eof;
char buf[256];
- if (fread(buf, 1, len, fp) != len)
+ if (fread(buf, 1, len, fp) != (size_t)len)
goto eof;
if (len == 10 /* strlen("adjustment") */
&& memcmp(buf, "adjustment", len) == 0) {
@@ -717,7 +719,6 @@ int main(int argc, char **argv)
}
case 'v':
{
- extern const char *Version_string;
printf("GNU tfmtodit (groff) version %s\n", Version_string);
exit(0);
break;
@@ -786,12 +787,12 @@ int main(int argc, char **argv)
int xheight;
if (!t.get_param(5, &xheight))
xheight = 0;
- int i;
+ unsigned int i;
// Print the list of ligatures.
// First find the indices of each character that can participate in
// a ligature.
for (i = 0; i < 256; i++)
- for (int j = 0; j < sizeof(lig_chars)/sizeof(lig_chars[0]); j++)
+ for (unsigned int j = 0; j < sizeof(lig_chars)/sizeof(lig_chars[0]); j++)
for (char_list *p = table[i]; p; p = p->next)
if (strcmp(lig_chars[j].ch, p->ch) == 0)
lig_chars[j].i = i;
diff --git a/contrib/groff/src/utils/tfmtodit/tfmtodit.man b/contrib/groff/src/utils/tfmtodit/tfmtodit.man
index 6e50aa2..b141c77 100644
--- a/contrib/groff/src/utils/tfmtodit/tfmtodit.man
+++ b/contrib/groff/src/utils/tfmtodit/tfmtodit.man
@@ -1,5 +1,5 @@
-.ig \"-*- nroff -*-
-Copyright (C) 1989-2000 Free Software Foundation, Inc.
+.ig
+Copyright (C) 1989-2000, 2001 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -173,3 +173,7 @@ Font description file for font
.BR groff (@MAN1EXT@),
.BR grodvi (@MAN1EXT@),
.BR groff_font (@MAN5EXT@)
+.
+.\" Local Variables:
+.\" mode: nroff
+.\" End:
diff --git a/contrib/groff/src/xditview/ChangeLog b/contrib/groff/src/xditview/ChangeLog
index ef0a856..977a90c 100644
--- a/contrib/groff/src/xditview/ChangeLog
+++ b/contrib/groff/src/xditview/ChangeLog
@@ -1,3 +1,7 @@
+2001-04-21 Albert Chin-A-Young <china@thewrittenword.com>
+
+ * Imakefile.in: Add support for recent HP architectures.
+
2001-01-04 Rob Daasch <daasch@ece.pdx.edu>
* parse.c (ParseInput): Added 'F' to command switch to swallow
diff --git a/contrib/groff/src/xditview/Imakefile.in b/contrib/groff/src/xditview/Imakefile.in
index 3ad244d..01fab4f 100644
--- a/contrib/groff/src/xditview/Imakefile.in
+++ b/contrib/groff/src/xditview/Imakefile.in
@@ -19,7 +19,11 @@ PROGRAMS = \
gxditview \
xtotroff
DEPLIBS = XawClientDepLibs
+#if defined(HPArchitecture) && (OSMajorVersion > 9)
+LOCAL_LIBRARIES = -L/usr/contrib/X11R6/lib XawClientLibs
+#else
LOCAL_LIBRARIES = XawClientLibs
+#endif
SRCS1 = \
$(srcdir)/xditview.c \
$(srcdir)/Dvi.c \
@@ -50,9 +54,16 @@ OBJS2 = \
xtotroff.o \
XFontName.o \
DviChar.o
+#if defined(HPArchitecture) && (OSMajorVersion > 9)
INCLUDES = \
+ -I/usr/contrib/X11R6/include \
-I$(TOOLKITSRC) \
-I$(TOP)
+#else
+INCLUDES = \
+ -I$(TOOLKITSRC) \
+ -I$(TOP)
+#endif
MATHLIB = -lm
DEFINES = \
$(SIGNAL_DEFINES) \
diff --git a/contrib/groff/src/xditview/gxditview.man b/contrib/groff/src/xditview/gxditview.man
index 04cd446..8680001 100644
--- a/contrib/groff/src/xditview/gxditview.man
+++ b/contrib/groff/src/xditview/gxditview.man
@@ -1,4 +1,3 @@
-.\" -*- nroff -*-
.TH GXDITVIEW 1 "Release 5" "X Version 11"
.SH NAME
gxditview \- display gtroff output files
@@ -244,3 +243,7 @@ Malcolm Slaney (Schlumberger Palo Alto Research)
Mark Moraes (University of Toronto)
.br
James Clark
+.
+.\" Local Variables:
+.\" mode: nroff
+.\" End:
OpenPOWER on IntegriCloud