File:  [Research Unix] / researchv10no / cmd / basic / bite / src / minus.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:35 2018 UTC (8 years, 1 month ago) by root
Branches: belllabs, MAIN
CVS tags: researchv10, HEAD
researchv10 Norman

/* Copyright Bell Telephone Laboratories Whippany, N.J.

 *	***************************************************
 *	***************************************************
 *	*** EQUIVALENT TO THE UNIX EDITOR'S '-' COMMAND ***
 *	*********** R. B. Drake WH 8C-005 X4163 ***********
 *	************ Sun Aug 26 10:54:49 1979 *************
 *	***************************************************
 *	***************************************************
 * Find the beginning of the previous line and print it

*/
/*   "@(#) minus.c:  V 1.1  12/21/80" */

#include "bas.h"
minus()
{
	int n,c;
	if(expr[0] != '\0')
		n=atoi(expr);
	else
		n=1;
	while(curptr != txtbuf && n--)
	{
		--curptr;
		while((c=((*--curptr)&0377)) != 0 && c < 0200) ;
		curptr -= 2; /* decriment to beginning of line */
	}
	lbdptr=curptr;
	if(fetch(-1,&lbdptr) < 0)
	{
		error(inst.thing.linno,0);
		return(-1);
	}
	prin();
	return(0);
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.