Checkpoint.
This commit is contained in:
parent
61f5c35c94
commit
b855148c9b
74 changed files with 5281 additions and 130 deletions
|
|
@ -34,6 +34,7 @@ double matrix1[6], matrix2[6];
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
void
|
||||
cover(x, y)
|
||||
|
||||
double x, y;
|
||||
|
|
@ -65,7 +66,9 @@ cover(x, y)
|
|||
} /* End of cover */
|
||||
|
||||
/*****************************************************************************/
|
||||
void resetbbox();
|
||||
|
||||
void
|
||||
writebbox(fp, keyword, slop)
|
||||
|
||||
FILE *fp; /* the comment is written here */
|
||||
|
|
@ -117,7 +120,7 @@ writebbox(fp, keyword, slop)
|
|||
} /* End of writebbox */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void
|
||||
resetbbox(output)
|
||||
|
||||
int output;
|
||||
|
|
@ -146,7 +149,7 @@ resetbbox(output)
|
|||
} /* End of resetbbox */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void
|
||||
scale(sx, sy)
|
||||
|
||||
double sx, sy;
|
||||
|
|
@ -171,7 +174,7 @@ scale(sx, sy)
|
|||
} /* End of scale */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void
|
||||
translate(tx, ty)
|
||||
|
||||
double tx, ty;
|
||||
|
|
@ -196,7 +199,7 @@ translate(tx, ty)
|
|||
} /* End of translate */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void
|
||||
rotate(angle)
|
||||
|
||||
double angle;
|
||||
|
|
@ -223,6 +226,7 @@ rotate(angle)
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
void
|
||||
concat(m1)
|
||||
|
||||
double m1[];
|
||||
|
|
|
|||
|
|
@ -209,14 +209,14 @@ endpage(void) {
|
|||
int
|
||||
cat(char *filename) {
|
||||
Biobuf *bfile;
|
||||
Biobuf *Bfile;
|
||||
Biobufhdr *Bfile;
|
||||
int n;
|
||||
static char buf[Bsize];
|
||||
|
||||
if ((bfile = Bopen(unsharp(filename), OREAD)) == 0) {
|
||||
if ((bfile = Bopen(filename, OREAD)) == 0) {
|
||||
return(1);
|
||||
}
|
||||
Bfile = bfile;
|
||||
Bfile = bfile; /* &(bfile->Biobufhdr); */
|
||||
while ((n=Bread(Bfile, buf, Bsize)) > 0) {
|
||||
if (Bwrite(Bstdout, buf, n) != n)
|
||||
break;
|
||||
|
|
@ -240,9 +240,9 @@ galloc(void *ptr, int size, char *perstr) {
|
|||
}
|
||||
|
||||
static char *errorstrings[] = {
|
||||
{""}, /* NONE */
|
||||
{"WARNING"},
|
||||
{"FATAL"}
|
||||
"", /* NONE */
|
||||
"WARNING",
|
||||
"FATAL"
|
||||
};
|
||||
|
||||
char *programname;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@
|
|||
#define RUNEGETGROUP(a) ((a>>8)&0xff)
|
||||
#define RUNEGETCHAR(a) (a&0xff)
|
||||
|
||||
#define tempnam safe_tempnam
|
||||
|
||||
typedef int BOOLEAN;
|
||||
|
||||
#define TRUE 1
|
||||
|
|
@ -38,6 +40,6 @@ BOOLEAN isinstring(void);
|
|||
void startpage(void);
|
||||
void endpage(void);
|
||||
int cat(char *);
|
||||
int Bgetfield(Biobuf *, int, void *, int);
|
||||
int Bgetfield(Biobufhdr *, int, void *, int);
|
||||
void *galloc(void *, int, char *);
|
||||
void pagelist(char *);
|
||||
|
|
|
|||
|
|
@ -28,8 +28,12 @@ extern char *optarg; /* for getopt() */
|
|||
extern int optind;
|
||||
|
||||
extern void interrupt();
|
||||
//extern char *tempnam(char*,char*);
|
||||
extern void error();
|
||||
extern int cat();
|
||||
extern void concat();
|
||||
|
||||
/*
|
||||
* extern char *tempnam(char*,char*);
|
||||
* extern char *malloc();
|
||||
* extern char *calloc();
|
||||
* extern char *strtok();
|
||||
|
|
|
|||
|
|
@ -7,6 +7,10 @@
|
|||
|
||||
#define PROGRAMVERSION "3.3.2"
|
||||
|
||||
/* XXX: replace tempnam with something safer, but leaky */
|
||||
extern char* safe_tempnam(char*, char*);
|
||||
#define tempnam safe_tempnam
|
||||
|
||||
#define NON_FATAL 0
|
||||
#define FATAL 1
|
||||
#define USER_FATAL 2
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ getopt (argc, argv, opts)
|
|||
char **argv, *opts;
|
||||
{
|
||||
static int sp = 1;
|
||||
register c;
|
||||
register int c;
|
||||
register char *cp;
|
||||
|
||||
if (sp == 1)
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@
|
|||
#include <ctype.h>
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "gen.h"
|
||||
#include "ext.h"
|
||||
|
|
@ -17,7 +19,9 @@ int nolist = 0; /* number of specified ranges */
|
|||
int olist[50]; /* processing range pairs */
|
||||
|
||||
/*****************************************************************************/
|
||||
extern int str_convert();
|
||||
|
||||
void
|
||||
out_list(str)
|
||||
|
||||
char *str;
|
||||
|
|
@ -53,7 +57,7 @@ out_list(str)
|
|||
} /* End of out_list */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
int
|
||||
in_olist(num)
|
||||
|
||||
int num;
|
||||
|
|
@ -80,7 +84,7 @@ in_olist(num)
|
|||
} /* End of in_olist */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void
|
||||
setencoding(name)
|
||||
|
||||
char *name;
|
||||
|
|
@ -110,7 +114,7 @@ setencoding(name)
|
|||
} /* End of setencoding */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
int
|
||||
cat(file)
|
||||
|
||||
char *file;
|
||||
|
|
@ -145,6 +149,7 @@ cat(file)
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
int
|
||||
str_convert(str, err)
|
||||
|
||||
char **str;
|
||||
|
|
@ -173,6 +178,7 @@ str_convert(str, err)
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
void
|
||||
error(kind, mesg, a1, a2, a3)
|
||||
|
||||
int kind;
|
||||
|
|
@ -191,9 +197,9 @@ error(kind, mesg, a1, a2, a3)
|
|||
fprintf(stderr, "%s: ", prog_name);
|
||||
fprintf(stderr, mesg, a1, a2, a3);
|
||||
if ( lineno > 0 )
|
||||
fprintf(stderr, " (line %d)", lineno);
|
||||
fprintf(stderr, " (line %ld)", lineno);
|
||||
if ( position > 0 )
|
||||
fprintf(stderr, " (near byte %d)", position);
|
||||
fprintf(stderr, " (near byte %ld)", position);
|
||||
putc('\n', stderr);
|
||||
} /* End if */
|
||||
|
||||
|
|
|
|||
|
|
@ -4,29 +4,29 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#define DPOST "#9/sys/lib/postscript/prologues/dpost.ps"
|
||||
#define POSTBGI "#9/sys/lib/postscript/prologues/postbgi.ps"
|
||||
#define POSTDAISY "#9/sys/lib/postscript/prologues/postdaisy.ps"
|
||||
#define POSTDMD "#9/sys/lib/postscript/prologues/postdmd.ps"
|
||||
#define POSTMD "#9/sys/lib/postscript/prologues/postmd.ps"
|
||||
#define POSTPLOT "#9/sys/lib/postscript/prologues/postplot.ps"
|
||||
#define POSTPRINT "#9/sys/lib/postscript/prologues/postprint.ps"
|
||||
#define POSTNPRINT "#9/sys/lib/postscript/prologues/postnprint.ps"
|
||||
#define POSTTEK "#9/sys/lib/postscript/prologues/posttek.ps"
|
||||
#define POSTGIF "#9/sys/lib/postscript/prologues/postgif.ps"
|
||||
#define DPOST "#9/postscript/prologues/dpost.ps"
|
||||
#define POSTBGI "#9/postscript/prologues/postbgi.ps"
|
||||
#define POSTDAISY "#9/postscript/prologues/postdaisy.ps"
|
||||
#define POSTDMD "#9/postscript/prologues/postdmd.ps"
|
||||
#define POSTMD "#9/postscript/prologues/postmd.ps"
|
||||
#define POSTPLOT "#9/postscript/prologues/postplot.ps"
|
||||
#define POSTPRINT "#9/postscript/prologues/postprint.ps"
|
||||
#define POSTNPRINT "#9/postscript/prologues/postnprint.ps"
|
||||
#define POSTTEK "#9/postscript/prologues/posttek.ps"
|
||||
#define POSTGIF "#9/postscript/prologues/postgif.ps"
|
||||
|
||||
#define BASELINE "#9/sys/lib/postscript/prologues/baseline.ps"
|
||||
#define COLOR "#9/sys/lib/postscript/prologues/color.ps"
|
||||
#define DRAW "#9/sys/lib/postscript/prologues/draw.ps"
|
||||
#define FORMFILE "#9/sys/lib/postscript/prologues/forms.ps"
|
||||
#define SHADEFILE "#9/sys/lib/postscript/prologues/shade.ps"
|
||||
#define KERNING "#9/sys/lib/postscript/prologues/kerning.ps"
|
||||
#define REQUESTFILE "#9/sys/lib/postscript/prologues/ps.requests"
|
||||
#define ROUNDPAGE "#9/sys/lib/postscript/prologues/roundpage.ps"
|
||||
#define BASELINE "#9/postscript/prologues/baseline.ps"
|
||||
#define COLOR "#9/postscript/prologues/color.ps"
|
||||
#define DRAW "#9/postscript/prologues/draw.ps"
|
||||
#define FORMFILE "#9/postscript/prologues/forms.ps"
|
||||
#define SHADEFILE "#9/postscript/prologues/shade.ps"
|
||||
#define KERNING "#9/postscript/prologues/kerning.ps"
|
||||
#define REQUESTFILE "#9/postscript/prologues/ps.requests"
|
||||
#define ROUNDPAGE "#9/postscript/prologues/roundpage.ps"
|
||||
|
||||
#define ENCODINGDIR "#9/sys/lib/postscript/prologues"
|
||||
#define HOSTDIR "#9/sys/lib/postscript/font"
|
||||
#define FONTDIR "#9/sys/lib/troff/font"
|
||||
#define POSTLIBDIR "#9/sys/lib/postscript/prologues"
|
||||
#define TEMPDIR "/tmp"
|
||||
#define ENCODINGDIR "#9/postscript/prologues"
|
||||
#define HOSTDIR "#9/postscript/font"
|
||||
#define FONTDIR "#9/troff/font"
|
||||
#define POSTLIBDIR "#9/postscript/prologues"
|
||||
#define TEMPDIR "#9/tmp"
|
||||
|
||||
|
|
|
|||
|
|
@ -11,8 +11,12 @@
|
|||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "gen.h" /* general purpose definitions */
|
||||
#include "ext.h"
|
||||
#include "request.h" /* a few special definitions */
|
||||
#include "path.h" /* for the default request file */
|
||||
|
||||
|
|
@ -22,6 +26,7 @@ char *requestfile = REQUESTFILE; /* default lookup file */
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
void
|
||||
saverequest(want)
|
||||
|
||||
char *want; /* grab code for this stuff */
|
||||
|
|
@ -55,7 +60,9 @@ saverequest(want)
|
|||
} /* End of saverequest */
|
||||
|
||||
/*****************************************************************************/
|
||||
extern void dumprequest();
|
||||
|
||||
void
|
||||
writerequest(page, fp_out)
|
||||
|
||||
int page; /* write everything for this page */
|
||||
|
|
@ -80,6 +87,7 @@ writerequest(page, fp_out)
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
void
|
||||
dumprequest(want, file, fp_out)
|
||||
|
||||
char *want; /* look for this string */
|
||||
|
|
|
|||
|
|
@ -1,27 +1,62 @@
|
|||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if defined(V9) || defined(BSD4_2) || defined(plan9)
|
||||
char *tempnam(char *dir, char *pfx) {
|
||||
int pid;
|
||||
unsigned int len;
|
||||
char *tnm, *malloc();
|
||||
static int seq = 0;
|
||||
#define nil ((void*)0)
|
||||
|
||||
pid = getpid();
|
||||
len = strlen(dir) + strlen(pfx) + 10;
|
||||
if ((tnm = malloc(len)) != NULL) {
|
||||
sprintf(tnm, "%s", dir);
|
||||
if (access(tnm, 7) == -1)
|
||||
return(NULL);
|
||||
do {
|
||||
sprintf(tnm, "%s/%s%d%d", dir, pfx, pid, seq++);
|
||||
errno = 0;
|
||||
if (access(tnm, 7) == -1)
|
||||
if (errno == ENOENT)
|
||||
return(tnm);
|
||||
} while (1);
|
||||
}
|
||||
return(tnm);
|
||||
char*
|
||||
mkfname(char *tmpdir, char *prefix)
|
||||
{
|
||||
int n;
|
||||
char *p, *fname;
|
||||
|
||||
if((p = getenv("TMPDIR")) != nil)
|
||||
goto Mktemp;
|
||||
if((p = tmpdir) != nil)
|
||||
goto Mktemp;
|
||||
p = "/tmp";
|
||||
|
||||
Mktemp:
|
||||
n = strlen(p)+1+strlen(prefix)+1+8+1;
|
||||
if((fname = malloc(n)) == nil)
|
||||
return nil;
|
||||
memset(fname, 0, n);
|
||||
strcat(fname, p);
|
||||
if((n = strlen(p)) > 0 && p[n-1] != '/')
|
||||
strcat(fname, "/");
|
||||
strcat(fname, prefix);
|
||||
strcat(fname, ".XXXXXXXX");
|
||||
|
||||
return fname;
|
||||
}
|
||||
|
||||
extern int mkstemp();
|
||||
|
||||
char*
|
||||
safe_tempnam(char *tmpdir, char *prefix)
|
||||
{
|
||||
int fd;
|
||||
char *fname;
|
||||
|
||||
if((fname = mkfname(tmpdir, prefix)) == nil)
|
||||
return nil;
|
||||
|
||||
if((fd = mkstemp(fname)) < 0){ /* XXX: leak fd, fname */
|
||||
free(fname);
|
||||
return nil;
|
||||
}
|
||||
return fname;
|
||||
}
|
||||
|
||||
int
|
||||
safe_tmpnam(char *fname)
|
||||
{
|
||||
char *p;
|
||||
|
||||
if((p = mkfname(nil, "tmpfile")) == nil)
|
||||
return -1;
|
||||
strcpy(fname, p);
|
||||
free(p);
|
||||
return mkstemp(fname);
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue