コード例 #1
0
ファイル: glue2.c プロジェクト: AlainODea/illumos-gate
void
savedir(void)
{
	if (refdir[0] == 0)
		corout("", refdir, "/usr/bin/pwd", "", 50);
	trimnl(refdir);
}
コード例 #2
0
ファイル: mkey3.c プロジェクト: aksr/heirloom
void
cominit(void)
{
	int i;
	FILE *f;
	cgate=1;
	f = fopen(comname, "r");
	if (f==NULL) return;
	cbp=cbuf;
	for(i=0; i<comcount; i++)
	{
		if (fgets(cbp, 15, f)==NULL)
			break;
		trimnl(cbp);
		c_look (cbp, 0);
		while (*cbp++);
	}
	fclose(f);
}
コード例 #3
0
ファイル: refer4.c プロジェクト: aksr/heirloom
void
append(char *s)
{
	char *p;
	int lch;

	trimnl(buff);
	for (p = buff; *p; p++)
		;
	lch = *--p;
	if (postpunct && punctuat(lch))
		*p = 0;
	else /* pre-punctuation */
		switch (lch) {
		case '.': 
		case '?':
		case '!':
		case ',':
		case ';':
		case ':':
			*p++ = lch;
			*p = 0;
		}
	strcat(buff, s);
	if (postpunct)
		switch(lch) {
		case '.': 
		case '?':
		case '!':
		case ',':
		case ';':
		case ':':
			for(p = buff; *p; p++)
				;
			if (*--p == '\n')
				*p = 0;
			*p++ = lch;
			*p++ = '\n';
			*p = 0;
		}
	if (strlen(buff) > BUFSIZ)
		err("output buff too long (%d)", BUFSIZ);
}
コード例 #4
0
ファイル: getdomain.c プロジェクト: Sunshine-OS/svr4-userland
/* read a file for the domain */
static char *
look4domain(char *file, char *buf, int size)
{
	char *ret = 0;
	FILE *fp = fopen(file, "r");

	if (!fp)
		return (0);

	while (fgets(buf, size, fp))
		if (strncmp(buf, "domain", 6) == 0)
	if (spacechar(buf[6]&0377)) {
		char *x = skipspace(buf + 6);
		if (graphchar(*x&0377)) {
			trimnl(x);
			strmove(buf, x);
			ret = buf;
			break;
		}
	}

	fclose(fp);
	return (ret);
}
コード例 #5
0
ファイル: refer2.c プロジェクト: bapt/heirloom-doctools
void
doref(char *line1)
{
	char buff[QLEN], dbuff[3*QLEN];
	char answer[ANSLEN], temp[TLEN], line[BUFSIZ];
	char *p, **sr, *flds[NFLD], *r;
	int nf, nr, query = 0, alph, digs;

   again:
	buff[0] = dbuff[0] = 0;
	if (biblio && Iline == 1 && line1[0] == '%')
		n_strcat(dbuff, line1, sizeof(dbuff));
	while (input(line, sizeof(line))) {		/* get query */
		Iline++;
		if (prefix(line, ".]"))
			break;
		if (biblio && line[0] == '\n')
			break;
		if (biblio && line[0] == '%' && line[1] == *convert)
			break;
		if (control(line[0]))
			query = 1;
		n_strcat(query ? dbuff : buff, line, query ?
		    sizeof(dbuff) : sizeof(buff));
		if (strlen(buff) > QLEN)
			err("query too long (%d)", strlen(buff));
		if (strlen(dbuff) > 3 * QLEN)
			err("record at line %d too long", Iline-1);
	}
	if (biblio && line[0] == '\n' && feof(in))
		return;
	if (strcmp(buff, "$LIST$\n")==0) {
		assert (dbuff[0] == 0);
		dumpold();
		return;
	}
	answer[0] = 0;
	for (p = buff; *p; p++) {
		if (isupper((int)*p))
			*p |= 040;
	}
	alph = digs = 0;
	for (p = buff; *p; p++) {
		if (isalpha((int)*p))
			alph++;
		else
			if (isdigit((int)*p))
				digs++;
			else {
				*p = 0;
				if ((alph+digs < 3) || common(p-alph)) {
					r = p-alph;
					while (r < p)
						*r++ = ' ';
				}
				if (alph == 0 && digs > 0) {
					r = p-digs;
					if (digs != 4 || atoi(r)/100 != 19) { 
						while (r < p)
							*r++ = ' ';
					}
				}
				*p = ' ';
				alph = digs = 0;
			}
	}
	one[0] = 0;
	if (buff[0]) {	/* do not search if no query */
		for (sr = rdata; sr < search; sr++) {
			temp[0] = 0;
			corout(buff, temp, "hunt", *sr, TLEN);
			assert(strlen(temp) < TLEN);
			if (strlen(temp)+strlen(answer) > BUFSIZ)
				err("Accumulated answers too large",0);
			n_strcat(answer, temp, sizeof(answer));
			if (strlen(answer)>BUFSIZ)
				err("answer too long (%d)", strlen(answer));
			if (newline(answer) > 0)
				break;
		}
	}
	assert(strlen(one) < ANSLEN);
	assert(strlen(answer) < ANSLEN);
	if (buff[0])
		switch (newline(answer)) {
		case 0:
			fprintf(stderr, "No such paper: %s\n", buff);
			return;
		default:
			fprintf(stderr, "Too many hits: %s\n", trimnl(buff));
			choices(answer);
			p = buff;
			while (*p != '\n')
				p++;
			*++p = 0;
		case 1:
			if (endpush)
				if ((nr = chkdup(answer))) {
					if (bare < 2) {
						nf = tabs(flds, one);
						nf += tabs(flds+nf, dbuff);
						assert(nf < NFLD);
						putsig(nf,flds,nr,line1,line,0);
					}
					return;
				}
			if (one[0] == 0)
				corout(answer, one, "deliv", dr, QLEN);
			break;
		}
	assert(strlen(buff) < QLEN);
	assert(strlen(one) < ANSLEN);
	nf = tabs(flds, one);
	nf += tabs(flds+nf, dbuff);
	assert(nf < NFLD);
	refnum++;
	if (sort)
		putkey(nf, flds, refnum, keystr);
	if (bare < 2)
		putsig(nf, flds, refnum, line1, line, 1);
	else
		flout();
	putref(nf, flds);
	if (biblio && line[0] == '\n')
		goto again;
	if (biblio && line[0] == '%' && line[1] == *convert)
		fprintf(fo, "%s%c%s", convert+1, sep, line+3);
}
コード例 #6
0
ファイル: mkey1.c プロジェクト: AlainODea/illumos-gate
int
main(int argc, char *argv[])
{
	/*
	 * this program expects as its arguments a list of
	 * files and generates a set of lines of the form
	 *	filename:byte-add,length (tab) key1 key2 key3
	 * where the byte addresses give the position within
	 * the file and the keys are the strings off the lines
	 * which are alphabetic, first six characters only.
	 */

	int i;
	char *name, qn[200];
	char *inlist = 0;

	FILE *f, *ff;

	(void) setlocale(LC_ALL, "");

#if !defined(TEXT_DOMAIN)
#define	TEXT_DOMAIN "SYS_TEST"
#endif
	(void) textdomain(TEXT_DOMAIN);

	while (argc > 1 && argv[1][0] == '-') {
		switch (argv[1][1]) {
		case 'c':
			comname = argv[2];
			argv++;
			argc--;
			break;
		case 'w':
			wholefile = 1;
			break;
		case 'f':
			inlist = argv[2];
			argv++;
			argc--;
			break;
		case 'i':
			iglist = argv[2];
			argv++;
			argc--;
			break;
		case 'l':
			minlen = atoi(argv[1]+2);
			if (minlen <= 0) minlen = 3;
			break;
		case 'n': /* number of common words to use */
			comcount = atoi(argv[1]+2);
			break;
		case 'k': /* number  of keys per file max */
			keycount = atoi(argv[1]+2);
			break;
		case 's': /* suppress labels, search only */
			labels = 0;
			break;
		}
		argc--;
		argv++;
	}
	if (inlist) {
		ff = fopen(inlist, "r");
		while (fgets(qn, 200, ff)) {
			trimnl(qn);
			f = fopen(qn, "r");
			if (f != NULL)
				dofile(f, qn);
			else
				fprintf(stderr, gettext("Can't read %s\n"), qn);
		}
	} else
		if (argc <= 1)
			dofile(stdin, "");
		else
			for (i = 1; i < argc; i++) {
				f = fopen(name = argv[i], "r");
				if (f == NULL)
					err(gettext("No file %s"), name);
				else
					dofile(f, name);
			}
	return (0);
}
コード例 #7
0
ファイル: lizar.c プロジェクト: socram8888/Lizarchive
int pack() {
	char * name = NULL;
	size_t namesize = 0;

	uint8_t header[32];
	memcpy(header, PACKAGE_MAGIC, 4);

	ssize_t namelen;
	while ((namelen = getline(&name, &namesize, stdin)) >= 0) {
		namelen = trimnl(name, namelen);
		if (namelen == 0) {
			continue;
		}

		struct stat st;
		if (stat(name, &st) < 0) {
			fprintf(stderr, "Warning: could not stat %s (%s)\n", name, strerror(errno));
			continue;
		}
		size_t filesize = st.st_size;

		if (!S_ISREG(st.st_mode)) {
			fprintf(stderr, "Warning: can't open %s - not a regular file\n", name);
			continue;
		}

		FILE * f = fopen(name, "rb");
		if (!f) {
			fprintf(stderr, "Warning: can't fopen %s for read (%s)\n", name, strerror(errno));
			continue;
		}

		uint8_t * hdrend = header + 4;
		varuint_pack(&hdrend, filesize);
		varuint_pack(&hdrend, st.st_mtime);

		uint8_t miscflags = 0;
		if (st.st_mode & S_IXUSR) {
			miscflags |= 1;
		}

		*hdrend = miscflags;
		hdrend++;

		uint32_t crc = crc32mpeg(0xFFFFFFFF, header, hdrend - header);
		if (!fwrite(header, hdrend - header, 1, stdout)) {
			fprintf(stderr, "Fatal error: unexpected end-of-stream when writing Lizarchive header (%s)\n", strerror(errno));
			return 1;
		}

		crc = crc32mpeg(crc, name, namelen + 1); // +1 for null terminator
		if (!fwrite(name, namelen + 1, 1, stdout)) {
			fprintf(stderr, "Fatal error: unexpected end-of-stream when writing file name (%s)\n", strerror(errno));
			return 1;
		}

		while (filesize) {
			uint8_t buf[8192];
			size_t read = fread(buf, 1, min(filesize, sizeof(buf)), f);
			if (read == 0) {
				fprintf(stderr, "Fatal error: unexpected end-of-stream when reading file data from %s (%s)\n", name, strerror(errno));
				fclose(f);
				return 1;
			}

			if (!fwrite(buf, read, 1, stdout)) {
				fprintf(stderr, "Fatal error: unexpected end-of-stream when writing file data (%s)\n", strerror(errno));
				fclose(f);
				return 1;
			}

			crc = crc32mpeg(crc, buf, read);
			filesize -= read;
		}
		fclose(f);

		crc = htonl(crc);
		if (!fwrite(&crc, 4, 1, stdout)) {
			fprintf(stderr, "Fatal error: unexpected end-of-stream when writing CRC (%s)\n", strerror(errno));
			return 1;
		}
	}

	return 0;
}
コード例 #8
0
ファイル: sendmail.c プロジェクト: Sunshine-OS/svr4-userland
/*
	 Send mail - High level sending routine
 */
