⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dvi2tty.c

📁 harvest是一个下载html网页得机器人
💻 C
📖 第 1 页 / 共 3 页
字号:
/****************************************************************************** * Kang-Jin Lee: 23sep2000 (lee@arco.de) *               Don't append ".dvi" to dvi file name without ".dvi" extension. * Kang-Jin Lee: 26jan2000 (lee@arco.met.fu-berlin.de) *               Minor changes to integrate with Harvest. * Marcel Mol: 27may1996  (Internet: marcel@mesa.nl) *               From: mlemos@ua.pt (Manuel Lemos): Port to AMIGA. * Marcel Mol: 24mar1996  (Internet: marcel@mesa.nl) *               From: Alex Viskovatoff <av@mixcom.com>: Port to Macintosh *               From: Anton vd Repe  1995-6-9     (UUCP: arp@neabbs.uucp): *               Added option to skip translation of Scandinavian/Finnish *               and skip the constraint to ASCII characters only. *               Added option to include font name in output when new font *               is chosen. *               Limit line width of 132 expanded to 332. * Marcel Mol: 23jun1995  (Internet: marcel@duteca.et.tudelft.nl) *               Included patch form Hideki ISOZAKI (isozaki@ntt-20.ntt.jp) *               to allow japanese fonts generated by NTT JTeX (March 1992). *               Added cleanups (protoize + includes) by D.U. Zoller *               (1995-07-17 duz@roxi.rz.fht-mannheim.de) *               Version 5.1 * Marcel Mol: 09sep1993  (Internet: marcel@duteca.et.tudelft.nl) *               In dvistuff.c: added auto detection for 'ttfont'. *               This make -t flag unneeded, but it is still left in for *               people who like to force 'verbatim' mode. *               Thanks to: Diomidis Spinellis <dds@doc.imperial.ac.uk> * Marcel Mol: 05sep1993  (Internet: marcel@duteca.et.tudelft.nl) *               In dvistuff.c: put some extra chars arround the 'ttfont' *               flag in the 'normchar' function. * Marcel Mol: 01oct1991  (Internet: marcel@duteca.et.tudelft.nl) *               (From Igor Romanenko, igor@d245.icyb.kiev.ua.) *               Fixed unneccesary * in *envp++. * Marcel Mol: 24jul1991  (Internet: marcel@duteca.et.tudelft.nl) *               Suggestion From: peter@julian.uwo.ca   [uwo] *               vertical bars "|" and the tilde "~" print properly in *               typewriter font. * Marcel Mol: 1990-11-29  (UUCP: marcel@duteca.et.tudelft.nl) *               Fixed bug in option handling. Cleanup of code. *               Other minor changes/optimizations. * Marcel Mol: 1990-11-13  (UUCP: marcel@duteca.et.tudelft.nl) *               Included patches of Bernard Gaulle in my version. *               Version 4.4 * Bernard Gaulle: 1990-10-16 (gaulle@murnau.circe.fr) *               Add -t option (assuming tt fonts were used) *               (Version 3.3) * Marcel Mol: 1990-05-03  (UUCP: marcel@duteca.tudelft.nl) *               Now displays accents etc. on characters again. Added option *               (-a) to switch this off. If switched off it now uses proper *               spacing. *               Cleaned up and show version number in usage(); *               Version 4.3 * Marcel Mol: 1990-05-02  (UUCP: marcel@duteca.tudelft.nl) *               Included patches for VAX/VMS VAXC, done by Robert Schneider. *               Version 4.2 * Marcel Mol: 1990-03-27  (UUCP: marcel@duteca.tudelft.nl) *               Fixed bug that causes the program to hang when it finds a *               fontname with an 's' in it not followed by an 'y'. *               Thanks to Paul Orgren (orgren@Stars.Reston.Unisys.COM). *               Version 4.1 * Marcel Mol: 1990-02-04  (UUCP: marcel@duteca.tudelft.nl) *               First attempt to recognize symbol fonts, so bullets (in *               itemized lists) are translated to a proper character instead *               an awfull ligature. *               Version 4.0. * Marcel Mol: 1990-02-01  (UUCP: marcel@duteca.tudelft.nl) *               Included port to VMS (off Joseph Vasallo and Seppo Rantala) *               into latest version. Hope things still work, cannot test it ... * Joseph Vasallo & Seppo Rantala: 1989-09-05 (Internet: rantala@tut.FI) *		 Ported to work under VAX/VMS V4.4 & VAXC V2.4 or higher. *		 Fixed bugs in using Swedish/Finnish characters. * Marcel Mol: 1989-02-14  (UUCP: duteca!marcel) *               Fixed check for .dvi extension. *               Allowed more ligatures. *               Fixed side effect bugs (2 gets as function arguments). *               Version 3.2. * Marcel Mol: 1989-01-19  (UUCP: duteca!marcel) *               Changed in option handling, no change *               in user interface (only the undocumented *               feature -e). *               Version 3.1. * Marcel Mol: 1989-01-11  (UUCP: duteca!marcel) *               Changed some longs to ints. *               It now also runs on MSDOS Microsoft C 5.1 *               New version: 3.0 * Marcel Mol: 1989-01-03  (UUCP: duteca!marcel) *               Fixed a bugs concerning pager programs *               and scanning environment variable DVI2TTY. * Marcel Mol: 1988-10-25  (UUCP: duteca!marcel) *               Renamed to dvi2tty and converted to C. *               Filenames: dvi2tty.c dvi2tty.h dvistuff.c commands.h *               Improved spacing between words/characters. * bogart:/usr/alla/zap/dvitty/dvitty.p  1986-08-15 20:24:31, *               Version to be sent to mod.sources ready. * New option since last version: *   -Fprog      Pipe output to prog. Can be used to get a different *               pager than the default. * bogart:/usr/alla/zap/dvitty/dvitty.p  1986-01-13 21:49:31, *   Environment variable DVITTY is read and options can be set from it. * bogart:/usr/alla/zap/dvitty/dvitty.p  1986-01-10 18:51:03, *   Argument parsing, and random access functions (external, in C) *   and other OS-dependent stuff (in C). Removed private 'pager' & *   tries to pipe through PAGER (environment var) or, if PAGER not *   defined, /usr/ucb/more. Some changes for efficency. * bogart:/usr/alla/svante/dvitty/dvitty.p  1985-07-15 20:51:00, *   The code for processing dvi-files running on UNIX (UCB-Pascal) *   but no argument parsing. * VERA::SS:<SVANTE-LINDAHL.WORK>DVITTY.PAS.140, 30-Mar-85 05:43:56, *   Edit: Svante Lindahl * VERA::SS:<SVANTE-LINDAHL.WORK>DVITTY.PAS.136, 15-Jan-85 13:52:59, *   Edit: Svante Lindahl, final Twenex version !!!?? * VERA::SS:<SVANTE-LINDAHL.WORK>DVITTY.PAS.121, 14-Jan-85 03:10:22, *   Edit: Svante Lindahl, cleaned up and fixed a lot of little things * VERA::SS:<SVANTE-LINDAHL.WORK>DVITTY.PAS.25, 15-Dec-84 05:29:56, *   Edit: Svante Lindahl, COMND-interface, including command line scanning * VERA::SS:<SVANTE-LINDAHL.WORK>DVITTY.PAS.23, 10-Dec-84 21:24:41, *   Edit: Svante Lindahl, added command line scanning with Rscan-JSYS * VERA::<SVANTE-LINDAHL.DVITTY>DVITTY.PAS.48,  8-Oct-84 13:26:30, *  Edit: Svante Lindahl, fixed switch-parsing, destroyed by earlier patches * VERA::<SVANTE-LINDAHL.DVITTY>DVITTY.PAS.45, 29-Sep-84 18:29:53, *  Edit: Svante Lindahl * * dvitty - get an ascii representation of a dvi-file, suitable for ttys * * This program, and any documentation for it, is copyrighted by Svante * Lindahl. It may be copied for non-commercial use only, provided that * any and all copyright notices are preserved. * * * UUCP: {seismo,mcvax,cernvax,diku,ukc,unido}!enea!ttds!zap * ARPA: enea!ttds!zap@seismo.CSS.GOV *  or   Svante_Lindahl_NADA%QZCOM.MAILNET@MIT-MULTICS.ARPA * EAN:  zap@cs.kth.sunet *//* * Include files */#include "dvi2tty.h"#if defined(VMS)# include unixio#endif#if defined(THINK_C)# include <unix.h># include "macintosh.h"#endif/* * Constant definitons */    /*-----------------------------------------------------------------------*/    /* The following constants may be toggled before compilation to          */    /* customize the default behaviour of the program for your site.         */    /* Whichever their settings are, the defaults can be overridden at       */    /* runtime.                                                              */    /*-----------------------------------------------------------------------*/#define DEFSCAND  FALSE       /* default is Scandinavian, toggle this if you */                              /* don't have terminals with Scand. nat. chars */#define WANTPAGER FALSE       /* default: try to pipe through a pager (like  */                              /* more) if stdout is tty and no -o switch     */#define DEFPAGER  "/usr/bin/less"   /* CHANGE TO YOUR LOCAL PAGER            */    /*------------------ end of customization constants ---------------------*/#define MAXLEN          100    /* size of char-arrays for strings            */#if defined(MSDOS) || defined(VMS) || defined(AMIGA)#define OPTSET      "haJwepPousltvbc" /* legal options                       */#define OPTWARG     "wepPovb"  /* options with argument                      */#else#define OPTSET      "haJwepPousqlfFtvbc"/* legal options                     */#define OPTWARG     "wepPoFvb"     /* options with argument                  */#endif/* * USAGE CODES */#define wrnge  1                /* width switch arg out of range     */#define ign    2                /* ignore cause, print 'Usage:..'    */#define nan    3                /* not a number where one expected   */#define gae    4                /* garbage at end                    */#define bdlst  5                /* bad page-numberlist               */#define onef   6                /* only one dvifile allowed          */#define bdopt  7                /* bad option                        */#define onepp  8                /* only one page list allowed        */#define noarg  9                /* argument expected                 */#if defined(THINK_C)#define nored  10               /* if no input file, redirect stdin  */#endif/* * Variable definitions */char *dvi2tty = "@(#) dvi2tty.c  5.12 27may1996 M.J.E. Mol (c) 1989-1996";#define VERSION 5.3printlisttype * currentpage;    /* current page to print                     */printlisttype * firstpage;      /* first page selected                       */printlisttype * lastpage;       /* last page selected                        */FILE *          DVIfile;FILE *          output;bool            outputtofile;   /* tells if output goes to file or stdout    */#if defined(THINK_C)bool            inputfromfile;  /* tells if input comes from file or stdin   */#endifint             ttywidth;       /* max nr of chars per printed line          */int             espace;         /* to fake calcs with ttywidth               */long            foo;            /* utility variable, "register"              */#if !defined(MSDOS) && !defined(VMS) && !defined(THINK_C) && !defined(AMIGA)bool            pager;          /* tells if output is piped to a pager       */char  *         path;           /* name of the pager to run                  */#endifchar  *         progname;       /* our name                                  */int             Argc;char **         Argv;char            DVIfilename[MAXLEN];char *          OUTfilename;char            optch;          /* for option handling                       *//* * Function declarations */#if defined(MSDOS)void    setoption (char *);void    getargs   (void);void    getpages  (int, char *);void    plcnxt    (int);void    getfname  (char *);int     getinteger(int *, int *, char *);int     getlong   (long *, int *, char *);void    usage     (int);#elsevoid    setoption (char * optarg);void    getargs   (void);void    getpages  (int j, char * str);void    plcnxt    (int pagnr);void    getfname  (char * str);int     getinteger(int * dest, int * j, char * str);int     getlong   (long * dest, int * j, char * str);void    usage     (int uerr);#endif/****************************************************************************//*                                                                          *//*                                 M A I N                                  *//*                                                                          *//****************************************************************************/int main(int argc, char **argv){#if defined(THINK_C)    argc = process_dvi_command_line(&argv);#endif    progname = *argv;    Argc = argc;    Argv = argv;    getargs();                              /* read command line arguments   */#if defined(THINK_C)    if (inputfromfile) {#endif#if defined(MSDOS)        if ((DVIfile = fopen(DVIfilename, "rb")) == NULL)#else# if defined(VMS)        if ((DVIfile = fopen(DVIfilename, "r","ctx=rec")) == NULL)# else        if ((DVIfile = fopen(DVIfilename, "r")) == NULL)# endif#endif            errorexit(filop);               /* can't open dvifile            */#if defined(THINK_C)    }    else        DVIfile = stdin;#endif    if (outputtofile) {                     /* open the outfile, if needed   */        if ((output = fopen(OUTfilename, "w")) == NULL)            errorexit(filcr);#if defined(THINK_C)        else            set_creator((unsigned char*) OUTfilename);#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -