File:  [MW Coherent from dump] / coherent / g / usr / bin / vi / strldbg.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed May 29 04:56:35 2019 UTC (7 years ago) by root
Branches: MarkWilliams, MAIN
CVS tags: relic, HEAD
coherent

/* strldgb.c - debugging version of strlen */

#include <fcntl.h>

int fddb = -1;

/*
 * stack:
 *	Arg
 *	Return Addr
 */
int strlen(cp)
char * cp;
{
	int * dbp;
	char buf[80];

	if (fddb == -1) {
		fddb = open("/dev/console", O_RDWR);
	}

	dbp = (int *)&cp;
	dbp--;
	sprintf(buf, "from %08x: strlen(%08x)\n", *dbp, cp);
	write(fddb, buf, stl(buf));
	return stl(cp);
}

int stl(cp)
char * cp;
{
	int ret = 0;
	while (*cp++)
		ret++;
	return ret;
}

unix.superglobalmegacorp.com

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