Ejemplo n.º 1
0
Archivo: main.c Proyecto: 99years/plan9
void
main(u32int ax, u32int bx)
{
	vlong hz;

	memset(edata, 0, end - edata);

	/*
	 * ilock via i8250enable via i8250console
	 * needs m->machno, sys->machptr[] set, and
	 * also 'up' set to nil.
	 */
	cgapost(sizeof(uintptr)*8);
	memset(m, 0, sizeof(Mach));
	m->machno = 0;
	m->online = 1;
	m->nixtype = NIXTC;
	sys->machptr[m->machno] = &sys->mach;
	m->stack = PTR2UINT(sys->machstk);
	m->vsvm = sys->vsvmpage;
	up = nil;
	active.nonline = 1;
	active.exiting = 0;
	active.nbooting = 0;
	asminit();
	multiboot(ax, bx, 0);
	options(oargc, oargv);
	crapoptions();

	/*
	 * Need something for initial delays
	 * until a timebase is worked out.
	 */
	m->cpuhz = 2000000000ll;
	m->cpumhz = 2000;

	cgainit();
	i8250console("0");
	consputs = cgaconsputs;

	vsvminit(MACHSTKSZ, NIXTC);

	conf.nmach = 1;			

	fmtinit();
	print("\nNIX\n");
	if(vflag){
		print("&ax = %#p, ax = %#ux, bx = %#ux\n", &ax, ax, bx);
		multiboot(ax, bx, vflag);
	}

	m->perf.period = 1;
	if((hz = archhz()) != 0ll){
		m->cpuhz = hz;
		m->cyclefreq = hz;
		m->cpumhz = hz/1000000ll;
	}

	/*
	 * Mmuinit before meminit because it
	 * flushes the TLB via m->pml4->pa.
	 */
	mmuinit();

	ioinit();
	kbdinit();
	meminit();
	confinit();
	archinit();
	mallocinit();

	/*
	 * Acpiinit will cause the first malloc
	 * call to happen.
	 * If the system dies here it's probably due
	 * to malloc not being initialised
	 * correctly, or the data segment is misaligned
	 * (it's amazing how far you can get with
	 * things like that completely broken).
	 */
	acpiinit();
	
	umeminit();
	trapinit();
	printinit();

	/*
	 * This is necessary with GRUB and QEMU.
	 * Without it an interrupt can occur at a weird vector,
	 * because the vector base is likely different, causing
	 * havoc. Do it before any APIC initialisation.
	 */
	i8259init(32);


	procinit0();
	mpsinit(maxcores);
	apiconline();
	sipi();

	timersinit();
	kbdenable();
	fpuinit();
	psinit(conf.nproc);
	initimage();
	links();
	devtabreset();
	pageinit();
	swapinit();
	userinit();
	nixsquids();
testiccs();	
print("schedinit...\n");
	schedinit();
}
Ejemplo n.º 2
0
extern void user_password_analysis_init(){
    psinit();
    register_job(JOB_TYPE_USERANDPASSWORD,process_function,process_judege,CALL_BY_HTTP_ANALYSIS);
}
Ejemplo n.º 3
0
void
main(uint32_t mbmagic, uint32_t mbaddress)
{
	Mach *m = entrym;
	/* when we get here, entrym is set to core0 mach. */
	sys->machptr[m->machno] = m;
	// Very special case for BSP only. Too many things
	// assume this is set.
	wrmsr(GSbase, PTR2UINT(&sys->machptr[m->machno]));
	if (machp() != m)
		panic("m and machp() are different!!\n");
	assert(sizeof(Mach) <= PGSZ);

	/*
	 * Check that our data is on the right boundaries.
	 * This works because the immediate value is in code.
	 */
	if (x != 0x123456) 
		panic("Data is not set up correctly\n");
	memset(edata, 0, end - edata);

	m = (void *) (KZERO + 1048576 + 11*4096);
	sys = (void *) (KZERO + 1048576);

	/*
	 * ilock via i8250enable via i8250console
	 * needs m->machno, sys->machptr[] set, and
	 * also 'up' set to nil.
	 */
	cgapost(sizeof(uintptr_t)*8);
	memset(m, 0, sizeof(Mach));

	m->machno = 0;
	m->online = 1;
	m->nixtype = NIXTC;
	sys->machptr[m->machno] = &sys->mach;
	m->stack = PTR2UINT(sys->machstk);
	*(uintptr_t*)m->stack = STACKGUARD;
	m->vsvm = sys->vsvmpage;
	m->externup = (void *)0;
	active.nonline = 1;
	active.exiting = 0;
	active.nbooting = 0;

	asminit();
	multiboot(mbmagic, mbaddress, 0);
	options(oargc, oargv);

	/*
	 * Need something for initial delays
	 * until a timebase is worked out.
	 */
	m->cpuhz = 2000000000ll;
	m->cpumhz = 2000;

	cgainit();
	i8250console("0");
	
	consputs = cgaconsputs;

	/* It all ends here. */
	vsvminit(MACHSTKSZ, NIXTC, m);
	if (machp() != m)
		panic("After vsvminit, m and machp() are different");

	sys->nmach = 1;	
	
	fmtinit();
	print("\nHarvey\n");

	if(vflag){
		multiboot(mbmagic, mbaddress, vflag);
	}

	m->perf.period = 1;
	if((hz = archhz()) != 0ll){
		m->cpuhz = hz;
		m->cyclefreq = hz;
		m->cpumhz = hz/1000000ll;
	}
	//iprint("archhz returns 0x%lld\n", hz);
	//iprint("NOTE: if cpuidhz runs too fast, we get die early with a NULL pointer\n");
	//iprint("So, until that's fixed, we bring up AP cores slowly. Sorry!\n");

	/*
	 * Mmuinit before meminit because it
	 * flushes the TLB via m->pml4->pa.
	 */
	mmuinit();

	ioinit();
	meminit();
	confinit();
	archinit();
	mallocinit();

	/* test malloc. It's easier to find out it's broken here, 
	 * not deep in some call chain.
	 * See next note. 
	 *
	void *v = malloc(1234);
	hi("v "); put64((uint64_t)v); hi("\n");
	free(v);
	hi("free ok\n");
	 */

	/*
	 * Acpiinit will cause the first malloc
	 * call to happen.
	 * If the system dies here it's probably due
	 * to malloc not being initialised
	 * correctly, or the data segment is misaligned
	 * (it's amazing how far you can get with
	 * things like that completely broken).
	 */
if (0){	acpiinit(); hi("	acpiinit();\n");}
	
	umeminit();
	trapinit();

	/*
	 * This is necessary with GRUB and QEMU.
	 * Without it an interrupt can occur at a weird vector,
	 * because the vector base is likely different, causing
	 * havoc. Do it before any APIC initialisation.
	 */
	i8259init(32);


	procinit0();
	mpsinit(maxcores);
	apiconline();
	/* Forcing to single core if desired */
	if(!nosmp) {
		sipi();
	}
	teardownidmap(m);
	timersinit();
	fpuinit();
	psinit(conf.nproc);
	initimage();
	links();

	keybinit();
	keybenable();
	mouseenable();

	devtabreset();
	pageinit();
	swapinit();
	userinit();
	/* Forcing to single core if desired */
	if(!nosmp) {
		nixsquids();
		testiccs();
	}

	print("CPU Freq. %dMHz\n", m->cpumhz);

	print("schedinit...\n");
	schedinit();
}
Ejemplo n.º 4
0
void
main(int argc, char *argv[]) {
	int i, fd = 0;
	double xmag = 1.0, ymag = 1.0;
	char *optstr, *Patch;
	Memimage *memimage;

	Patch = nil;
	for (i=1; i<argc; i++) {
		if (*argv[i] != '-') break;
		switch(argv[i][1]) {
		case 'b':
			if (argv[i][2] == '\0')
				dpi = atoi(argv[++i]);
			else
				dpi = atoi(&(argv[i][2]));
			break;
		case 'd':
			debug = 1;
			break;
		case 'm':
			if (argv[i][2] == '\0')
				optstr = argv[++i];
			else
				optstr = &(argv[i][2]);
			if ((optstr=strtok(optstr, " ,")) != 0)
				xmag = ymag = atof(optstr);
			if ((optstr=strtok(0, " ,")) != 0)
				ymag = atof(optstr);
			break;
		case 'L':
			landscape = 1;
			break;
		case 'P':
			if (argv[i][2] == '\0')
				Patch = argv[++i];
			else
				Patch = &(argv[i][2]);
			break;
		case 'p':
			optstr = argv[++i];
			if(optstr == nil)
				goto Usage;
			paperlength = 72*atof(optstr);
			optstr = argv[++i];
			if(optstr == nil)
				goto Usage;
			paperwidth = 72*atof(optstr);
			if(paperlength < 72 || paperwidth < 72)
				goto Usage;
			break;
		default:
		Usage:
			fprint(2, "usage: %s [-b dpi] [-m magnification] [-L] [-P postscript_patch_string] [-p paperlength paperwidth (in inches)] inputfile\n", argv[0]);
			exits("usage");
		}
	}

	if (i < argc) {
		file = argv[i];
		fd = open(file, OREAD);
		if (fd < 0)
			error("open");
	}

	memimageinit();
	memimage = readmemimage(fd);
	if(memimage == nil)
		error("alloc memory for");

	psinit(0, 0);
	if(xmag != 1.0)
		psopt("xmagnification", &xmag);
	if(ymag != 1.0)
		psopt("ymagnification", &ymag);
	if(landscape)
		psopt("landscape", &landscape);
	if(Patch)
		psopt("Patch", &Patch);
	image2psfile(1, memimage, dpi);
	exits("");
}
Ejemplo n.º 5
0
static int job_setup(void)
{
    int length, i, c;    
    int16 stds_buff[240];
    Pfd sysfd;
	int temp_reg_length = 0;
	int temp_trim = 0;

	float fcolor;
	int ii;
	char pdfword[8192];
	char pdftmp[8192];
	char pdfc[5];
	char *p;

	PdfActive = 0;				/* Assume no PDF style given, thus 
									no PDF output desired.  */
	/* Clear PDF values - Set defaults for menu items left blank  */
	/*   (all assuming that PDF output is active).  */
	pdflinkctr = 0;
	pdflinkAtSOL = 0;

	job_link.btype=3; /* none */
	job_link.weight=1;
	job_link.bcolor=000000000; /* White */
	strcpy(job_link.ocolor,"0 0 0");
	job_link.dashlen=4;
	job_link.dashgap=4;
	job_link.radius=0;

	pdf_info.title[0] = '\0';
	pdf_info.auth[0] = '\0';
	pdf_info.subj[0] = '\0';
	pdf_info.keyw[0] = '\0';
	pdf_info.creator[0] = '\0';
	pdf_info.date1[0] = '\0';
	pdf_info.date2[0] = '\0';

	pdf_docview.initpage=1;
	pdf_docview.initdisp=2; /* page only */
	pdf_docview.initsize=2; /* fit zoom */
	pdf_docview.initzoom=0; /* full screen */

	pdf_note_disp=0;
	pdf_note_length=60;
	pdf_note_depth=60;
	pdf_note_color=255255255;
	strcpy(pdf_note_ocolor,"1 1 1");

	pdf_output_lev = 9; /* all levels */
	pdf_crop_cw = pdf_crop_cd = 0;	/* No crop box. */
	pdf_crop_dw = pdf_crop_dd = 0;
	pdf_crop_cox = pdf_crop_coy = pdf_crop_cex = pdf_crop_cey = 0;
	pdf_crop_dox = pdf_crop_doy = pdf_crop_dex = pdf_crop_dey = 0;

    set_traces(msg[7].answer);
#ifdef TRACE
    if(debugger_trace)
    {
		for (i=0; i<KEYWORD_COUNT; i++)
			p_info(PI_TRACE, "i= %d, Keyword %s, Value= %s \n",
				   i,msg[i].keyword,msg[i].answer);
    }
#endif
	if (msg[68].answer[0])
		LockFlag = 0;
	else
		LockFlag = 1;
	FirstGal = 0;
	LastGal = 1000000;
    if ( !msg[6].answer[0])
    {							/* no Tree name present */
		if( !msg[7].answer[0])
		{						/* no traces change */
			p_info(PI_ELOG, "ERROR - 'Tree' name missing, program exit \n");
			exit(1);
		}
		return(1);				/* change traces only */
    }
    length = strlen(msg[6].answer);
    if( length >= MAX_NAME) 
    {
		p_info(PI_ELOG, "ERROR- 'Tree' name '%s' exceeds %d characters, program exit.\n",
			   msg[6].answer, MAX_NAME - 1);
		exit(1);
    }
    strcpy(TreeName, msg[6].answer);
    if ( !msg[4].answer[0])
    {							/* sub-dir name missing */
		if( msg[2].answer[0] )
		{						/* need subdir name if it is a galley */
			p_info(PI_ELOG, "ERROR - 'Dir' name is missing, program exit \n");
			exit(1);
		}
		else
		{						/* create SubDirName if not present for unit */
			if( !msg[3].answer[0] )
			{					/* need subdir name if it is a galley */
				p_info(PI_ELOG, "ERROR - 'Dir' name is missing, program exit \n");
				exit(1);
			}
			else				/* use unit name for project */
				sprintf(SubDirName,"%s.prj",msg[3].answer);
		}
    }
    else
    {
		length = strlen(msg[4].answer);
		if( length >= MAX_NAME) 
		{
			p_info(PI_ELOG, "ERROR - 'Dir' name '%s' exceeds %d characters, program exit.\n",
				   msg[4].answer, MAX_NAME - 1);
			exit(1);
		}
		strcpy(SubDirName, msg[4].answer);
    }
    if ( p_get_data_name ( TreeName, SubDirName, UserdataPath, 0 ) )
    {
		p_info(PI_ELOG, "ERROR - missing file '/Penta/%s/desks/%s/.data', program exit.\n",
			   TreeName, SubDirName);
		exit(1);
    }
#ifdef TRACE
    if (debugger_trace)
		p_info(PI_TRACE, "path to userdata is '%s' \n",UserdataPath);
#endif
    if ((sysfd = p_open(TreeName,USERDATA,UserdataPath,"standards","r")) == 0)
    {
		p_info(PI_ELOG, "ERROR - file 'standards' is missing, program exit.\n");
		exit(1);
    }
    if ( !(p_read((char *)stds_buff, 240, 1, sysfd, 0, BS16) ) )
    {
		p_info(PI_ELOG, "ERROR - cannot read file 'standards', program exit.\n");
		exit(1);
    }
    p_close(sysfd);
    HorizontalBase = stds_buff[35];
    VerticalBase = stds_buff[74];
    Jrule = (int)stds_buff[95];
	if ( !Jrule)
		Jrule = 10;
	BookPrint = 0;
    if ( msg[2].answer[0])
    {							/* galley name */
		length = strlen(msg[2].answer);
		if( length >= MAX_NAME) 
		{
			p_info(PI_ELOG, "ERROR - 'Galley' name '%s' exceeds %d characters, program exit. \n",
				   msg[2].answer, MAX_NAME - 1);
			exit(1);
		}
		strcpy(JobName, msg[2].answer); /* we have a galley name */
		FileType = 0;			/* Galley output */
		FirstPage = 0;
    }							/* end galley name */
    else if ( msg[3].answer)
    {							/* use the unit name */
		length = strlen(msg[3].answer);
		if( length >= MAX_NAME) 
		{
			p_info(PI_ELOG, "ERROR - 'Unit' name '%s' exceeds %d characters, program exit.\n",
				   msg[3].answer, MAX_NAME);
			exit(1);
		}
		FileType = 1;			/* must be a unit name */
		strcpy(JobName, msg[3].answer);

		FirstPage = -1;			/* (assume no start/end pgs given)  */
		LastPage = -1;
		if (strstr(msg[8].answer, ".prj"))
		{						/* Child-project name is passed instead of first pg#.
									Store project name, set doing-book flag:  */
			strcpy (FirstProjofBook, msg[8].answer);
			strcpy (LastProjofBook, FirstProjofBook);
			BookPrint = 1;
			if (strstr(msg[9].answer, ".prj"))
				strcpy (LastProjofBook, msg[9].answer);
		}
		else if (msg[8].answer[0])	/* Regular starting page #  */
		{
			FirstPage = atol(msg[8].answer);
			if (msg[9].answer[0])		/* Regular ending page #  */
				LastPage = atol(msg[9].answer);
		}
		if ( msg[18].answer[0])
		{						/* only use for debugging */
			FirstPage = atol(msg[18].answer);
			if ( !msg[19].answer[0])
				LastPage = -1;
			else
				LastPage = atol(msg[19].answer);
		}
		if ( msg[33].answer[0])	/* Layout */
			strcpy (msg[21].answer, msg[33].answer);
		if ( msg[21].answer[0])	/* FirstMaster */
		{
			length = strlen(msg[21].answer);
			if( length >= MAX_NAME) 
			{
				p_info(PI_ELOG, "ERROR - 'FirstMaster' name '%s' exceeds %d characters, program exit. \n",
					   msg[21].answer, MAX_NAME - 1);
				exit(1);
			}
			strcpy(PageName, msg[21].answer); /* we have a layout name */
			MasterNameFlag = 1;
			FirstPage = 0;
			LastPage = 0;
		}
		else
		{
			MasterNameFlag = 0;
			PageName[0] = 0;
		}
		if(psinit())
			exit(1);
    }							/* end unit name */
    else
    {
		p_info (PI_ELOG, "ERROR - missing 'Galley' or 'Unit' name, program exit. \n");
		exit(1);
    }
	if (msg[5].answer[0])
	{							/* printer name */
		length = strlen(msg[5].answer);
		if( length >= MAX_NAME) 
		{
			p_info(PI_ELOG, "ERROR - 'PrinterName' '%s' exceeds %d characters, program exit. \n",
				   msg[5].answer, MAX_NAME - 1);
			exit(1);
		}
		strcpy(PrinterName, msg[5].answer);
    }
    else
		strcpy(PrinterName, "\0\0");

    lnumbers = atoi(msg[10].answer);
    suppresslp=0;

    if ( msg[11].answer[0])
    {
		length = strlen(msg[11].answer);
		if( length >= MAX_NAME) 
		{
			p_info(PI_ELOG, "ERROR - 'ColorTable' name '%s' exceeds %d characters, program exit. \n",
				   msg[11].answer, MAX_NAME - 1);
			exit(1);
		}
		strcpy(ColorTableName, msg[11].answer);
    }
    else
		strcpy(ColorTableName, "colortable");
    init_color();
    p_info(PI_INFO, "Postprint starting Tree: '%s', Dir: '%s', Job: '%s' \n",TreeName,SubDirName,JobName);
    if ( msg[12].answer[0])
		GalleySlugFlag = atoi(msg[12].answer); /* use keyword with 0 or 1 */
    else
    {							/* no keyword, use defaults */
		if ( FileType)
			GalleySlugFlag = 0;	/* default is no print slug if Unit */
		else
			GalleySlugFlag = 1;	/* default is print slug if Galley */
    }
	if ( msg[13].answer[0])
		strcpy(PsfTableName, msg[13].answer); /* name of PSFTABLE */
	else
		strcpy(PsfTableName, "psftable");
	Orient = 0;					/* portrait is default */
	if ( msg[14].answer[0])
	{							/* p or P = portrait, l or L = landscape */
		switch (msg[14].answer[0])
		{
		  case 'P':
		  case 'p':
			Orient = 0;			/* portrait */
			break;
		  case 'L':
		  case 'l':
			Orient = 90;		/* landscape */
			break;
		  default:
			p_info(PI_ELOG, "ERROR - Orient '%s' invalid, defaulting to portrait.\n",
				   msg[14].answer);
			break;
		}
	}
	if ( msg[15].answer[0])
	{							/* KeyScale */
		if ( (msg[15].answer[0] & 0xdf) == 'X')
			KeyScale = -1;		/* defined as 'X' */
		else
			KeyScale = atoi(msg[15].answer);
	}
	else
		KeyScale = -2;			/* not defined */
	if ( msg[16].answer[0])		/* KeyScaleX */
		KeyScaleX = atoi(msg[16].answer);
	else
		KeyScaleX = -1;
	if ( msg[17].answer[0])		/* KeyScaleY */
		KeyScaleY = atoi(msg[17].answer);
	else
		KeyScaleY = -1;
	KeyOutputType = 0;			/* default is composite */
	if ( msg[20].answer[0] == '1')
	{
#if LPMfloat
		if ( LPMK[LPM_PWS1] || LPMK[LPM_PWS2] )
#else
		if ( (LPMK & LPM_PWS1) || (LPMK & LPM_PWS2) )
#endif
			p_info(PI_ELOG, "ERROR - Color separation not allowed on a Personal Workstation.\n");
		else
#if ! LPMfloat
		if((LPMK & LPM_SpotColor))
#endif
			KeyOutputType = 1;	/* color separation */
	}
	if ( msg[23].answer[0])		/* Header */
		setpage_allowed =
			atoi(msg[23].answer); /* 1 means dump page width and height */
	else
		setpage_allowed = -1;
	MultiPagesUp = 0;			/* default is 1 up */
	MultiPagesOddEvenFlag = 0;
	MultiOddPage_cc_mask = 0;
	if ( msg[24].answer[0])		/* Multi - for 2 pages up */
	{							/* non-zero means 2-up */
		MultiPagesUp = atoi(msg[24].answer);
		if ( !FileType || (FirstPage < 0) ||
			 ( ( FirstPage >= 0) && !(FirstPage & 1) ) )
			MultiPagesOddEvenFlag = 0;
		else
			MultiPagesOddEvenFlag = 1; /* starting Unit on odd page */
	}
	if ( msg[25].answer[0])		/* PageW */
	{
		PageW = atoi(msg[25].answer);
		PageW_key_flag = 1;
	}
	else
	{
		PageW = -1;
		PageW_key_flag = 0;
	}
	if ( msg[26].answer[0])		/* PageD */
	{
		PageH = atoi(msg[26].answer);
		PageD_key_flag = 1;
	}
	else
	{
		PageH = -1;
		PageD_key_flag = 0;
	}
	if ( msg[27].answer[0])		/* Pofft */
	{
		OffT = atoi(msg[27].answer);
		Pofft_key_flag = 1;
	}
	else
	{
		OffT = -1;
		Pofft_key_flag = 0;
	}
	if ( msg[28].answer[0])		/* Poffb */
	{
		OffB = atoi(msg[28].answer);
		Poffb_key_flag = 1;
	}
	else
	{
		OffB = -1;
		Poffb_key_flag = 0;
	}
	if ( msg[29].answer[0])		/* Poffl */
	{
		OffL = atoi(msg[29].answer);
		Poffl_key_flag = 1;
	}
	else
	{
		OffL = -1;
		Poffl_key_flag = 0;
	}
	if ( msg[30].answer[0])		/* Poffr */
	{
		OffR = atoi(msg[30].answer);
		Poffr_key_flag = 1;
	}
	else
	{
		OffR = -1;
		Poffr_key_flag = 0;
	}
	if ( msg[31].answer[0])		/* Cmyk */
		CMYK_Allowed = atoi(msg[31].answer);
	else
		CMYK_Allowed = -1;
	if ( msg[32].answer[0])		/* Hdrup */
		header_offset = atoi(msg[32].answer); /* Pts to raise slug line */
	else
		header_offset = -32760;	/* -32760 means no Hdrup keyword */
	LYPrintFlag = 0;
	if ( msg[34].answer[0])		/* LYP -  layout print */
	{
		if ( !FileType)
		{
			p_info(PI_ELOG, "ERROR - Cannot do LYP (layout print) for galley, program exit.\n");
			exit(1);

		}
/* for LayoutPrint, kill other functions */
		for (i=0; i<10; i++)
		{
			if ( !msg[34].answer[i])
				break;
			if ( msg[34].answer[i] == 'a')
			{					/* a means all reports */
				LYPrintFlag = -1;
				break;
			}
			c = (msg[34].answer[i] - '0') & 0xf;
			if ( (c <= 0) || (c > 9) )
				continue;
			LYPrintFlag |= 1 << (c -1 );
		}
	}							/* end if(msg[34].answer[0]) */
	if (LYPrintFlag)
	{
		delay_records_flag = -1; /* no sorting for reporting */
		GalleySlugFlag = 0;
		KeyOutputType = 0;
		MultiPagesUp = 0;
		lnumbers = 0;
		if ( msg[35].answer[0])
		{						/* Report directory, used, or both */
			Reports = atoi( msg[35].answer);
			switch ( Reports)
			{
			  case -1:			/* all files in directory and all used */
			  case 0:			/* only those files in directory (default) */
			  case 1:			/* only those files used */
				break;
			  default:
				p_info(PI_ELOG, "ERROR - 'Report' Key Word option %s not available. Defaulting to reporting on data base in directory.\n", msg[35].answer);
				Reports = 0;
				break;
 			}						/* end switch(Reports) */
		}
		else
			Reports = 0;		/* default */
	}
	else
		delay_records_flag = 1;	/* normal postsript delay */
	if ( msg[37].answer[0] == '1')
		KeyTrimFlags = 1;		/* trim marks */
	else
		KeyTrimFlags = 0;
	if ( msg[36].answer[0] == '1')
		KeyTrimFlags |= 2;		/* register marks */
	if ( (KeyTrimFlags & 1) && !LYPrintFlag )
    {							/* set up trim marks */
		if ( msg[41].answer[0])
			temp_trim = atoi(msg[41].answer);
		if ( !temp_trim)
			temp_trim = 24;		/* default */
		trim_mark_width = temp_trim * HorizontalBase;
		trim_mark_depth = temp_trim * VerticalBase;
		KeyTrimLength = temp_trim;
		KeyTrimWeight = 0;
		if ( msg[40].answer[0])
			KeyTrimWeight = (int )(atof(msg[40].answer) * 20); /* in 1/20 pt */
		if ( KeyTrimWeight < 2)
			KeyTrimWeight = 2;
	}
	else
	{
		trim_mark_width = 0;
		trim_mark_depth = 0;
		KeyTrimWeight = 0;
		KeyTrimLength = 0;
	}
	if ( (KeyTrimFlags & 2) && !LYPrintFlag )
    {							/* set up register marks */
		if ( msg[39].answer[0])
			temp_reg_length = atoi(msg[39].answer);
		if ( !temp_reg_length)
			temp_reg_length = 12;		/* default */
		KeyRegisterLength = temp_reg_length; /* in points */
		KeyRegisterWt = 0;
		if ( msg[38].answer[0])
			KeyRegisterWt = atof(msg[38].answer);
		if ( KeyRegisterWt < 0.1)
			KeyRegisterWt = .1;
		if ( (2 * temp_reg_length) > temp_trim)
		{
			trim_mark_width = temp_reg_length * HorizontalBase * 2;
			trim_mark_depth = temp_reg_length * VerticalBase * 2;
		}
	}
	else
	{
		KeyRegisterLength = 0;
		KeyRegisterWt = 0;
	}
	if ( (KeyTrimFlags &3) && !LYPrintFlag )
	{							/* add 9 point offset */
		if (msg[72].answer[0])	/* ie. gap between trim-line & tick */
			KeyTrimRegGap = atoi(msg[72].answer);
		else
			KeyTrimRegGap = 9;
		trim_mark_width += (KeyTrimRegGap * HorizontalBase);
		trim_mark_depth += (KeyTrimRegGap * VerticalBase);
	}
	if (msg[73].answer[0])	
		EpsFlag = atoi(msg[73].answer);
	else
		EpsFlag=0;

	if (msg[74].answer[0])	
		strcpy(Uname,msg[74].answer);
	else
		strcpy(Uname,"penta");

	if (msg[75].answer[0])	
		DownLoadFont=1;
	else
		DownLoadFont=0;

	if (msg[76].answer[0])	
		ResolveOPI=1;
	else
		ResolveOPI=0;

	if (msg[77].answer[0])
		job_link.btype=atoi(msg[77].answer);

	if (msg[78].answer[0])
		job_link.weight=atoi(msg[78].answer);

	if (msg[79].answer[0]) {
		job_link.bcolor=atoi(msg[79].answer);
		strcpy(pdftmp,msg[79].answer);
		/* split into chunks of 3 digits */
		job_link.ocolor[0] = '\0';
		p=pdftmp;
                for (ii=1; ii <= 3; ii++) {
		     strncpy(pdfc,p,3);
		     fcolor=(atoi(pdfc)/255);
                     memset(pdfword,0,sizeof(pdfword));
                     sprintf(pdfword," %.2f",fcolor);
                     strcat(job_link.ocolor,pdfword);
		     p+=3;
                 }
	}

	if (msg[80].answer[0])
		job_link.dashlen=atoi(msg[80].answer);

	if (msg[81].answer[0])
		job_link.dashgap=atoi(msg[81].answer);

	if (msg[82].answer[0])
		job_link.radius=atoi(msg[82].answer);

	if (msg[83].answer[0])
		strcpy(pdf_info.title,msg[83].answer);

	if (msg[84].answer[0])
		strcpy(pdf_info.auth,msg[84].answer);

	if (msg[85].answer[0])
		strcpy(pdf_info.subj,msg[85].answer);

	if (msg[86].answer[0])
		strcpy(pdf_info.keyw,msg[86].answer);

	if (msg[87].answer[0])
		strcpy(pdf_info.creator,msg[87].answer);

	if (msg[88].answer[0])
		strcpy(pdf_info.date1,msg[88].answer);

	if (msg[89].answer[0])
		strcpy(pdf_info.date2,msg[89].answer);

	if (msg[90].answer[0])
		pdf_docview.initpage = atoi(msg[90].answer);

	if (msg[91].answer[0])	/* This is the switch, set by DM print menu:  */
	{						/*   There was a PDF style used in this request.  */
		PdfActive = 1;		/* PDF output is now active.  */
		pdf_docview.initdisp = atoi(msg[91].answer);
	}

	if (msg[92].answer[0])
		pdf_docview.initsize = atoi(msg[92].answer);

	if (msg[93].answer[0])
		pdf_docview.initzoom = atoi(msg[93].answer);

	if (msg[94].answer[0])
		pdf_note_disp = atoi(msg[94].answer);

	if (msg[95].answer[0])
		pdf_note_length = atoi(msg[95].answer);

	if (msg[96].answer[0])
		pdf_note_depth = atoi(msg[96].answer);

	if (msg[97].answer[0]) {
                pdf_note_color=atoi(msg[97].answer);
                strcpy(pdftmp,msg[97].answer);
                /* split into chunks of 3 digits */
                pdf_note_ocolor[0] = '\0';
                p=pdftmp;
                for (ii=1; ii <= 3; ii++) {
                     strncpy(pdfc,p,3);
                     fcolor=(atoi(pdfc)/255);
                     memset(pdfword,0,sizeof(pdfword));
                     sprintf(pdfword," %.2f",fcolor);
                     strcat(pdf_note_ocolor,pdfword);
                     p+=3;
                 }
	}

	if (msg[98].answer[0])
		pdf_output_lev = atoi(msg[98].answer);

	if (msg[99].answer[0])
		pdf_crop_dox = atoi(msg[99].answer);
	if (msg[100].answer[0])
		pdf_crop_doy = atoi(msg[100].answer);
	if (msg[101].answer[0])
		pdf_crop_dex = atoi(msg[101].answer);
	if (msg[102].answer[0])
		pdf_crop_dey = atoi(msg[102].answer);
	if (msg[103].answer[0])
		pdf_crop_cox = atoi(msg[103].answer);
	if (msg[104].answer[0])
		pdf_crop_coy = atoi(msg[104].answer);
	if (msg[105].answer[0])
		pdf_crop_cex = atoi(msg[105].answer);
	if (msg[106].answer[0])
		pdf_crop_cey = atoi(msg[106].answer);
	if (msg[107].answer[0])
		pdf_crop_cw = atoi(msg[107].answer);
	if (msg[108].answer[0])
		pdf_crop_cd = atoi(msg[108].answer);
	if (msg[109].answer[0])
		pdf_crop_dw = atoi(msg[109].answer);
	if (msg[110].answer[0])
		pdf_crop_dd = atoi(msg[110].answer);
	if (msg[111].answer[0])
		pdf_bead = atoi(msg[111].answer);
	else
		pdf_bead = 0;


	MultiPagesFirstIsOdd = MultiPagesOddEvenFlag;
	if ( !FileType)
	{							/* if galley, see if start & end galley */
		if ( msg[42].answer[0])
		{
			FirstGal = atoi(msg[42].answer);
			if (FirstGal < 0)
			{
				p_info(PI_ELOG, "ERROR - First galley number (%s) less than 0, defaulting to all galleys.\n",
						   msg[42].answer);
				FirstGal = 0;
				LastGal = 1000000;
			}
			else if ( msg[43].answer[0])
			{
				LastGal = atoi(msg[43].answer);
				if (LastGal < FirstGal)
				{
					p_info(PI_ELOG, "ERROR - Last galley number (%s) less than first galley number (%s), defaulting to all galleys.\n",
						   msg[43].answer, msg[42].answer);
					FirstGal = 0;
					LastGal = 1000000;
				}
			}
			else
			{
				FirstGal = 0;
				LastGal = 1000000;
			}
		}						/* end if(msg[42].answer[0])  */
		if (!FirstGal && !LastGal)
			LastGal = 1000000;
	}							/* end if(!FileType) */
	if ( msg[45].answer[0])
		Proof = atoi(msg[45].answer);
	else
		Proof = 0;
	if ( KeyOutputType && msg[46].answer[0])
		Plates = (uint32 )atoi(msg[46].answer);
	else
		Plates = 0xffffffff;
	if ( FileType && msg[47].answer[0] && !LYPrintFlag)
		SupressBlankPages = atoi(msg[47].answer);
	else
		SupressBlankPages = 0;
	if ( msg[48].answer[0])
		Neg = atoi(msg[48].answer);
	else
		Neg = 0;
	if ( msg[49].answer[0])
		Mirror = atoi(msg[49].answer);
	else
		Mirror = 0;
	if ( msg[50].answer[0] && !FileType) /* only allowed in galleys */
		BcEcFlag = atoi(msg[50].answer); /* non-zero: use BcEc */
	else
		BcEcFlag = 0;			/* Ignore BcEc for this job */
	if ( msg[51].answer[0])
	{
		EditTraceFlag = atoi(msg[51].answer);
		if ( (EditTraceFlag < 0) || (EditTraceFlag > 3) )
		{
			p_info(PI_ELOG, "ERROR - EditTrace '%s' invalid, defaulting to none.\n",
				   msg[51].answer);
			EditTraceFlag = 0;
		}
	}
	else
		EditTraceFlag = 0;
	EditTraceStarted = 0;
	if ( EditTraceFlag)
	{							/* only read parameters if needed. */
		if ( msg[52].answer[0])
			CurInsOffset = (int )(atof(msg[52].answer) * VerticalBase);
		else
			CurInsOffset = 1.25 * VerticalBase;
		if ( msg[53].answer[0])
			PreInsOffset = (int )(atof(msg[53].answer) * VerticalBase);
		else
			PreInsOffset = 2.75 * VerticalBase;
		if ( msg[54].answer[0])
			CurDelOffset = (int )(atof(msg[54].answer) * VerticalBase);
		else
			CurDelOffset = 2.25 * VerticalBase;
		if ( msg[55].answer[0])
			PreDelOffset = (int )(atof(msg[55].answer) * VerticalBase);
		else
			PreDelOffset = 3.75 * VerticalBase;
		if ( msg[56].answer[0])
		{
			CurInsClr = atoi(msg[56].answer);
			if(CurInsClr < -1)
				CurInsClr = -1;
		}
		else
			CurInsClr = 1;
		if ( msg[57].answer[0])
		{
			PreInsClr = atoi(msg[57].answer);
			if(PreInsClr < -1)
				PreInsClr = -1;
		}
		else
			PreInsClr = 1;
		if ( msg[58].answer[0])
		{
			CurDelClr = atoi(msg[58].answer);
			if(CurDelClr < -1)
				CurDelClr = -1;
		}
		else
			CurDelClr = 1;
		if ( msg[59].answer[0])
		{
			PreDelClr = atoi(msg[59].answer);
			if(PreDelClr < -1)
				PreDelClr = -1;
		}
		else
			PreDelClr = 1;
		if ( msg[60].answer[0])
		{
			CurInsWeight = (atof(msg[60].answer)  * VerticalBase);
			if(CurInsWeight <= 0)
				CurInsWeight = 1.; /* 1/10 point in VerticalBase units */
		}
		else
			CurInsWeight = .1 * VerticalBase;
		if ( msg[61].answer[0])
		{
			PreInsWeight = atof(msg[61].answer) * VerticalBase;
			if(PreInsWeight <= 0)
				PreInsWeight = 1.; /* 1/10 point in VerticalBase units */
		}
		else
			PreInsWeight = .1 * VerticalBase;
	}							/* end if(EditTraceFlag) */
	if ( msg[62].answer[0])
	{
		ChapterPage = atoi(msg[62].answer);
		ChapterPageSetFlag = 0;
	}
	else
	{
		ChapterPage = 0;
		ChapterPageSetFlag = 1;
	}
	if ( msg[63].answer[0])
		IncludeScreens = atoi(msg[63].answer);
	else
		IncludeScreens = 1; /* If no keyword, set IncludeScreens to 1 */

	if (msg[64].answer[0])
		LPI = atoi(msg[64].answer);
	else
		LPI = 0; /* Use ColorTable */

    if ( msg[65].answer[0]) /* Number of Copies */
        NumCopies = atoi(msg[65].answer);
    else
        NumCopies = 1;
    if ( msg[66].answer[0]) /* ClipPaths */
		ClipPathFlag = atoi(msg[66].answer);
	else
		ClipPathFlag = 0;
	if ( msg[67].answer[0]) /* Collate */
		CollateFlag = atoi(msg[67].answer);
	else
		CollateFlag = 0;
	if ( msg[69].answer[0]) /* Page width in inches */
		PageWInch = atoi(msg[69].answer);
	else
		PageWInch = 0;
	if ( msg[70].answer[0]) /* Page Depth in inches */
		PageDInch = atoi(msg[70].answer);
	else
		PageDInch = 0;
	if ( msg[71].answer[0]) /* Switch: Do galley breaks in pp/pq extracts */
		DoExtractBreaks = atoi(msg[71].answer);
	else
		DoExtractBreaks = 1;
	if ( msg[120].answer[0]) /* 1= Distill to PDF (done by .psh script)
								0= don't   */
		DistillFlag = atoi(msg[120].answer);
	else
		DistillFlag = 0;
	if ( msg[121].answer[0] && lnumbers)
							/* += Put out line stats w/ line# (galley md only)
								5+=Do so, and use val as their pt-size.
								0= don't   */
		LineStats = atoi(msg[121].answer);
	else
		LineStats = 0;
	return(0);
}								/* end function */