groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Groff-commit] groff ./ChangeLog ./configure ./configure.ac sr...


From: Werner LEMBERG
Subject: [Groff-commit] groff ./ChangeLog ./configure ./configure.ac sr...
Date: Thu, 25 Nov 2004 03:15:13 -0500

CVSROOT:        /cvsroot/groff
Module name:    groff
Branch:         
Changes by:     Werner LEMBERG <address@hidden> 04/11/25 08:08:33

Modified files:
        .              : ChangeLog configure configure.ac 
        src/devices/grohtml: grohtml.man 
        src/devices/xditview: Dvi.c Makefile.sub README 
        src/utils/lkbib: lkbib.man 
        src/utils/lookbib: lookbib.man 
        src/utils/pfbtops: pfbtops.man 
        src/utils/xtotroff: Makefile.sub xtotroff.c 
Added files:
        src/utils/xtotroff: Makefile.in xtotroff.man 

Log message:
        * src/utils/xtotroff/xtotroff.c: Reformat to be similar to other
        groff source files.
        Include config.h.
        Include limits.h.
        Remove X_NOT_STDC_ENV conditional.
        (Version_string, program_name): New global variables.
        (groff_flag): Removed.
        (MapFont): Updated.
        (usage): Take a stream as argument.
        Use `program_name'.
        Update all callers.
        (main): Add `long_options' array for `--help' and `--version'.
        Make `-g' a dummy option.
        Handle `-v' and unknown options.
        Remove unused `position' variable.
        
        * src/utils/xtotroff/Makefile.sub (MAN1): Define.
        (XLIBS): Add LIBGROFF.
        
        * src/utils/xtotroff/xtotroff.man, src/utils/xtotroff/Makefile.in:
        New files.
        
        * src/devices/xditview/Dvi.c (default_font_map): Split into three
        parts to avoid compiler warning.
        (resources): Don't initialize with `default_font_map'.
        (ClassInitialize): Initialize first element of `resources'.
        
        * src/devices/xditview/Makefile.sub (devdir, xtotroff, DPIS, fonts):
        Removed.
        
        * src/utils/lkbib/lkbib.man, src/utils/lookbib/lookbib.man,
        src/utils/pfbtops/pfbtops.man: Revised, updated.
        
        * configure.ac: Generate src/utils/xtotroff/Makefile.
        * configure: Regenerated.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/ChangeLog.diff?tr1=1.765&tr2=1.766&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/configure.diff?tr1=1.59&tr2=1.60&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/configure.ac.diff?tr1=1.28&tr2=1.29&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/src/devices/grohtml/grohtml.man.diff?tr1=1.21&tr2=1.22&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/src/devices/xditview/Dvi.c.diff?tr1=1.1.1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/src/devices/xditview/Makefile.sub.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/src/devices/xditview/README.diff?tr1=1.1.1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/src/utils/lkbib/lkbib.man.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/src/utils/lookbib/lookbib.man.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/src/utils/pfbtops/pfbtops.man.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/src/utils/xtotroff/Makefile.in?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/src/utils/xtotroff/xtotroff.man?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/src/utils/xtotroff/Makefile.sub.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/src/utils/xtotroff/xtotroff.c.diff?tr1=1.1.1.1&tr2=1.2&r1=text&r2=text

Patches:
Index: groff/ChangeLog
diff -u groff/ChangeLog:1.765 groff/ChangeLog:1.766
--- groff/ChangeLog:1.765       Wed Nov 24 15:42:09 2004
+++ groff/ChangeLog     Thu Nov 25 08:08:33 2004
@@ -1,3 +1,41 @@
+2004-11-25  Werner LEMBERG  <address@hidden>
+
+       * src/utils/xtotroff/xtotroff.c: Reformat to be similar to other
+       groff source files.
+       Include config.h.
+       Include limits.h.
+       Remove X_NOT_STDC_ENV conditional.
+       (Version_string, program_name): New global variables.
+       (groff_flag): Removed.
+       (MapFont): Updated.
+       (usage): Take a stream as argument.
+       Use `program_name'.
+       Update all callers.
+       (main): Add `long_options' array for `--help' and `--version'.
+       Make `-g' a dummy option.
+       Handle `-v' and unknown options.
+       Remove unused `position' variable.
+
+       * src/utils/xtotroff/Makefile.sub (MAN1): Define.
+       (XLIBS): Add LIBGROFF.
+
+       * src/utils/xtotroff/xtotroff.man, src/utils/xtotroff/Makefile.in:
+       New files.
+
+       * src/devices/xditview/Dvi.c (default_font_map): Split into three
+       parts to avoid compiler warning.
+       (resources): Don't initialize with `default_font_map'.
+       (ClassInitialize): Initialize first element of `resources'.
+
+       * src/devices/xditview/Makefile.sub (devdir, xtotroff, DPIS, fonts):
+       Removed.
+
+       * src/utils/lkbib/lkbib.man, src/utils/lookbib/lookbib.man,
+       src/utils/pfbtops/pfbtops.man: Revised, updated.
+
+       * configure.ac: Generate src/utils/xtotroff/Makefile.
+       * configure: Regenerated.
+
 2004-11-24  Werner LEMBERG  <address@hidden>
 
        First fixes to get produce HTML.
Index: groff/configure
diff -u groff/configure:1.59 groff/configure:1.60
--- groff/configure:1.59        Thu Oct  7 10:59:37 2004
+++ groff/configure     Thu Nov 25 08:08:33 2004
@@ -10092,7 +10092,7 @@
 
           ac_config_files="$ac_config_files stamp-h"
 
-                    ac_config_files="$ac_config_files Makefile doc/Makefile"
+                              ac_config_files="$ac_config_files Makefile 
doc/Makefile src/utils/xtotroff/Makefile"
 
           ac_config_files="$ac_config_files test-groff"
 
@@ -10607,6 +10607,7 @@
   "stamp-h" ) CONFIG_FILES="$CONFIG_FILES stamp-h" ;;
   "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
   "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
+  "src/utils/xtotroff/Makefile" ) CONFIG_FILES="$CONFIG_FILES 
src/utils/xtotroff/Makefile" ;;
   "test-groff" ) CONFIG_FILES="$CONFIG_FILES test-groff" ;;
   "src/include/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS 
src/include/config.h:src/include/config.hin" ;;
   *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
Index: groff/configure.ac
diff -u groff/configure.ac:1.28 groff/configure.ac:1.29
--- groff/configure.ac:1.28     Thu Oct  7 10:59:37 2004
+++ groff/configure.ac  Thu Nov 25 08:08:33 2004
@@ -95,7 +95,7 @@
 GROFF_GHOSTSCRIPT_PATH
 
 AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
-AC_CONFIG_FILES([Makefile doc/Makefile])
+AC_CONFIG_FILES([Makefile doc/Makefile src/utils/xtotroff/Makefile])
 AC_CONFIG_FILES([test-groff], [chmod +x test-groff])
 AC_OUTPUT
 
Index: groff/src/devices/grohtml/grohtml.man
diff -u groff/src/devices/grohtml/grohtml.man:1.21 
groff/src/devices/grohtml/grohtml.man:1.22
--- groff/src/devices/grohtml/grohtml.man:1.21  Tue Nov 23 23:42:02 2004
+++ groff/src/devices/grohtml/grohtml.man       Thu Nov 25 08:08:33 2004
@@ -248,7 +248,7 @@
 .BR B ,
 and
 .B BI
-mounted at font positions 1 to 4.
+mounted at font positions 1 to\~4.
 .
 .
 .SH DEPENDENCIES
Index: groff/src/devices/xditview/Dvi.c
diff -u groff/src/devices/xditview/Dvi.c:1.1.1.1 
groff/src/devices/xditview/Dvi.c:1.2
--- groff/src/devices/xditview/Dvi.c:1.1.1.1    Tue Jun  1 10:39:54 2004
+++ groff/src/devices/xditview/Dvi.c    Thu Nov 25 08:08:33 2004
@@ -30,7 +30,7 @@
 
 /* Private Data */
 
-static char default_font_map[] = "\
+static char default_font_map_1[] = "\
 TR     -adobe-times-medium-r-normal--*-100-*-*-*-*-iso8859-1\n\
 TI     -adobe-times-medium-i-normal--*-100-*-*-*-*-iso8859-1\n\
 TB     -adobe-times-bold-r-normal--*-100-*-*-*-*-iso8859-1\n\
@@ -39,10 +39,14 @@
 CI     -adobe-courier-medium-o-normal--*-100-*-*-*-*-iso8859-1\n\
 CB     -adobe-courier-bold-r-normal--*-100-*-*-*-*-iso8859-1\n\
 CBI    -adobe-courier-bold-o-normal--*-100-*-*-*-*-iso8859-1\n\
+";
+static char default_font_map_2[] = "\
 HR     -adobe-helvetica-medium-r-normal--*-100-*-*-*-*-iso8859-1\n\
 HI     -adobe-helvetica-medium-o-normal--*-100-*-*-*-*-iso8859-1\n\
 HB     -adobe-helvetica-bold-r-normal--*-100-*-*-*-*-iso8859-1\n\
 HBI    -adobe-helvetica-bold-o-normal--*-100-*-*-*-*-iso8859-1\n\
+";
+static char default_font_map_3[] = "\
 NR     -adobe-new century 
schoolbook-medium-r-normal--*-100-*-*-*-*-iso8859-1\n\
 NI     -adobe-new century 
schoolbook-medium-i-normal--*-100-*-*-*-*-iso8859-1\n\
 NB     -adobe-new century schoolbook-bold-r-normal--*-100-*-*-*-*-iso8859-1\n\
@@ -59,7 +63,7 @@
 static XtResource resources[] = { 
        {(String)XtNfontMap, (String)XtCFontMap, (String)XtRString,
         sizeof (char *), offset(dvi.font_map_string),
-        (String)XtRString, (XtPointer)default_font_map},
+        (String)XtRString, NULL /* set in code */},
        {(String)XtNforeground, (String)XtCForeground, (String)XtRPixel,
         sizeof (unsigned long), offset(dvi.foreground),
         (String)XtRString, (XtPointer)"XtDefaultForeground"},
@@ -169,6 +173,16 @@
 
 static void ClassInitialize (void)
 {
+       int len1 = strlen(default_font_map_1);
+       int len2 = strlen(default_font_map_2);
+       int len3 = strlen(default_font_map_3);
+       char *dfm = XtMalloc(len1 + len2 + len3 + 1);
+       char *ptr = dfm;
+       strcpy(ptr, default_font_map_1); ptr += len1;
+       strcpy(ptr, default_font_map_2); ptr += len2;
+       strcpy(ptr, default_font_map_3);
+       resources[0].default_addr = dfm;
+
        XtAddConverter( XtRString, XtRBackingStore, XmuCvtStringToBackingStore,
                        NULL, 0 );
 }
Index: groff/src/devices/xditview/Makefile.sub
diff -u groff/src/devices/xditview/Makefile.sub:1.3 
groff/src/devices/xditview/Makefile.sub:1.4
--- groff/src/devices/xditview/Makefile.sub:1.3 Thu Jun  3 20:15:13 2004
+++ groff/src/devices/xditview/Makefile.sub     Thu Nov 25 08:08:33 2004
@@ -36,10 +36,6 @@
        @-rm -f $@
        $(SHELL) $(srcdir)/ad2c $(srcdir)/GXditview.ad >GXditview-ad.h
 
-devdir=$(top_builddir)/font
-xtotroff=$(top_builddir)/src/utils/xtotroff/xtotroff
-DPIS=75 100
-
 install_data: $(srcdir)/GXditview.ad
        -test -d $(appresdir) || $(mkinstalldirs) $(appresdir)
        if test -f $(appresdir)/GXditview; then \
@@ -49,31 +45,3 @@
 
 uninstall_sub:
        -rm -f $(appresdir)/GXditview
-
-fonts: $(xtotroff) $(srcdir)/DESC.in $(srcdir)/FontMap
-       fonts=`sed -e 's/[       ].*//' $(srcdir)/FontMap`; \
-       for dpi in $(DPIS); do \
-         echo Making devX$$dpi; \
-         test -d $(devdir)/devX$$dpi || \
-           $(mkinstalldirs) $(devdir)/devX$$dpi; \
-         rm -f $(devdir)/devX$$dpi/DESC; \
-         sed -e "s/res 75/res $$dpi/" $(srcdir)/DESC.in \
-           >$(devdir)/devX$$dpi/DESC; \
-         (cd $(devdir)/devX$$dpi; \
-         rm -f Makefile.sub; \
-         echo DEV=X$$dpi >Makefile.sub; \
-         echo DEVFILES=DESC $$fonts >>Makefile.sub; \
-         $(xtotroff) -g -r $$dpi -s 10 $(srcdir)/FontMap); \
-         echo Making devX$$dpi-12; \
-         test -d $(devdir)/devX$$dpi-12 || \
-           $(mkinstalldirs) $(devdir)/devX$$dpi-12; \
-         rm -f $(devdir)/devX$$dpi-12/DESC; \
-         sed -e "s/res 75/res $$dpi/" \
-             -e 's/unitwidth 10/unitwidth 12/' $(srcdir)/DESC.in \
-           >$(devdir)/devX$$dpi-12/DESC; \
-         (cd $(devdir)/devX$$dpi-12; \
-         rm -f Makefile.sub; \
-         echo DEV=X$$dpi-12 >Makefile.sub; \
-         echo DEVFILES=DESC $$fonts >>Makefile.sub; \
-         $(xtotroff) -g -r $$dpi -s 12 $(srcdir)/FontMap); \
-       done
Index: groff/src/devices/xditview/README
diff -u groff/src/devices/xditview/README:1.1.1.1 
groff/src/devices/xditview/README:1.2
--- groff/src/devices/xditview/README:1.1.1.1   Tue Jun  1 10:39:54 2004
+++ groff/src/devices/xditview/README   Thu Nov 25 08:08:33 2004
@@ -3,11 +3,11 @@
 with -TX75 and -TX100.  You will need X11R5 or newer to install it (it
 might work on X11R4, but I haven't tested it.)
 
-Previously, gxditview were installed in the usual place for X binaries
+Previously, gxditview was installed in the usual place for X binaries
 (e.g., /usr/bin/X11); you have to remove it manually.
 
 xditview is copyrighted by MIT under the usual X terms (see
-gxditview.man); the changes to that come along with the groff package
+gxditview.man); the changes to that which come along with the groff package
 are in the public domain.
 
 Please report bugs to address@hidden
Index: groff/src/utils/lkbib/lkbib.man
diff -u groff/src/utils/lkbib/lkbib.man:1.3 groff/src/utils/lkbib/lkbib.man:1.4
--- groff/src/utils/lkbib/lkbib.man:1.3 Wed Jun 27 12:47:27 2001
+++ groff/src/utils/lkbib/lkbib.man     Thu Nov 25 08:08:33 2004
@@ -1,5 +1,5 @@
 .ig
-Copyright (C) 1989-2000, 2001 Free Software Foundation, Inc.
+Copyright (C) 1989-2000, 2001, 2004 Free Software Foundation, Inc.
 
 Permission is granted to make and distribute verbatim copies of
 this manual provided the copyright notice and this permission notice
@@ -16,17 +16,23 @@
 translations approved by the Free Software Foundation instead of in
 the original English.
 ..
-.ds g \" empty
-.ds G \" empty
+.
+.
 .\" Like TP, but if specified indent is more than half
 .\" the current line-length - indent, use the default indent.
 .de Tp
-.ie \\n(.$=0:((0\\$1)*2u>(\\n(.lu-\\n(.iu)) .TP
-.el .TP "\\$1"
+.  ie \\n(.$=0:((0\\$1)*2u>(\\n(.lu-\\n(.iu)) .TP
+.  el .TP "\\$1"
 ..
+.
+.
 .TH LKBIB @MAN1EXT@ "@MDATE@" "Groff Version @VERSION@"
+.
+.
 .SH NAME
 lkbib \- search bibliographic databases
+.
+.
 .SH SYNOPSIS
 .B lkbib
 [
@@ -42,13 +48,16 @@
 .BI \-t n
 ]
 .IR key \|.\|.\|.
+.
 .PP
 It is possible to have whitespace between a command line option and its
 parameter.
+.
+.
 .SH DESCRIPTION
 .B lkbib
 searches bibliographic databases for references that contain the keys
-.IR key \|.\|.\|.
+.IR key \|.\|.\|.\&
 and prints any references found on the standard output.
 .B lkbib
 will search any databases given by
@@ -68,10 +77,13 @@
 .BR @address@hidden (@MAN1EXT@)
 exists, then it will be searched instead;
 each index can cover multiple databases.
+.
+.
 .SH OPTIONS
 .TP
 .B \-v
 Print the version number.
+.
 .TP
 .BI \-p filename
 Search
@@ -79,11 +91,13 @@
 Multiple
 .B \-p
 options can be used.
+.
 .TP
 .BI \-i string
 When searching files for which no index exists,
 ignore the contents of fields whose names are in
 .IR string .
+.
 .TP
 .BI \-t n
 Only require the first
@@ -91,19 +105,27 @@
 characters of keys to be given.
 Initially
 .I n
-is 6.
+is\~6.
+.
+.
 .SH ENVIRONMENT
 .TP \w'\fBREFER'u+2n
 .SB REFER
 Default database.
+.
+.
 .SH FILES
 .Tp \w'address@hidden@'u+2n
 .B @DEFAULT_INDEX@
 Default database to be used if the
 .SB REFER
 environment variable is not set.
+.
+.TP
 .IB filename @INDEX_SUFFIX@
 Index files.
+.
+.
 .SH "SEE ALSO"
 .BR @address@hidden (@MAN1EXT@),
 .BR @address@hidden (@MAN1EXT@),
Index: groff/src/utils/lookbib/lookbib.man
diff -u groff/src/utils/lookbib/lookbib.man:1.3 
groff/src/utils/lookbib/lookbib.man:1.4
--- groff/src/utils/lookbib/lookbib.man:1.3     Wed Jun 27 12:47:28 2001
+++ groff/src/utils/lookbib/lookbib.man Thu Nov 25 08:08:33 2004
@@ -1,5 +1,5 @@
 .ig
-Copyright (C) 1989-2000, 2001 Free Software Foundation, Inc.
+Copyright (C) 1989-2000, 2001, 2004 Free Software Foundation, Inc.
 
 Permission is granted to make and distribute verbatim copies of
 this manual provided the copyright notice and this permission notice
@@ -16,9 +16,15 @@
 translations approved by the Free Software Foundation instead of in
 the original English.
 ..
+.
+.
 .TH @address@hidden @MAN1EXT@ "@MDATE@" "Groff Version @VERSION@"
+.
+.
 .SH NAME
 @address@hidden \- search bibliographic databases
+.
+.
 .SH SYNOPSIS
 .B @address@hidden
 [
@@ -31,14 +37,19 @@
 .BI \-t n
 ]
 .IR filename \|.\|.\|.
+.
 .PP
 It is possible to have whitespace between a command line option and its
 parameter.
+.
+.
 .SH DESCRIPTION
address@hidden@lookbib prints a prompt on the standard error (unless the 
standard input is not a terminal),
+.B @address@hidden
+prints a prompt on the standard error (unless the standard input is not
+a terminal),
 reads from the standard input a line containing a set of keywords,
 searches the bibliographic databases
-.IR filename \|.\|.\|.
+.IR filename \|.\|.\|.\&
 for references containing those keywords,
 prints any references found on the standard output,
 and repeats this process until the end of input.
@@ -51,15 +62,19 @@
 .BR @address@hidden (@MAN1EXT@)
 exists, then it will be searched instead;
 each index can cover multiple databases.
+.
+.
 .SH OPTIONS
 .TP
 .B \-v
 Print the version number.
+.
 .TP
 .BI \-i string
 When searching files for which no index exists,
 ignore the contents of fields whose names are in
 .IR string .
+.
 .TP
 .BI \-t n
 Only require the first
@@ -67,11 +82,15 @@
 characters of keys to be given.
 Initially
 .I n
-is 6.
+is\~6.
+.
+.
 .SH FILES
 .TP \w'address@hidden@'u+2n
 .IB filename @INDEX_SUFFIX@
 Index files.
+.
+.
 .SH "SEE ALSO"
 .BR @address@hidden (@MAN1EXT@),
 .BR lkbib (@MAN1EXT@),
Index: groff/src/utils/pfbtops/pfbtops.man
diff -u groff/src/utils/pfbtops/pfbtops.man:1.3 
groff/src/utils/pfbtops/pfbtops.man:1.4
--- groff/src/utils/pfbtops/pfbtops.man:1.3     Mon Mar 17 16:49:35 2003
+++ groff/src/utils/pfbtops/pfbtops.man Thu Nov 25 08:08:33 2004
@@ -1,5 +1,5 @@
 .ig
-Copyright (C) 1989-1995, 2001, 2003 Free Software Foundation, Inc.
+Copyright (C) 1989-1995, 2001, 2003, 2004 Free Software Foundation, Inc.
 
 Permission is granted to make and distribute verbatim copies of
 this manual provided the copyright notice and this permission notice
@@ -16,14 +16,25 @@
 translations approved by the Free Software Foundation instead of in
 the original English.
 ..
+.
+.
 .TH PFBTOPS @MAN1EXT@ "@MDATE@" "Groff Version @VERSION@"
+.
+.
 .SH NAME
 pfbtops \- translate a PostScript font in .pfb format to ASCII
+.
+.
 .SH SYNOPSIS
 .B pfbtops
 [
+.B \-v
+]
+[
 .I pfb_file
 ]
+.
+.
 .SH DESCRIPTION
 .B pfbtops
 translates a PostScript font in
@@ -37,10 +48,18 @@
 PostScript fonts for MS-DOS are normally supplied in
 .B .pfb
 format.
+.
 .LP
 The resulting ASCII format PostScript font can be used with groff.
 It must first be listed in
 .BR @FONTDIR@/devps/download .
+.
+.SH OPTIONS
+.TP
+.B \-v
+Print the version number.
+.
+.
 .SH "SEE ALSO"
 .BR grops (@MAN1EXT@)
 .
Index: groff/src/utils/xtotroff/Makefile.sub
diff -u groff/src/utils/xtotroff/Makefile.sub:1.2 
groff/src/utils/xtotroff/Makefile.sub:1.3
--- groff/src/utils/xtotroff/Makefile.sub:1.2   Fri Jun  4 00:01:16 2004
+++ groff/src/utils/xtotroff/Makefile.sub       Thu Nov 25 08:08:33 2004
@@ -1,7 +1,7 @@
 PROG=xtotroff$(EXEEXT)
-# MAN1=xtotroff.n
+MAN1=xtotroff.n
 MLIB=$(LIBM)
-XLIBS=$(LIBXUTIL)
+XLIBS=$(LIBXUTIL) $(LIBGROFF)
 EXTRA_CFLAGS=$(X_CFLAGS)
 EXTRA_LDFLAGS=$(X_LIBS) $(X_PRE_LIBS) -lXaw -lXt -lX11 $(X_EXTRA_LIBS)
 OBJS=xtotroff.$(OBJEXT)
Index: groff/src/utils/xtotroff/xtotroff.c
diff -u groff/src/utils/xtotroff/xtotroff.c:1.1.1.1 
groff/src/utils/xtotroff/xtotroff.c:1.2
--- groff/src/utils/xtotroff/xtotroff.c:1.1.1.1 Tue Jun  1 10:42:02 2004
+++ groff/src/utils/xtotroff/xtotroff.c Thu Nov 25 08:08:33 2004
@@ -4,291 +4,292 @@
  * convert X font metrics into troff font metrics
  */
 
-#include       <X11/Xlib.h>
-#include       <stdio.h>
-#include       <ctype.h>
-#include       <unistd.h>
-#include       <stdlib.h>
-#include       <getopt.h>
-#include       <string.h>
-#include       <fcntl.h>
-#include       "XFontName.h"
-#include       "DviChar.h"
-
-#ifdef X_NOT_STDC_ENV
-char *malloc();
-#else 
-#include <stdlib.h>
+#ifdef HAVE_CONFIG_H
+#include <config.h>
 #endif
 
-#define charWidth(fi,c)        ((fi)->per_char[(c) - 
(fi)->min_char_or_byte2].width)
-#define charHeight(fi,c)       ((fi)->per_char[(c) - 
(fi)->min_char_or_byte2].ascent)
-#define charDepth(fi,c)        ((fi)->per_char[(c) - 
(fi)->min_char_or_byte2].descent)
-#define charLBearing(fi,c)     ((fi)->per_char[(c) - 
(fi)->min_char_or_byte2].lbearing)
-#define charRBearing(fi,c)     ((fi)->per_char[(c) - 
(fi)->min_char_or_byte2].rbearing)
-
-Display                *dpy;
-int            groff_flag = 0;
-unsigned       resolution = 75;
-unsigned       point_size = 10;
+#include <X11/Xlib.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <getopt.h>
+#include <string.h>
+#include <fcntl.h>
+#include <limits.h>
+#include "XFontName.h"
+#include "DviChar.h"
+
+#define charWidth(fi,c) \
+         ((fi)->per_char[(c) - (fi)->min_char_or_byte2].width)
+#define charHeight(fi,c) \
+         ((fi)->per_char[(c) - (fi)->min_char_or_byte2].ascent)
+#define charDepth(fi,c) \
+         ((fi)->per_char[(c) - (fi)->min_char_or_byte2].descent)
+#define charLBearing(fi,c) \
+         ((fi)->per_char[(c) - (fi)->min_char_or_byte2].lbearing)
+#define charRBearing(fi,c) \
+         ((fi)->per_char[(c) - (fi)->min_char_or_byte2].rbearing)
+
+extern const char *Version_string;
+static char *program_name;
+
+Display *dpy;
+unsigned resolution = 75;
+unsigned point_size = 10;
 
-int charExists (XFontStruct *fi, int c)
+int charExists(XFontStruct * fi, int c)
 {
-       XCharStruct *p;
+  XCharStruct *p;
 
-       /* `c' is always >= 0 */
-       if ((unsigned int)c < fi->min_char_or_byte2
-           || (unsigned int)c > fi->max_char_or_byte2)
-               return 0;
-       p = fi->per_char + (c - fi->min_char_or_byte2);
-       return (p->lbearing != 0 || p->rbearing != 0 || p->width != 0
-               || p->ascent != 0 || p->descent != 0 || p->attributes != 0);
+  /* `c' is always >= 0 */
+  if ((unsigned int) c < fi->min_char_or_byte2
+      || (unsigned int) c > fi->max_char_or_byte2)
+    return 0;
+  p = fi->per_char + (c - fi->min_char_or_byte2);
+  return p->lbearing != 0 || p->rbearing != 0 || p->width != 0
+        || p->ascent != 0 || p->descent != 0 || p->attributes != 0;
 }
 
 /* Canonicalize the font name by replacing scalable parts by *s. */
 
