tTweak to make troff compile silently. - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 1f72bc47fe416f8fa00d8cea27ee1482fba28c20
 (DIR) parent e98091cf8d836fca982a5baac166e138edd670b1
 (HTM) Author: wkj <devnull@localhost>
       Date:   Mon, 17 May 2004 02:23:11 +0000
       
       Tweak to make troff compile silently.
       
       Diffstat:
         M src/cmd/troff/ext.h                 |       1 +
         M src/cmd/troff/fns.h                 |       1 +
         M src/cmd/troff/mbwc.c                |       2 +-
         M src/cmd/troff/n1.c                  |       6 +++---
         M src/cmd/troff/n10.c                 |       2 +-
         M src/cmd/troff/n5.c                  |       2 +-
         M src/cmd/troff/n8.c                  |      10 ++--------
         M src/cmd/troff/t11.c                 |       6 +++---
       
       8 files changed, 13 insertions(+), 17 deletions(-)
       ---
 (DIR) diff --git a/src/cmd/troff/ext.h b/src/cmd/troff/ext.h
       t@@ -99,6 +99,7 @@ extern        int        pnlist[];
        extern        int        po1;
        extern        int        po;
        extern        int        ppts;
       +#define        print        troffprint
        extern        int        print;
        extern        FILE        *ptid;
        extern        int        pto;
 (DIR) diff --git a/src/cmd/troff/fns.h b/src/cmd/troff/fns.h
       t@@ -10,6 +10,7 @@ int        lseek(int, long, int);
        int        close(int);
        int        getpid(void);
        #endif
       +char        *unsharp(char*);
        
        /*
         * c1.c
 (DIR) diff --git a/src/cmd/troff/mbwc.c b/src/cmd/troff/mbwc.c
       t@@ -130,7 +130,7 @@ mbstowcs(wchar_t *pwcs, const char *s, size_t n)
        size_t
        wcstombs(char *s, const wchar_t *pwcs, size_t n)
        {
       -        int /*i,*/ d;
       +        int d;
                long c;
                char *p, *pe;
                char buf[3];
 (DIR) diff --git a/src/cmd/troff/n1.c b/src/cmd/troff/n1.c
       t@@ -828,7 +828,7 @@ n1:
                if (p[0] == '-' && p[1] == 0) {
                        ifile = stdin;
                        strcpy(cfname[ifi], "stdin");
       -        } else if ((ifile = fopen(p, "r")) == NULL) {
       +        } else if ((ifile = fopen(unsharp(p), "r")) == NULL) {
                        ERROR "cannot open file %s", p WARN;
                        nfo -= mflg;
                        done(02);
       t@@ -936,7 +936,7 @@ void caseso(void)
        
                lgf++;
                nextf[0] = 0;
       -        if (skip() || !getname() || (fp = fopen(nextf, "r")) == NULL || ifi >= NSO) {
       +        if (skip() || !getname() || (fp = fopen(unsharp(nextf), "r")) == NULL || ifi >= NSO) {
                        ERROR "can't open file %s", nextf WARN;
                        done(02);
                }
       t@@ -1005,7 +1005,7 @@ void casecf(void)
                nextf[0] = 0;
                if (!skip() && getname()) {
                        if (strncmp("<<", nextf, 2) != 0) {
       -                        if ((fd = fopen(nextf, "r")) == NULL) {
       +                        if ((fd = fopen(unsharp(nextf), "r")) == NULL) {
                                        ERROR "can't open file %s", nextf WARN;
                                        done(02);
                                }
 (DIR) diff --git a/src/cmd/troff/n10.c b/src/cmd/troff/n10.c
       t@@ -185,7 +185,7 @@ void n_ptinit(void)
                /* hyphalg = 0;        /* for testing */
        
                strcat(termtab, devname);
       -        if ((fp = fopen(termtab, "r")) == NULL) {
       +        if ((fp = fopen(unsharp(termtab), "r")) == NULL) {
                        ERROR "cannot open %s", termtab WARN;
                        exit(-1);
                }
 (DIR) diff --git a/src/cmd/troff/n5.c b/src/cmd/troff/n5.c
       t@@ -409,7 +409,7 @@ void casefm(void)
                        return;
                }
                if (fcache[i].fp == NULL) {
       -                if( (fcache[i].fp = fopen(nextf, "w")) == NULL) {
       +                if( (fcache[i].fp = fopen(unsharp(nextf), "w")) == NULL) {
                                ERROR "fm: cannot open %s", nextf WARN;
                                return;
                        }
 (DIR) diff --git a/src/cmd/troff/n8.c b/src/cmd/troff/n8.c
       t@@ -461,19 +461,13 @@ static int texit(Tchar *start, Tchar *end)        /* hyphenate as in tex, return # foun
                characters.  sigh.
        */
        
       -extern        char        *unsharp(char*);
       -
       -static        char        *texhyphens;
       -
        static int readpats(void)
        {
                FILE *fp;
                char buf[200], buf1[200];
        
       -        if(texhyphens == 0)
       -                texhyphens = unsharp(TEXHYPHENS);
       -        if ((fp = fopen(texhyphens, "r")) == NULL
       -         && (fp = fopen(DWBalthyphens, "r")) == NULL) {
       +        if ((fp = fopen(unsharp(TEXHYPHENS), "r")) == NULL
       +         && (fp = fopen(unsharp(DWBalthyphens), "r")) == NULL) {
                        ERROR "warning: can't find hyphen.tex" WARN;
                        return 0;
                }
 (DIR) diff --git a/src/cmd/troff/t11.c b/src/cmd/troff/t11.c
       t@@ -24,7 +24,7 @@ getdesc(char *name)
                char cmd[100], s[100];
                int i, v;
        
       -        if ((fin = fopen(name, "r")) == NULL)
       +        if ((fin = fopen(unsharp(name), "r")) == NULL)
                        return -1;
                while (fscanf(fin, "%s", cmd) != EOF) {
                        if (strcmp(cmd, "res") == 0) {
       t@@ -65,7 +65,7 @@ static int checkfont(char *name)
                char buf[300], buf2[300];
                int i, status = -1;
        
       -        if ((fp = fopen(name, "r")) == NULL)
       +        if ((fp = fopen(unsharp(name), "r")) == NULL)
                        return -1;
                for (i = 1; i <= 10; i++) {
                        if (fgets(buf, sizeof buf, fp) == NULL)
       t@@ -100,7 +100,7 @@ getfont(char *name, int pos)        /* create width tab for font */
                /* fprintf(stderr, "read font %s onto %d\n", name, pos); */
                if (checkfont(name) == -1)
                        return -1;
       -        if ((fin = fopen(name, "r")) == NULL)
       +        if ((fin = fopen(unsharp(name), "r")) == NULL)
                        return -1;
                for (i = 0; i < ALPHABET; i++)
                        chtemp[i] = chinit;        /* zero out to begin with */