void 
sendmail(int argc, char **argv)
{
	char		**args;
	char		*tp, *zp;
	char		*buf = NULL;
	size_t		bufsize = 0;
	char		last1c;
	FILE		*input;
	struct stat 	sbuf;
	int		aret;
	int		i, n;
	int		oldn = 1;	
	int		ttyf = 0;
	int		pushrest = 0;
	int		hdrtyp = 0;
	int		ctf = FALSE;
	int		binflg = 0;
	long		count = 0L;
	struct tm	*bp;
	struct hdrs	*hptr;
	static char	pn[] = "sendmail";
	reciplist	list;

	buf = smalloc(bufsize = 2048);
	Dout(pn, 0, "entered\n");
	new_reciplist(&list);
	for (i = 1; i < argc; ++i) {
	        if (argv[i][0] == '-') {
		        if (argv[i][1] == '\0') {
				errmsg(E_SYNTAX,"Hyphens MAY NOT be followed by spaces");
			}
		        if (i > 1) {
				errmsg(E_SYNTAX,"Options MUST PRECEDE persons");
			}
		        done(0);
	        }
		/*
			Ensure no NULL names in list
		*/
	        if (argv[i][0] == '\0' || argv[i][strlen(argv[i])-1] == '!') {
			errmsg(E_SYNTAX,"Null names are not allowed");
	  	       	done(0);
		}
		add_recip(&list, argv[i], FALSE); /* Don't check for duplication */
	}

	mktmp();
	/*
		Format time
	*/
	time(&iop);
	bp = localtime(&iop);
	tp = asctime(bp);
	zp = tzname[bp->tm_isdst];
	sprintf(datestring, "%.16s %.4s %.5s", tp, zp, tp+20);
	trimnl (datestring);
	/* asctime: Fri Sep 30 00:00:00 1986\n */
	/*          0123456789012345678901234  */
	/* RFCtime: Fri, 28 Jul 89 10:30 EDT   */
	sprintf(RFC822datestring, "%.3s, %.2s %.3s %.4s %.5s %.3s",
		tp, tp+8, tp+4, tp+20, tp+11, zp);

	/*
		Write out the from line header for the letter
	*/
	if (fromflag && deliverflag && from_user[0] != '\0') {
		snprintf(buf, bufsize, "%s%s %s\n", 
			header[H_FROM].tag, from_user, datestring);
	} else {
		snprintf(buf, bufsize, "%s%s %s\n", 
			header[H_FROM].tag, my_name, datestring);
	}
	if (!wtmpf(buf, strlen(buf))) {
		done(0);
	}
	savehdrs(buf, H_FROM);

	/*
		Copy to list in mail entry?
	*/
	if (flgt == 1 && argc > 1) {
		aret = argc;
		args = argv;
		while (--aret > 0) {
			snprintf(buf, bufsize, "%s %s\n", header[H_TO].tag, *++args);
			if (!wtmpf(buf, strlen(buf))) {
				done(0);
			}
			savehdrs(buf, H_TO);
		}
	}

	flgf = 1;	/* reset when first read of message body succeeds */
	/*
		Read mail message, allowing for lines of infinite 
		length. This is tricky, have to watch for newlines.
	*/
	saveint = setsig(SIGINT, savdead);
	last1c = ' ';	/* anything other than newline */
	ttyf = isatty (fileno(stdin));
	pushrest = 0;

	/*
	 * scan header & save relevant info.
	 */
	cpy(&fromU, &fromUsize, my_name);
	cpy(&fromS, &fromSsize, "");
	input = stdin;
	if (fstat(fileno(input), &sbuf) < 0) {
#ifdef EOVERFLOW
		if (errno == EOVERFLOW) {
			perror("stdin");
			exit(1);
		}
#endif
	}

	while ((n = getline (&line, &linesize, stdin)) > 0) {
		last1c = line[n-1];
		if (pushrest) {
			if (!wtmpf(line,n)) {
				done(0);
			}
			pushrest = (last1c != '\n');
			continue;
		}
		pushrest = (last1c != '\n');

		if ((hdrtyp = isheader (line, &ctf)) == FALSE) {
			break;
		}
		flgf = 0;
		switch (hdrtyp) {
		case H_RVERS:
			/* Are we dealing with a delivery report? */
			/* dflag = 9 ==> do not return on failure */
			dflag = 9;
			Dout(pn, 0, "dflag = 9\n");
			break;
		case H_FROM:
			if (!wtmpf(">", 1)) {
				done(0);
			}
			/* note dropthru */
			hdrtyp = H_FROM1;
		case H_FROM1:
			if (substr(line, "forwarded by") > -1) {
				break;
			}
			pickFrom (line);
			if (Rpath[0] != '\0')
				concat(&Rpath, &Rpathsize, "!");
			concat(&Rpath, &Rpathsize, fromS);
			n = 0; /* don't copy remote from's into mesg. */
			break;
		case H_CTYPE:
			/* suppress it: only generated if needed */
			n = 0; /* suppress */
			break;
		case H_TCOPY:
			/* Write out placeholder for later */
			snprintf(buf, bufsize, "%s \n", header[H_TCOPY].tag);
			if (!wtmpf(buf, strlen(buf))) {
				done(0);
			}
			n = 0; /* suppress */
			break;
		case H_MTYPE:
			if (flgm) {
				/* suppress if message-type argument */
				n = 0;
			}
			break;
		case H_CONT:
			if (oldn == 0) {
				/* suppress continuation line also */
				n = 0;
			}
			break;
		}
		oldn = n;	/* remember if this line was suppressed */
		if (n && !wtmpf(line,n)) {
			done(0);
		}
		if (!n) savehdrs(line, hdrtyp);
	}
	if (Rpath != NULL && Rpath[0] != '\0')
		concat(&Rpath, &Rpathsize, "!");
	concat(&Rpath, &Rpathsize, fromU);

	/* push out message type if so requested */
	if (flgm) {	/* message-type */
		snprintf(buf, bufsize, "%s%s\n", header[H_MTYPE].tag, msgtype);
		if (!wtmpf(buf, strlen(buf))) {
			done(0);
		}
	}

	if (n > bufsize) {
		free(buf);
		buf = smalloc(bufsize = n);
	}
	memcpy (buf, line, n);
	if (n == 0 || (ttyf && !strncmp (buf, ".\n", 2)) ) {
		if (flgf) {
			/* no input */
			return;
		} else {
			/*
			 * no content: put content-type
			 * only if explicitly present.
			 * Write out 'place-holders' only. (see below....)
			 */
			if ((hptr = hdrlines[H_CTYPE].head) !=
						    (struct hdrs *)NULL) {
				snprintf(line, linesize, "%s \n", header[H_CTYPE].tag);
				if (!wtmpf(line, strlen(line))) {
					done(0);
				}
			}
			goto wrapsend;
		}
	}

	if (n == 1 && last1c == '\n') {	/* blank line -- suppress */
		n = getline (&buf, &bufsize, stdin);
		if (n == 0 || (ttyf && !strncmp (buf, ".\n", 2)) ) {
			/*
			 * no content: put content-type
			 * only if explicitly present.
			 * Write out 'place-holder' only. (see below....)
			 */
			if ((hptr = hdrlines[H_CTYPE].head) !=
						    (struct hdrs *)NULL) {
				snprintf(line, linesize, "%s \n", header[H_CTYPE].tag);
				if (!wtmpf(line, strlen(line))) {
					done(0);
				}
			}
			goto wrapsend;
		}
	}

	if (debug > 0) {
		buf[n] = '\0';
		Dout(pn, 0, "header scan complete, readahead %d = \"%s\"\n", n, buf);
	}

	/* 
	 * Write out H_CTYPE line. This is used only as 
	 * placeholders in the tmp file. When the 'real' message is sent,
	 * the proper value will be put out by copylet().
	 */
	snprintf(line, linesize, "%s \n", header[H_CTYPE].tag);
	if (!wtmpf(line, strlen(line))) {
		done(0);
	}
	if (hdrlines[H_CTYPE].head == (struct hdrs *)NULL) {
		savehdrs(line,H_CTYPE);
	}
	/* and a blank line */
	if (!wtmpf("\n", 1)) {
		done(0);
	}
	Dout(pn, 0, "header out completed\n");

	pushrest = 0;
	count = 0L;
	/*
	 *	Are we returning mail from a delivery failure of an old-style
	 *	(SVR3.1 or SVR3.0) rmail? If so, we won't return THIS on failure
	 *	[This line should occur as the FIRST non-blank non-header line]
	 */
	if (!strncmp("***** UNDELIVERABLE MAIL sent to",buf,32)) {
	     dflag = 9; /* 9 says do not return on failure */
	     Dout(pn, 0, "found old-style UNDELIVERABLE line. dflag = 9\n");
	}

	/* scan body of message */
	while (n > 0) {
		if (ttyf && !strcmp (buf, ".\n"))
			break;
		if (!binflg) {
			binflg = !istext ((unsigned char *)buf, n);
		}

		if (!wtmpf(buf, n)) {
			done(0);
		}
		count += n;
		n = ttyf
			? getline (&buf, &bufsize, stdin)
			: fread (buf, 1, bufsize, stdin);
	}
	setsig(SIGINT, saveint);

wrapsend:
	/*
	 *	In order to use some of the subroutines that are used to
	 *	read mail, the let array must be set up
	 */
	nlet = 1;
	let[0].adr = 0;
	let[1].adr = ftell(tmpf);
	let[0].text = (binflg == 1 ? FALSE : TRUE);
	Dout(pn, 0, "body copy complete, count %ld\n", count);
	/*
	 * Modify value of H_CTYPE if necessary.
	 */
	if ((hptr = hdrlines[H_CTYPE].head) != (struct hdrs *)NULL) {
		if (strlen(hptr->value) == 0)
			strcpy(hptr->value, binflg ? "binary" : "text");
	}

	if (fclose(tmpf) == EOF) {
		tmpf = NULL;
		tmperr();
		done(0);
	}

	tmpf = doopen(lettmp,"r+",E_TMP);

	/* Do not send mail on SIGINT */
	if (dflag == 2) {
		done(0);
	}

	sendlist(&list, 0, 0);
	done(0);
}
コード例 #9
0
ファイル: glue2.c プロジェクト: ShanghaiTimes/original-bsd
savedir()
{
	if (refdir[0]==0)
		corout ("", refdir, _PATH_PWD, "", 50);
	trimnl(refdir);
}
コード例 #10
0
ファイル: refer5.c プロジェクト: bapt/heirloom-doctools
void
putsig (int nf, char **flds, int nref, char *nstline,
		char *endline, int toindex)   /* choose signal style */
{
	char t[100], t1[MXSIG], t2[100], format[10], *sd, *stline;
	int addon = 0, another = 0;
	static FILE *fhide = 0;

	if (labels) {
		if (nf == 0)	/* old */
			snprintf(t, sizeof(t), "%s%c", labtab[nref],
			    labc[nref]);
		else {
			*t = 0;
			if (keywant)
				fpar(nf, flds, t, sizeof(t), keywant, 1, 0);
			if (science && t[0] == 0) {
				if (fpar(nf, flds, t, sizeof(t), 'A', 1, 0)
				    != 0) {
					if (fpar(nf, flds, t2, sizeof(t2),
					    'D', 1, 0) != 0) {
						n_strcat(t, ", ", sizeof(t));
						n_strcat(t, t2, sizeof(t));
					}
				}
			} else if (t[0] == 0) {
				if (nmlen > 0) {
					snprintf(format, sizeof(format),
						"%%.%ds%%s", nmlen);
				} else {
					snprintf(format, sizeof(format),
						"%%s%%s");
				}
				/* format is %s%s for default labels */
				/* or %.3s%s eg if wanted */
				if (fpar(nf, flds, t2, sizeof(t2), 'D', 1, 0)) {
					sd = t2;
					if (dtlen > 0) {
						int n = strlen(sd) - dtlen;
						if (n > 0)
							sd += n;
					}
				} else {
					sd = "";
				}
				t1[0] = 0;
				fpar(nf, flds, t1, sizeof(t1), 'A', 1, 0);
				snprintf(t, sizeof(t), format, t1, sd);
			}
			if (keywant) {
				addon = 0;
				for (sd = t; *sd; sd++)
					;
				if (*--sd == '-') {
					addon = 1;
					*sd = 0;
				}
			}
			if ((!keywant || addon) && !science) {
			    addch(t, keylet(t, nref));
			}
			else {
			    tokeytab (t,nref);
			}
		}
	}
	else {
		if (sort)
			snprintf(t, sizeof(t), "%c%d%c", FLAG, nref, FLAG);
		else
			snprintf(t, sizeof(t), "%d", nref);
	}
	another = (sd = lookat()) ? prefix(sd, ".[") : 0;
	if (another && (strcmp(".[\n", sd) != SAME))
		fprintf(stderr, "File %s line %d: punctuation ignored from: %s",
			Ifile, Iline, sd);
	if ((strlen(sig) + strlen(t)) > MXSIG)
		err("sig overflow (%d)", MXSIG);
	n_strcat(sig, t, sizeof(sig));
#if EBUG
	fprintf(stderr, "sig is now %s leng %d\n",sig,strlen(sig));
#endif
	trimnl(nstline);
	trimnl(endline);
	stline = stbuff;
	if (prevsig == 0) {
		n_strcpy (stline, nstline, sizeof(stbuff));
		prevsig=1;
	}
	if (stline[2] || endline[2]) {
		stline += 2;
		endline += 2;
	}
	else {
		stline  = "\\*([.";
		endline = "\\*(.]";
	}
	if (science) {
		stline = " (";
		endline = ")";
	}
	if (bare == 0) {
		if (!another) {
			snprintf(t1, sizeof(t1), "%s%s%s\n", stline, sig,
			    endline);
			if (strlen(t1) > MXSIG)
				err("t1 overflow (%d)", MXSIG);
			append(t1);
			flout();
			sig[0] = 0;
			prevsig = 0;
			if (fo == fhide) {
				int ch;
				fclose(fhide); 
				fhide = fopen(hidenam, "r");
				fo = ftemp;
				while ((ch = getc(fhide)) != EOF)
					putc(ch, fo);
				fclose(fhide);
				unlink(hidenam);
			}
		}
		else {
			if (labels) {
				n_strcat(sig, ",\\|", sizeof(sig));
			} else {
				/*
				 * Seperate reference numbers with AFLAG
				 * for later sorting and condensing.
				 */
				t1[0] = AFLAG;
				t1[1] = '\0';
				n_strcat(sig, t1, sizeof(sig));
			}
			if (fo == ftemp) {	/* hide if need be */
				snprintf(hidenam, NTFILE,
				    "/tmp/rj%dc", (int)getpid());
#if EBUG
				fprintf(stderr, "hiding in %s\n", hidenam);
#endif
				fhide = fopen(hidenam, "w");
				if (fhide == NULL)
					err("Can't get scratch file %s",
						hidenam);
				fo = fhide;
			}
		}
	}
	if (bare < 2)
		if (nf > 0 && toindex)
			fprintf(fo,".ds [F %s%c",t,sep);
	if (bare > 0)
		flout();
#if EBUG
	fprintf(stderr, "sig is now %s\n",sig);
#endif
}