www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/04/22/21:06:08

Xref: news2.mv.net comp.os.msdos.djgpp:2965
From: Maurice Massar <rm AT palatina DOT Worms DOT Fh-Rpl DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Ascii libc.inf
Date: Mon, 22 Apr 1996 20:03:16 +0200
Organization: Universitaet Kaiserslautern
Lines: 63
Message-ID: <317BC9E4.221@palatina.Worms.Fh-Rpl.de>
NNTP-Posting-Host: hopser.worms.fh-rpl.de
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Conor Hunt wrote:
> 
> Anyone made an ascii version of the libc.inf? I know it is possible
> from the faq... however I would have to d/l the source.. d/l c++ and
> figure it all out.
> 
> I have the .ps version but I don't want to print it because it looks
> terrible and takes up far too much space.  I am going to take the
> ascii version and turn it into a Msoft Word doc so I can use colums
> and compress it...
> 
> Anyone help?This programm reads all given files and write it to stdout, but three 
lines after the ascii-character # 31. This is the charackter at the 
beging of every node. The program then writes the formfeed charackter.

To use it make a tempoary copy of libc.inf and run the compiled program.
You must edit the output because there are erros at the begining of the 
output.


/* code start */
#include <stdio.h>

void main(argc, argv)
int argc;
char *argv[];
{
        int exitflag;
        FILE *fp, *fopen();

        exitflag = 0;
        if (argc == 1)
                filecopy(stdin);
        else
                while (--argc > 0)
                        if ((fp = fopen(*++argv, "r")) == NULL) {
                                fprintf(stderr, "cat: can't open %s\n", 
*argv);
                                exitflag=1;
                                continue;
                        } else {
                                filecopy(fp);
                                fclose(fp);
                        }
        exit(exitflag);
}

filecopy(fp)
FILE *fp;
{
        int c, n = 2;

        while ((c = getc(fp)) != EOF && c != 31) ;
        while ((c = getc(fp)) != EOF)
                if (c != 31) putc(c, stdout);
                else { 
                        putc('\f', stdout);
                        n = 2;
                        while ((c = getc(fp)) != EOF && n > 0)
                                if (c == '\n') n--;
                }
}
/* code end */

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019