Super Plot (5 of 8)
Marc Majka
majka at ubc-vision.UUCP
Mon Apr 28 08:50:37 AEST 1986
- - - CUT - - - CUT - - - CUT - - - CUT - - - CUT - - - CUT - - - CUT - - -
#!/bin/sh
#
# shell archive - extract with /bin/sh
#
echo Plot archive part 5 of 8
echo
echo extracting file pltx.c
sed 's/^X//' > pltx.c <<'!FUNKY!STUFF!'
X/*************************************************************/
X/* */
X/* Copyright (c) 1986 */
X/* Marc S. Majka - UBC Laboratory for Computational Vision */
X/* */
X/* Permission is hereby granted to copy all or any part of */
X/* this program for free distribution. The author's name */
X/* and this copyright notice must be included in any copy. */
X/* */
X/*************************************************************/
X
X#include <stdio.h>
X
Xmain (argc, argv)
Xint argc;
Xchar *argv[];
X{
X FILE *pfp, *fopen();
X
X if (argc > 1) pfp = fopen(argv[1],"r");
X else pfp = stdin;
X
X if (pfp == NULL) {
X fprintf(stderr,"pltx: can't open input plot file\n");
X exit(1);
X }
X if (argc > 2) plotopen(argv[2]);
X else plotopen("");
X
X plotdriver();
X plotclose();
X fclose(pfp);
X exit(0);
X}
!FUNKY!STUFF!
echo extracting file pltx.man
sed 's/^X//' > pltx.man <<'!FUNKY!STUFF!'
XPLTX(1) UNIX Programmer's Manual PLTX(1)
X
X
XNAME
X pltx - converts plot files to text files
X
XSYNOPSIS
X pltx [plot-file [text-file]]
X
XDESCRIPTION
X pltx reads a plot file and writes a text file. It is the
X inverse of txpl(1-UBC). See the manual for fplot for a
X description of plot files.
X
XAUTHOR
X Marc Majka
!FUNKY!STUFF!
echo extracting file rplot.c
sed 's/^X//' > rplot.c <<'!FUNKY!STUFF!'
X/*************************************************************/
X/* */
X/* Copyright (c) 1986 */
X/* Marc S. Majka - UBC Laboratory for Computational Vision */
X/* */
X/* Permission is hereby granted to copy all or any part of */
X/* this program for free distribution. The author's name */
X/* and this copyright notice must be included in any copy. */
X/* */
X/*************************************************************/
X
X#include <stdio.h>
X
Xgetarg(desig,argc,argv)
Xint argc;
Xchar *desig, *argv[];
X{
X int argn;
X char minus[2], lookfor[12];
X
X strcpy(minus,"-");
X strcpy(lookfor,minus);
X strcat(lookfor,desig);
X
X for (argn = 1; argn < argc; argn++)
X if (!strcmp(argv[argn],lookfor)) return(argn);
X
X return (0);
X}
X
X#define GETARG(X) getarg(X,argc,argv)
X
Xmain (argc, argv)
Xint argc;
Xchar *argv[];
X{
X FILE *plt, *fopen();
X int argn, nargs, nrows, ncols, sized;
X char nullname[2];
X
X if (GETARG("help")) {
X printf("useage: rpl [[plotfile] rasterfile] [-r n] [-c n]\n");
X printf(" plotfile is the input plot file\n");
X printf(" rasterfile is the output raster file\n");
X printf(" -r nrows [default = 256]\n");
X printf(" -c ncols [default = 256]\n");
X exit(0);
X }
X
X nargs = argc - 1;
X sized = 0;
X
X nrows = GETARG("r");
X if (nrows) {
X nrows = atoi(argv[++nrows]);
X sized = 1;
X nargs -= 2;
X }
X ncols = GETARG("c");
X if (ncols) {
X ncols = atoi(argv[++ncols]);
X sized = 1;
X nargs -= 2;
X }
X else ncols = nrows;
X
X if (nargs == 0) {
X plt = stdin;
X plotopen("");
X }
X else if (nargs == 1) {
X plt = stdin;
X plotopen(argv[1]);
X }
X else {
X plt = fopen(argv[1],"r");
X plotopen(argv[2]);
X }
X
X if (plt == NULL) {
X printf("rpl: can't open plot file\n");
X exit(1);
X }
X
X if (sized) frame(0,0,nrows-1,ncols-1,0);
X plotdriver(plt);
X plotclose();
X exit(0);
X}
!FUNKY!STUFF!
echo extracting file rplot.man
sed 's/^X//' > rplot.man <<'!FUNKY!STUFF!'
XRPLOT(1) UNIX Programmer's Manual RPLOT(1)
X
XNAME
X rplot - renders a plot file in a memory raster.
X
XSYNOPSIS
X rplot [[plotfile] rasterfile] [-r n] [-c n]
X
XDESCRIPTION
X rplot reads a plot file, and executes the plot commands,
X using a file for output, rather than a device. If two
X arguments are given, the first should be a plot file, and
X the second will be used as the output file. If only one
X argument is given, it is used as the output file, and
X plot commands are read from standard input. If none are
X given, output will be to standard output. See the manual
X page for fplot(3) for a description of the plot file
X format used by rplot.
X
X Any options to must be given after the input and output file
X names. The options recognized are:
X
X -r the next parameter given is to be used as the number of
X rows in the output raster. A frame command will override
X this setting.
X
X -c sets the number of output columns, as above. If the -r
X option is given without a -c option, the number of
X columns will be the same as the number of rows.
X
XLIMITATIONS
X Maximum image size is 512 x 512 x 32 bpp. Can be recompiled
X if you need more.
X
XAUTHOR
X Marc Majka
!FUNKY!STUFF!
echo extracting file txfns.c
sed 's/^X//' > txfns.c <<'!FUNKY!STUFF!'
X/*************************************************************/
X/* */
X/* Copyright (c) 1986 */
X/* Marc S. Majka - UBC Laboratory for Computational Vision */
X/* */
X/* Permission is hereby granted to copy all or any part of */
X/* this program for free distribution. The author's name */
X/* and this copyright notice must be included in any copy. */
X/* */
X/*************************************************************/
X
X#include <stdio.h>
X
Xstatic FILE *tfp;
X
Xplotopen(fname)
Xchar *fname;
X{
X FILE *fopen();
X
X if (fname[0] == '\0') tfp = stdout;
X else tfp = fopen(fname,"w");
X
X if (tfp == NULL) {
X fprintf(stderr,"plotopen: can't open output text file %s\n",fname);
X exit(1);
X }
X}
X
Xplotclose()
X{
X fclose(tfp);
X}
X
Xmove(x1,y1)
Xshort x1,y1;
X{
X fprintf(tfp,"move %hd %hd\n",x1,y1);
X}
X
Xcont(x1,y1)
Xshort x1,y1;
X{
X fprintf(tfp,"cont %hd %hd\n",x1,y1);
X}
X
Xbspline(k,n,v)
Xshort k, n, *v;
X{
X short vn, indx, x, y;
X
X fprintf(tfp,"bspline %hd %hd\n",k,n);
X indx = 0;
X for (vn = 0; vn < n; vn++) {
X x = v[indx++]; y = v[indx++];
X fprintf(tfp," %hd %hd\n",x,y);
X }
X}
X
Xpolygon(n,v)
Xshort n, *v;
X{
X short vn, indx, x, y;
X
X fprintf(tfp,"polygon %hd\n",n);
X indx = 0;
X for (vn = 0; vn < n; vn++) {
X x = v[indx++]; y = v[indx++];
X fprintf(tfp," %hd %hd\n",x,y);
X }
X}
X
Xchain(n,v)
Xshort n, *v;
X{
X short vn, indx, x, y;
X
X fprintf(tfp,"chain %hd\n",n);
X indx = 0;
X for (vn = 0; vn < n; vn++) {
X x = v[indx++]; y = v[indx++];
X fprintf(tfp," %hd %hd\n",x,y);
X }
X}
X
Xmoverel(x1,y1)
Xshort x1,y1;
X{
X fprintf(tfp,"moverel %hd %hd\n",x1,y1);
X}
X
Xcontrel(x1,y1)
Xshort x1,y1;
X{
X fprintf(tfp,"contrel %hd %hd\n",x1,y1);
X}
X
Xarea(x1,y1)
Xshort x1,y1;
X{
X fprintf(tfp,"area %hd %hd\n",x1,y1);
X}
X
Xpoint(x1,y1)
Xshort x1,y1;
X{
X fprintf(tfp,"point %hd %hd\n",x1,y1);
X}
X
Xline(x1,y1,x2,y2)
Xshort x1,y1,x2,y2;
X{
X fprintf(tfp,"line %hd %hd %hd %hd\n",x1,y1,x2,y2);
X}
X
Xlabel(str)
Xchar *str;
X{
X fprintf(tfp,"label %s\n",str);
X}
X
Xclabel(str)
Xchar *str;
X{
X fprintf(tfp,"clabel %s\n",str);
X}
X
Xblabel(w,h,str)
Xshort w,h;
Xchar *str;
X{
X fprintf(tfp,"blabel %hd %hd %s\n",w,h,str);
X}
X
Xllabel(w,h,str)
Xshort w,h;
Xchar *str;
X{
X fprintf(tfp,"llabel %hd %hd %s\n",w,h,str);
X}
X
Xcomment(str)
Xchar *str;
X{
X fprintf(tfp,"comment %s\n",str);
X}
X
Xfont(str)
Xchar *str;
X{
X fprintf(tfp,"font %s\n",str);
X}
X
Xfspec(ws,hs,theta)
Xdouble ws,hs,theta;
X{
X fprintf(tfp,"fspec %lf %lf %lf\n",ws,hs,theta);
X}
X
Xfillpat(pn,x1,y1,str)
Xshort pn,x1,y1;
Xchar *str;
X{
X int i,j;
X
X fprintf(tfp,"fillpat %hd %hd %hd\n",pn,x1,y1);
X pn = 0;
X for (i = 0; i < x1; i++) {
X fprintf(tfp,"\t");
X for (j = 0; j < y1; j++) fprintf(tfp,"%c",str[pn++]);
X fprintf(tfp,"\n");
X }
X}
X
Xsetpat(pn)
Xshort pn;
X{
X fprintf(tfp,"setpat %hd\n",pn);
X}
X
Xpensize(pn)
Xshort pn;
X{
X fprintf(tfp,"pensize %hd\n",pn);
X}
X
Xarc(x1,y1,x2,y2,x3,y3)
Xshort x1,y1,x2,y2,x3,y3;
X{
X fprintf(tfp,"arc %hd %hd %hd %hd %hd %hd\n",x1,y1,x2,y2,x3,y3);
X}
X
Xcircle(x1,y1,r)
Xshort x1,y1,r;
X{
X fprintf(tfp,"circle %hd %hd %hd\n",x1,y1,r);
X}
X
Xerase()
X{
X fprintf(tfp,"erase\n");
X}
X
Xstartp()
X{
X fprintf(tfp,"startp\n");
X}
X
Xendp()
X{
X fprintf(tfp,"endp\n");
X}
X
Xlinemod(str)
Xchar *str;
X{
X fprintf(tfp,"linemod %s\n",str);
X}
X
Xframe(x1,y1,x2,y2,hv)
Xshort x1,y1,x2,y2,hv;
X{
X fprintf(tfp,"frame %hd %hd %hd %hd %hd\n",x1,y1,x2,y2,hv);
X}
X
Xbppin(b)
Xshort b;
X{
X fprintf(tfp,"bppin %hd\n",b);
X}
X
Xbppout(b)
Xshort b;
X{
X fprintf(tfp,"bppout %hd\n",b);
X}
X
Xspace(x1,y1,x2,y2,hv)
Xshort x1,y1,x2,y2,hv;
X{
X fprintf(tfp,"space %hd %hd %hd %hd %hd\n",x1,y1,x2,y2,hv);
X}
X
Xgray(g)
Xshort g;
X{
X fprintf(tfp,"gray %hd\n",g);
X}
X
Xcolour(red,green,blue)
Xshort red,green,blue;
X{
X fprintf(tfp,"colour %hd %hd %hd\n",red,green,blue);
X}
!FUNKY!STUFF!
echo extracting file txpl.c
sed 's/^X//' > txpl.c <<'!FUNKY!STUFF!'
X/*************************************************************/
X/* */
X/* Copyright (c) 1986 */
X/* Marc S. Majka - UBC Laboratory for Computational Vision */
X/* */
X/* Permission is hereby granted to copy all or any part of */
X/* this program for free distribution. The author's name */
X/* and this copyright notice must be included in any copy. */
X/* */
X/*************************************************************/
X
X#include <stdio.h>
X
Xmain (argc, argv)
Xint argc;
Xchar *argv[];
X{
X char str[1024], comm[16], nl, c;
X int i, patn;
X short x1, y1, x2, y2, x3, y3, r, gray, red, green, blue, hv, pn, n, k;
X FILE *tfp, *pfp, *fopen();
X double ws, hs, theta;
X
X if (argc > 1) tfp = fopen(argv[1],"r");
X else tfp = stdin;
X
X if (tfp == NULL) {
X fprintf(stderr,"txpl: can't open input text file\n");
X exit(1);
X }
X
X if (argc > 2) pfp = fopen(argv[2],"w");
X else pfp = stdout;
X
X if (pfp == NULL) {
X fprintf(stderr,"txpl: can't open output plot file\n");
X exit(1);
X }
X
X while (fscanf(tfp,"%s", comm) != EOF) {
X if (0 == strcmp(comm,"move")) {
X fscanf(tfp,"%hd%hd",
X &x1,&y1);
X fprintf(pfp,"m");
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"cont")) {
X fscanf(tfp,"%hd%hd",
X &x1,&y1);
X fprintf(pfp,"n");
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"bspline")) {
X fscanf(tfp,"%hd",&k);
X fscanf(tfp,"%hd",&n);
X fprintf(pfp,"k");
X fwrite(&k,2,1,pfp);
X fwrite(&n,2,1,pfp);
X for (i = 0; i < n; i++) {
X fscanf(tfp,"%hd%hd",&x1,&y1);
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X }
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"bsphd")) {
X fscanf(tfp,"%hd",&k);
X fscanf(tfp,"%hd",&n);
X fprintf(pfp,"k");
X fwrite(&k,2,1,pfp);
X fwrite(&n,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"bsppt")) {
X fscanf(tfp,"%hd%hd",&x1,&y1);
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"polygon")) {
X fscanf(tfp,"%hd",&n);
X fprintf(pfp,"o");
X fwrite(&n,2,1,pfp);
X for (i = 0; i < n; i++) {
X fscanf(tfp,"%hd%hd",&x1,&y1);
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X }
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"polyhd")) {
X fscanf(tfp,"%hd",&n);
X fprintf(pfp,"o");
X fwrite(&n,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"polypt")) {
X fscanf(tfp,"%hd%hd",&x1,&y1);
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"chain")) {
X fscanf(tfp,"%hd",&n);
X fprintf(pfp,"L");
X fwrite(&n,2,1,pfp);
X for (i = 0; i < n; i++) {
X fscanf(tfp,"%hd%hd",&x1,&y1);
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X }
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"chainhd")) {
X fscanf(tfp,"%hd",&n);
X fprintf(pfp,"L");
X fwrite(&n,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"chainpt")) {
X fscanf(tfp,"%hd%hd",&x1,&y1);
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"moverel")) {
X fscanf(tfp,"%hd%hd",&x1,&y1);
X fprintf(pfp,"M");
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"contrel")) {
X fscanf(tfp,"%hd%hd",
X &x1,&y1);
X fprintf(pfp,"N");
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"point")) {
X fscanf(tfp,"%hd%hd",
X &x1,&y1);
X fprintf(pfp,"p");
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"area")) {
X fscanf(tfp,"%hd%hd",&x1,&y1);
X fprintf(pfp,"A");
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"line")) {
X fscanf(tfp,"%hd%hd%hd%hd",
X &x1,&y1,&x2,&y2);
X fprintf(pfp,"l");
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fwrite(&x2,2,1,pfp);
X fwrite(&y2,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"label")) {
X fscanf(tfp,"%1s",&c);
X i = 0;
X
X while (c != '\n') {
X str[i++] = c;
X fscanf(tfp,"%c",&c);
X }
X str[i] = '\0';
X fprintf(pfp,"t%s\n",str);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"clabel")) {
X fscanf(tfp,"%1s",&c);
X i = 0;
X
X while (c != '\n') {
X str[i++] = c;
X fscanf(tfp,"%c",&c);
X }
X str[i] = '\0';
X fprintf(pfp,"%%%s\n",str);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"blabel")) {
X fscanf(tfp,"%hd%hd",&x1,&y1);
X fscanf(tfp,"%1s",&c);
X i = 0;
X
X while (c != '\n') {
X str[i++] = c;
X fscanf(tfp,"%c",&c);
X }
X str[i] = '\0';
X fprintf(pfp,"U");
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fprintf(pfp,"%s\n",str);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"llabel")) {
X fscanf(tfp,"%hd%hd",&x1,&y1);
X fscanf(tfp,"%1s",&c);
X i = 0;
X
X while (c != '\n') {
X str[i++] = c;
X fscanf(tfp,"%c",&c);
X }
X str[i] = '\0';
X fprintf(pfp,"V");
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fprintf(pfp,"%s\n",str);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"comment")) {
X fscanf(tfp,"%1s",&c);
X i = 0;
X
X while (c != '\n') {
X str[i++] = c;
X fscanf(tfp,"%c",&c);
X }
X str[i] = '\0';
X fprintf(pfp,";%s\n",str);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"font")) {
X fscanf(tfp,"%s",str);
X fprintf(pfp,"X%s\n",str);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"fspec")) {
X fscanf(tfp,"%lf%lf%lf",&ws,&hs,&theta);
X fprintf(pfp,"S");
X fwrite(&ws,4,1,pfp);
X fwrite(&hs,4,1,pfp);
X fwrite(&theta,4,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"fillpat")) {
X fscanf(tfp,"%hd%hd%hd",&pn,&x1,&y1);
X fscanf(tfp,"%1s",&c);
X patn = x1 * y1;
X i = 0;
X
X while (i < patn) {
X if ((c != '\n') && (c != ' ') && (c != '\t'))
X str[i++] = c;
X fscanf(tfp,"%c",&c);
X }
X str[i] = '\0';
X fprintf(pfp,"P");
X fwrite(&pn,2,1,pfp);
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fprintf(pfp,"%s\n",str);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"setpat")) {
X fscanf(tfp,"%hd",&pn);
X fprintf(pfp,"T");
X fwrite(&pn,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"pensize")) {
X fscanf(tfp,"%hd",&pn);
X fprintf(pfp,"d");
X fwrite(&pn,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"arc")) {
X fscanf(tfp,
X "%hd%hd%hd%hd%hd%hd",
X &x1,&y1,&x2,&y2,&x3,&y3);
X fprintf(pfp,"a");
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fwrite(&x2,2,1,pfp);
X fwrite(&y2,2,1,pfp);
X fwrite(&x3,2,1,pfp);
X fwrite(&y3,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"circle")) {
X fscanf(tfp,"%hd%hd%hd",
X &x1,&y1,&r);
X fprintf(pfp,"c");
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fwrite(&r,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"erase")) {
X fprintf(pfp,"e");
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"startp")) {
X fprintf(pfp,"[");
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"endp")) {
X fprintf(pfp,"]");
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"linemod")) {
X fscanf(tfp,"%s",
X str);
X fprintf(pfp,"f%s\n",str);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"frame")) {
X fscanf(tfp,"%hd%hd%hd%hd%hd",
X &x1,&y1,&x2,&y2,&hv);
X fprintf(pfp,"F");
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fwrite(&x2,2,1,pfp);
X fwrite(&y2,2,1,pfp);
X fwrite(&hv,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"bpp")) {
X fscanf(tfp,"%hd",&x1);
X fprintf(stderr,"warning: bpp command is out of date.\n");
X fprintf(stderr," please change to bppin(b) or bppout(b)\n");
X fprintf(stderr," see the manual entry for fplot(3-UBC)\n");
X fprintf(stderr," assuming bppin %hd for bpp %hd\n",x1,x1);
X fprintf(pfp,"B");
X fwrite(&x1,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"bppin")) {
X fscanf(tfp,"%hd",&x1);
X fprintf(pfp,"B");
X fwrite(&x1,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"bppout")) {
X fscanf(tfp,"%hd",&x1);
X fprintf(pfp,"b");
X fwrite(&x1,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"space")) {
X fscanf(tfp,"%hd%hd%hd%hd%hd",
X &x1,&y1,&x2,&y2,&hv);
X fprintf(pfp,"s");
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fwrite(&x2,2,1,pfp);
X fwrite(&y2,2,1,pfp);
X fwrite(&hv,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"gray")) {
X fscanf(tfp,"%hd",&gray);
X fprintf(pfp,"g");
X fwrite(&gray,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"colour")) {
X fscanf(tfp,"%hd",&red);
X fscanf(tfp,"%hd",&green);
X fscanf(tfp,"%hd",&blue);
X fprintf(pfp,"C");
X fwrite(&red,2,1,pfp);
X fwrite(&green,2,1,pfp);
X fwrite(&blue,2,1,pfp);
X fflush(pfp);
X }
X else {
X fprintf(stderr,"txpl: unknown command %s\n", comm);
X while ('\n' != (c = getc(tfp)));
X }
X }
X fclose(pfp);
X exit(0);
X}
X
!FUNKY!STUFF!
echo extracting file txpl.man
sed 's/^X//' > txpl.man <<'!FUNKY!STUFF!'
XTXPL(1) UNIX Programmer's Manual TXPL(1)
X
XNAME
X txpl - converts text files to plot files
X
XSYNOPSIS
X txpl [text-file [plot-file]]
X
XDESCRIPTION
X txpl reads a text file and writes a plot file. It is the
X inverse of pltx(1). The input text file should have 1
X command per line, with commands and operands separated by at
X least one space. See the manual page for fplot(3) for a
X specification of plot files.
X
XAUTHOR
X Marc Majka
!FUNKY!STUFF!
echo
echo finished part 5 of 8
More information about the Comp.sources.unix
mailing list