2.8BSD Bourne shell: no comments?

Keith Packard keith at motel6.UUCP
Mon Jun 24 16:40:34 AEST 1985


In article <1228 at uwmacc.UUCP> jwp at uwmacc.UUCP (jeffrey w percival) writes:
>My system doesn't seem to support the '#' comment character.
>Is there an easy fix?
>
>-- 
>	Jeff Percival ...!uwvax!uwmacc!jwp

The listing below is extracted from main.c.  It represents a major hack
that lets # comments work most of the time.  They only work if
the # is the *first* character on the line, not any other time!
It was quick and dirty.  It will stay this way until I get the
Bourne shell mods for job control.

		IF (flags&prompt) ANDF standin->fstak==0 ANDF !eof
		THEN	IF mailnod.namval
			    ANDF stat(mailnod.namval,&statb)>=0 ANDF statb.st_size
			    ANDF (statb.st_mtime != mailtime)
			    ANDF mailtime
			THEN	prs(mailmsg)
			FI
			mailtime=statb.st_mtime;
			prs(ps1nod.namval); alarm(TIMEOUT); flags |= waiting;
		FI

		trapnote=0; peekc=readc();
!		/*
!		 *	major kludge to allow '#' to delimit
!		 *	comment lines
!		 */
!		if (peekc == '#') {
!			while (readc() != '\n');
!			continue;
!		}
		IF eof
		THEN	return;
		FI
		alarm(0); flags &= ~waiting;
		execute(cmd(NL,MTFLG),0);
		eof |= (flags&oneflg);
	POOL
}

Keith Packard
...!tektronix!reed!motel6!keith



More information about the Comp.unix mailing list