-static int
-CanonicalizeFontName (char *font_name, char *canon_font_name)
+static int CanonicalizeFontName(char *font_name, char *canon_font_name)
 {
-       unsigned int    attributes;
-       XFontName       parsed;
-
-       if (!XParseFontName(font_name, &parsed, &attributes)) {
-               fprintf (stderr, "not a standard name: %s\n", font_name);
-               return 0;
-       }
+  unsigned int attributes;
+  XFontName parsed;
 
-       attributes &= ~(FontNamePixelSize|FontNameAverageWidth
-                       |FontNamePointSize
-                       |FontNameResolutionX|FontNameResolutionY);
-       XFormatFontName(&parsed, attributes, canon_font_name);
-       return 1;
+  if (!XParseFontName(font_name, &parsed, &attributes)) {
+    fprintf(stderr, "not a standard name: %s\n", font_name);
+    return 0;
+  }
+
+  attributes &= ~(FontNamePixelSize | FontNameAverageWidth
+                 | FontNamePointSize
+                 | FontNameResolutionX | FontNameResolutionY);
+  XFormatFontName(&parsed, attributes, canon_font_name);
+  return 1;
 }
 
 static int
 FontNamesAmbiguous(const char *font_name, char **names, int count)
 {
-       char name1[2048], name2[2048];
-       int i;
-
-       if (count == 1)
-               return 0;
+  char name1[2048], name2[2048];
+  int i;
 
-       for (i = 0; i < count; i++) {
-               if (!CanonicalizeFontName(names[i], i == 0 ? name1 : name2)) {
-                       fprintf(stderr, "bad font name: %s\n", names[i]);
-                       return 1;
-               }
-               if (i > 0 && strcmp(name1, name2) != 0) {
-                       fprintf(stderr, "ambiguous font name: %s\n", font_name);
-                       fprintf(stderr, "  matches %s\n", names[0]);
-                       fprintf(stderr, "  and %s\n", names[i]);
-                       return 1;
-               }
+  if (count == 1)
+    return 0;
 
-       }
-       return 0;
+  for (i = 0; i < count; i++) {
+    if (!CanonicalizeFontName(names[i], i == 0 ? name1 : name2)) {
+      fprintf(stderr, "bad font name: %s\n", names[i]);
+      return 1;
+    }
+    if (i > 0 && strcmp(name1, name2) != 0) {
+      fprintf(stderr, "ambiguous font name: %s\n", font_name);
+      fprintf(stderr, "  matches %s\n", names[0]);
+      fprintf(stderr, "  and %s\n", names[i]);
+      return 1;
+    }
+  }
+  return 0;
 }
 
