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

/* get the system's name -- v10 version*/

#define WHOFILE "/etc/whoami"

extern char *
sysname_read()
{
	register int fd, i, n;
	static char sysname[128];

	/* read the system identity */
	fd = open(WHOFILE, 0);
	if (fd < 0)
		return "kremvax";
	n = read(fd, sysname, sizeof(sysname)-1);
	close(fd);
	if (n < 0)
		return "kremvax";

	sysname[n] = '\0';

	/* find the trailing \n if any and make it \0 */
	for (i = 0; i < n; i++)
		if (sysname[i] == '\n')
			sysname[i] = '\0';

	return sysname;
}

unix.superglobalmegacorp.com

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