🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.soft-sys.andrew
Article #1282

ez -> text

#1282
From: Bill Janssen
Date: Thu, 13 Dec 1990 01:28
59 lines
2002 bytes
Thanks to Nathaniel for providing the insight into the UnScribe routines
I've been waiting for.  I re-wrote his code a bit, turning it into even
a simpler program, that just unscribes (called ez2text).  Now it's easy
to wrap in a shell script, to do what ezview does, and even more (mine
sets up the CLASSPATH, and defines LD_LIBRARY_PATH, etc.).  Enjoy.

Imakefile:
======================================================================
OBJS2 = ez2text.o
CFLAGS = -Bstatic

LIBS= ${BASEDIR}/lib/libmail.a ${UTILLIB}

NormalObjectRule()

ProgramTarget(ez2text, ${OBJS2}, ${LIBS} , )

DependTarget()

InstallProgram(ez2text, ${DESTDIR}/bin)



C code:
======================================================================
#include <stdio.h>
#include <mail.h> /* from andrew distribution */
#include <sys/file.h>

/* Compile this with cc -I$ANDREWDIR/include ez2text.c
$ANDREWDIR/lib/libmail.a $ANDREWDIR/lib/libutil.a -o ez2text */

main(argc, argv)
int argc;
char **argv;
{
    struct ScribeState ScribeState;
    int bytes, code, fd;
    char BigBuf[5000];

    if (argc < 2)
      {
      fprintf (stderr, "Usage:  ez2text filename\n");
      exit(1);
      }
    fd = open(argv[1], O_RDONLY);
    if (fd < 0)
      {
      fprintf (stderr, "ez2text:  Couldn't open file %s.\n", argv[1]);
      exit(-1);
      }
    code = UnScribeInit("12", &ScribeState);
    while ((bytes = read(fd, BigBuf, sizeof(BigBuf) - 1)) > 0) {
      UnScribe(code, &ScribeState, BigBuf, bytes, stdout);
      }
    UnScribeFlush(code, &ScribeState, stdout);
    close (fd);
    exit(0);
}
Technical Details
Message-ID: <cbNhYmUB0KGWQ1SkB8@holmes.parc.xerox.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ucbvax!parc.xerox.com!janssen

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ucbvax!parc.xerox.com!janssen
From: janssen@parc.xerox.com (Bill Janssen)
Newsgroups: comp.soft-sys.andrew
Subject: ez -> text
Message-ID: <cbNhYmUB0KGWQ1SkB8@holmes.parc.xerox.com>
Date: 13 Dec 90 01:28:18 GMT
Sender: daemon@ucbvax.BERKELEY.EDU
Organization: The Internet
Lines: 59