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

📄 dvi2tty.c

📁 harvest是一个下载html网页得机器人
💻 C
📖 第 1 页 / 共 3 页
字号:
} /* getpages *//* * PLCNXT -- Place page-nr next in list. */void plcnxt(int pagnr){    currentpage = lastpage;    currentpage->pag = pagnr;    lastpage = (printlisttype *) malloc(sizeof(printlisttype));    lastpage->all = FALSE;    lastpage->nxt = nil;    lastpage->pag = 0;    currentpage->nxt = lastpage;    return;} /* plcnxt *//* * GETFNAME -- Make sure we have a .dvi filename. * * Take filename given by command line as is. kjl/23sep2000 */void getfname(char *str){/*    int   i;    i = strlen(str);    if (i == 0)        usage(ign);    strcpy(DVIfilename, str);    if ((i < 5) || strcmp(str+i-4, ".dvi"))        strcat(DVIfilename, ".dvi"); */    if (!str)        usage(ign);    strcpy(DVIfilename, str);    return;} /* getfname *//* * GETINTEGER -- Convert ascii to an integer. I'm sure there is a library *               call for it. */int getinteger(int *dest, int *j, char *str){    int  cum;    int  sgn;    char ch;    ch = str[*j];    if (ch == '-') {        sgn = -1;        ch  = str[++(*j)];    }    else        sgn = 1;    if ((ch >= '0') && (ch <= '9')) {        cum = 0;        while ((ch >= '0') && (ch <= '9')) {            cum = cum*10 + ch - '0';            ch = str[++(*j)];        }        *dest = sgn * cum;        return 0;                   /* return ok */    }    return 1;                       /* return error */}   /* getinteger *//* * GETLONG -- Convert ascii to a long. I'm sure there is a library *            call for it. */int getlong(long *dest, int *j, char *str){    long  cum;    int  sgn;    char ch;    ch = str[*j];    if (ch == '-') {        sgn = -1;        ch  = str[++(*j)];    }    else        sgn = 1;    if ((ch >= '0') && (ch <= '9')) {        cum = 0;        while ((ch >= '0') && (ch <= '9')) {            cum = cum*10L + ch - '0';            ch = str[++(*j)];        }        *dest = (long) sgn * cum;        return 0;                   /* return ok */    }    return 1;                       /* return error */}   /* getinteger *//* * ERROREXIT -- Exit program with an erro message. */void errorexit(int errorcode){    fprintf(stderr, "%s: ", progname);    switch (errorcode) {        case  illop : fprintf(stderr, "Illegal op-code found: %d\n", opcode);                      break;        case  stkof : fprintf(stderr, "Stack overflow\n");                      break;        case  stkuf : fprintf(stderr, "Stack underflow\n");                      break;        case  stkrq : fprintf(stderr, "Cannot create dvi stack\n");                      break;        case  lnerq : fprintf(stderr, "Cannot allocate memory\n");                      break;        case  badid : fprintf(stderr, "Id-byte is not correct: %d\n ", opcode);                      break;        case  bdsgn : fprintf(stderr, "Bad signature: %d (not 223)\n",                                      (int) foo);                      break;        case  fwsgn : fprintf(stderr, "%d signature bytes (min. 4)\n",                                      (int) foo);                      break;        case  nopre : fprintf(stderr, "Missing preamble\n");                      break;        case  nobop : fprintf(stderr, "Missing beginning-of-page command\n");                      break;        case  nopp  : fprintf(stderr, "Missing post-post command\n");                      break;        case  bdpre : fprintf(stderr, "Preamble occured inside a page\n");                      break;        case  bdbop : fprintf(stderr, "BOP-command occured inside a page\n");                      break;        case  bdpst : fprintf(stderr, "Postamble occured before end-of-page\n");                      break;        case  bdpp  : fprintf(stderr, "Postpost occured before post-command\n");                      break;        case  nopst : fprintf(stderr, "Missing postamble\n");                      break;        case  illch : fprintf(stderr, "Character code out of range, 0..127\n");                      break;        case  filop : fprintf(stderr, "Cannot open dvifile\n");                      break;        case  filcr : fprintf(stderr, "Cannot create outfile\n");                      break;#if !defined(MSDOS) && !defined(VMS) && !defined(THINK_C) && !defined(AMIGA)        case  pipcr : fprintf(stderr, "Cannot create pipe to pager\n");                      break;#endif        default     : fprintf(stderr, "Unkown error code\n");                      break;    };    if (outputtofile)#if defined(VMS)        remove(OUTfilename);#else        unlink(OUTfilename);#endif    exit(errorcode);}  /* errorexit *//* * USAGE -- Print the usage info. Also print a warning/error message *          if needed. */void usage(int uerr){    fprintf(stderr, "%s", Copyright);    if (uerr != ign) {        fprintf(stderr,"%s: ", progname);        switch (uerr) {            case   wrnge  : fprintf(stderr, "width arg out of range:16-%d",                                            MAXTERMWIDTH);                            break;            case   nan    : fprintf(stderr,                                    "numeric argument expected for option %c",                                            optch);                            break;            case   gae    : fprintf(stderr, "garbage in argument for option %c",                                            optch);                            break;            case   bdlst  : fprintf(stderr, "mal-formed list of pagenumbers");                            break;            case   onef   : fprintf(stderr, "only one infile argument allowed");                            break;            case   noarg  : fprintf(stderr,                                    "option argument expected for option %c",                                            optch);                            break;            case   bdopt  : fprintf(stderr, "bad option %c", optch);                            break;            case   onepp  : fprintf(stderr, "only one pagelist allowed");                            break;#if defined(THINK_C)            case   nored  : fprintf(stderr, "\nIf no input file is given in\ command string,\n\Standard Input must be redirected with the radio button.");                            break;#endif            default       : fprintf(stderr, "unknown usage error");                            break;        }        fprintf(stderr, "\n");    }    fprintf(stderr, "\n%s\n\n", dvi2tty);#if defined(THINK_C)    fprintf(stderr, "Usage: %s [ options ] [<dvi-file>[.dvi]]\n", progname);    fprintf(stderr, "Read input from <dvi-file>, else read from Standard Input,\\nwhich must be redirected by means of the radio button.\n");#else    fprintf(stderr, "Usage: %s [ options ] <dvi-file>[.dvi]\n", progname);#endif    fprintf(stderr, "Options are:\n");    fprintf(stderr,            " -ofile   Write output to file, else write to stdout.\n");    fprintf(stderr,            " -plist   Print pages whose TeX-page-number are in list.\n");    fprintf(stderr,            " -Plist   Print pages whose sequential number are in list.\n");    fprintf(stderr,            " -wn      Print the lines with width n characters, default 80.\n");    fprintf(stderr,            " -vn      Use n for vertical line height, default 450000.\n");    fprintf(stderr,            " -evalue  Add/Substract this value for spacing (-20..20)\n");#if !defined(MSDOS) && !defined(VMS) && !defined(THINK_C) && !defined(AMIGA)    fprintf(stderr, " -f       Try to pipe to a pager if output is a tty");    if (WANTPAGER)        fprintf(stderr, " (default).\n");    else        fprintf(stderr, ".\n");    fprintf(stderr, " -q       Don't try to pipe to a pager");    if (WANTPAGER)        fprintf(stderr, ".\n");    else        fprintf(stderr, " (default).\n");    fprintf(stderr, " -Fprog   Pipe output to pager prog.\n");#endif    fprintf(stderr,            " -a       Remove accents grave etc. from output: \\'{e} -> e.\n");    fprintf(stderr,            " -t       Assuming that document was made with tt fonts\n");    fprintf(stderr,            " -l       Write ''^L'' instead of formfeed between pages.\n");    fprintf(stderr,            " -u       National Swedish/Finnish characters printed as aaoAAO (default %s).\n", DEFSCAND ? "off" : "on");    fprintf(stderr,            " -s       National Swedish/Finnish characters printed as }{|][\\ (default %s).\n", DEFSCAND ? "on" : "off");    fprintf(stderr,            " -J       Allow processing of japanese fonts\n");    fprintf(stderr,            " -c       Override -a -u -s and print all characters 0-255.\n");    fprintf(stderr,            " -bdelim  Print font switch as text: delimcmr10miled\n");    fprintf(stderr, " -h       This help message.\n");    exit(uerr);} /* usage */

⌨️ 快捷键说明

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