-static int
-MapFont (char *font_name, const char *troff_name)
+static int MapFont(char *font_name, const char *troff_name)
 {
-       XFontStruct     *fi;
-       int             count;
-       char            **names;
-       FILE            *out;
-       unsigned int    c;
-       unsigned int    attributes;
-       XFontName       parsed;
-       int             j, k;
-       DviCharNameMap  *char_map;
-       char            encoding[256];
-       char            *s;
-       int             wid;
-       char            name_string[2048];
-
-       if (!XParseFontName(font_name, &parsed, &attributes)) {
-               fprintf (stderr, "not a standard name: %s\n", font_name);
-               return 0;
-       }
-
-       attributes &= ~(FontNamePixelSize|FontNameAverageWidth);
-       attributes |= FontNameResolutionX;
-       attributes |= FontNameResolutionY;
-       attributes |= FontNamePointSize;
-       parsed.ResolutionX = resolution;
-       parsed.ResolutionY = resolution;
-       parsed.PointSize = point_size*10;
-       XFormatFontName(&parsed, attributes, name_string);
-
-       names = XListFonts (dpy, name_string, 100000, &count);
-       if (count < 1) {
-               fprintf (stderr, "bad font name: %s\n", font_name);
-               return 0;
-       }
-
-       if (FontNamesAmbiguous(font_name, names, count))
-               return 0;
-
-       XParseFontName(names[0], &parsed, &attributes);
-       sprintf (encoding, "%s-%s", parsed.CharSetRegistry,
-                                   parsed.CharSetEncoding);
-       for (s = encoding; *s; s++)
-               if (isupper (*s))
-                       *s = tolower (*s);
-       char_map = DviFindMap (encoding);
-       if (!char_map) {
-               fprintf (stderr, "not a standard encoding: %s\n", encoding);
-               return 0;
-       }
-
-       fi = XLoadQueryFont (dpy, names[0]);
-       if (!fi) {
-               fprintf (stderr, "font does not exist: %s\n", names[0]);
-               return 0;
-       }
-               
-       printf ("%s -> %s\n", names[0], troff_name);
-
-       { /* Avoid race while opening file */
-               int fd;
-               (void) unlink (troff_name);
-               fd = open (troff_name, O_WRONLY | O_CREAT | O_EXCL, 0600);
-               out = fdopen (fd, "w");
-       }
-
-       if (!out) {
-               perror (troff_name);
-               return 0;
-       }
-       fprintf (out, "name %s\n", troff_name);
-       if (!strcmp (char_map->encoding, "adobe-fontspecific"))
-               fprintf (out, "special\n");
-       if (charExists (fi, ' ')) {
-               int w = charWidth (fi, ' ');
-               if (w > 0)
-                       fprintf (out, "spacewidth %d\n", w);
-       }
-       fprintf (out, "charset\n");
-       for (c = fi->min_char_or_byte2; c <= fi->max_char_or_byte2; c++) {
-               const char *name = DviCharName (char_map, c, 0);
-               if (charExists (fi, c) && (groff_flag || name)) {
-
-                       wid = charWidth (fi, c);
-
-                       fprintf (out, "%s\t%d",
-                                       name ? name : "---",
-                                       wid);
-                       if (groff_flag) {
-                               int     param[5];
-                               param[0] = charHeight (fi, c);
-                               param[1] = charDepth (fi, c);
-                               param[2] = 0 /* charRBearing (fi, c) - wid */;
-                               param[3] = 0 /* charLBearing (fi, c) */;
-                               param[4] = 0; /* XXX */
-                               for (j = 0; j < 5; j++)
-                                       if (param[j] < 0)
-                                               param[j] = 0;
-                               for (j = 4; j >= 0; j--)
-                                       if (param[j] != 0)
-                                               break;
-                               for (k = 0; k <= j; k++)
-                                       fprintf (out, ",%d", param[k]);
-                       }
-                       fprintf (out, "\t0\t0%o\n", c);
-                       
-                       if (name) {
-                               for (k = 1; DviCharName(char_map,c,k); k++) {
-                                       fprintf (out, "%s\t\"\n",
-                                                DviCharName (char_map,c,k));
-                               }
-                       }
-               }
-       }
-       XUnloadFont (dpy, fi->fid);
-       fclose (out);
-       return 1;
+  XFontStruct *fi;
+  int count;
+  char **names;
+  FILE *out;
+  unsigned int c;
+  unsigned int attributes;
+  XFontName parsed;
+  int j, k;
+  DviCharNameMap *char_map;
+  char encoding[256];
+  char *s;
+  int wid;
+  char name_string[2048];
+
+  if (!XParseFontName(font_name, &parsed, &attributes)) {
+    fprintf(stderr, "not a standard name: %s\n", font_name);
+    return 0;
+  }
+
+  attributes &= ~(FontNamePixelSize | FontNameAverageWidth);
+  attributes |= FontNameResolutionX;
+  attributes |= FontNameResolutionY;
+  attributes |= FontNamePointSize;
+  parsed.ResolutionX = resolution;
+  parsed.ResolutionY = resolution;
+  parsed.PointSize = point_size * 10;
+  XFormatFontName(&parsed, attributes, name_string);
+
+  names = XListFonts(dpy, name_string, 100000, &count);
+  if (count < 1) {
+    fprintf(stderr, "bad font name: %s\n", font_name);
+    return 0;
+  }
+
+  if (FontNamesAmbiguous(font_name, names, count))
+    return 0;
+
+  XParseFontName(names[0], &parsed, &attributes);
+  sprintf(encoding, "%s-%s", parsed.CharSetRegistry,
+         parsed.CharSetEncoding);
+  for (s = encoding; *s; s++)
+    if (isupper(*s))
+      *s = tolower(*s);
+  char_map = DviFindMap(encoding);
+  if (!char_map) {
+    fprintf(stderr, "not a standard encoding: %s\n", encoding);
+    return 0;
+  }
+
+  fi = XLoadQueryFont(dpy, names[0]);
+  if (!fi) {
+    fprintf(stderr, "font does not exist: %s\n", names[0]);
+    return 0;
+  }
+
+  printf("%s -> %s\n", names[0], troff_name);
+
+  {                            /* Avoid race while opening file */
+    int fd;
+    (void) unlink(troff_name);
+    fd = open(troff_name, O_WRONLY | O_CREAT | O_EXCL, 0600);
+    out = fdopen(fd, "w");
+  }
+
+  if (!out) {
+    perror(troff_name);
+    return 0;
+  }
+  fprintf(out, "name %s\n", troff_name);
+  if (!strcmp(char_map->encoding, "adobe-fontspecific"))
+    fprintf(out, "special\n");
+  if (charExists(fi, ' ')) {
+    int w = charWidth(fi, ' ');
+    if (w > 0)
+      fprintf(out, "spacewidth %d\n", w);
+  }
+  fprintf(out, "charset\n");
+  for (c = fi->min_char_or_byte2; c <= fi->max_char_or_byte2; c++) {
+    const char *name = DviCharName(char_map, c, 0);
+    if (charExists(fi, c)) {
+      wid = charWidth(fi, c);
+
+      fprintf(out, "%s\t%d", name ? name : "---", wid);
+      int param[5];
+      param[0] = charHeight(fi, c);
+      param[1] = charDepth(fi, c);
+      param[2] = 0;            /* charRBearing (fi, c) - wid */
+      param[3] = 0;            /* charLBearing (fi, c) */
+      param[4] = 0;            /* XXX */
+      for (j = 0; j < 5; j++)
+       if (param[j] < 0)
+         param[j] = 0;
+      for (j = 4; j >= 0; j--)
+       if (param[j] != 0)
+         break;
+      for (k = 0; k <= j; k++)
+       fprintf(out, ",%d", param[k]);
+      fprintf(out, "\t0\t0%o\n", c);
+
+      if (name) {
+       for (k = 1; DviCharName(char_map, c, k); k++) {
+         fprintf(out, "%s\t\"\n", DviCharName(char_map, c, k));
+       }
+      }
+    }
+  }
+  XUnloadFont(dpy, fi->fid);
+  fclose(out);
+  return 1;
 }
 
-static void
-usage(const char *prog)
+static void usage(FILE *stream)
 {
-       fprintf (stderr,
-                "usage: %s [-g] [-r resolution] [-s pointsize] FontMap\n",
-                prog);
-       exit (1);
+  fprintf(stream,
+         "usage: %s [-r resolution] [-s pointsize] FontMap\n",
+         program_name);
 }
 
-int
-main (int argc, char **argv)
+int main(int argc, char **argv)
 {
-       char    troff_name[1024];
-       char    font_name[1024];
-       char    line[1024];
-       char    *a, *b, c;
-       int     position;
-       FILE    *map;
-       int     opt;
-
-       while ((opt = getopt(argc, argv, "gr:s:")) != EOF) {
-               switch (opt) {
-               case 'g':
-                       groff_flag = 1;
-                       break;
-               case 'r':
-                       sscanf(optarg, "%u", &resolution);
-                       break;
-               case 's':
-                       sscanf(optarg, "%u", &point_size);
-                       break;
-               default:
-                       usage(argv[0]);
-               }
-       }
-       if (argc - optind != 1)
-               usage(argv[0]);
-
-       dpy = XOpenDisplay (0);
-       if (!dpy) {
-               fprintf (stderr, "Can't connect to the X server.\n");
-               fprintf (stderr, "Make sure the DISPLAY environment variable is 
set correctly.\n");
-               exit (1);
-       }
-        position = 1;
-
-       map = fopen (argv[optind], "r");
-       if (map == NULL) {
-               perror (argv[optind]);
-               exit (1);
-       }
-
-       while (fgets (line, sizeof (line), map)) {
-               for (a=line,b=troff_name; *a; a++,b++) {
-                       c = (*b = *a);
-                       if (c == ' ' || c == '\t')
-                               break;
-               }
-               *b = '\0';
-               while (*a && (*a == ' ' || *a == '\t'))
-                       ++a;
-               for (b=font_name; *a; a++,b++)
-                       if ((*b = *a) == '\n')
-                               break;
-               *b = '\0';
-               if (!MapFont (font_name, troff_name))
-                       exit (1);
-               ++position;
-       }
-       exit (0);
+  char troff_name[1024];
+  char font_name[1024];
+  char line[1024];
+  char *a, *b, c;
+  FILE *map;
+  int opt;
+  static const struct option long_options[] = {
+    { "help", no_argument, 0, CHAR_MAX + 1 },
+    { "version", no_argument, 0, 'v' },
+    { NULL, 0, 0, 0 }
+  };
+
+  program_name = argv[0];
+
+  while ((opt = getopt_long(argc, argv, "gr:s:v", long_options,
+                           NULL)) != EOF) {
+    switch (opt) {
+    case 'g':
+      /* unused; just for compatibility */
+      break;
+    case 'r':
+      sscanf(optarg, "%u", &resolution);
+      break;
+    case 's':
+      sscanf(optarg, "%u", &point_size);
+      break;
+    case 'v':
+      printf("xtotroff (groff) version %s\n", Version_string);
+      exit(0);
+      break;
+    case CHAR_MAX + 1: /* --help */
+      usage(stdout);
+      exit(0);
+      break;
+    case '?':
+      usage(stderr);
+      exit(1);
+      break;
+    }
+  }
+  if (argc - optind != 1) {
+    usage(stderr);
+    exit(1);
+  }
+
+  dpy = XOpenDisplay(0);
+  if (!dpy) {
+    fprintf(stderr, "Can't connect to the X server.\n");
+    fprintf(stderr,
+           "Make sure the DISPLAY environment variable is set correctly.\n");
+    exit(1);
+  }
+
+  map = fopen(argv[optind], "r");
+  if (map == NULL) {
+    perror(argv[optind]);
+    exit(1);
+  }
+
+  while (fgets(line, sizeof(line), map)) {
+    for (a = line, b = troff_name; *a; a++, b++) {
+      c = (*b = *a);
+      if (c == ' ' || c == '\t')
+       break;
+    }
+    *b = '\0';
+    while (*a && (*a == ' ' || *a == '\t'))
+      ++a;
+    for (b = font_name; *a; a++, b++)
+      if ((*b = *a) == '\n')
+       break;
+    *b = '\0';
+    if (!MapFont(font_name, troff_name))
+      exit(1);
+  }
+  exit(0);
 }
-
-/*
-Local Variables:
-c-indent-level: 8
-c-continued-statement-offset: 8
-c-brace-offset: -8
-c-argdecl-indent: 8
-c-label-offset: -8
-c-tab-always-indent: nil
-End:
-*/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]