File:  [Research Unix] / researchv10no / cmd / odist / v10 / connect.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

/* usage: connect hostname (answer|send|notice) (in|out) program [ args ... ] */

#include <ipc.h>
#include <string.h>
#include "../paths.h"

int
main(int argc, char *argv[])
{
	int fd;

	if (argc < 5)
		return 1;

	chdir(SDIR);

	fd = ipcopen(ipcpath(argv[1], "dk", "dist"), "heavy bsdauth");
	if (fd < 0) {
		perror(argv[1]);
		return 1;
	}

	write(fd, argv[2], strlen(argv[2]) + 1);

	if (strchr(argv[3], 'i'))
		dup2(fd, 0);
	if (strchr(argv[3], 'o'))
		dup2(fd, 1);
	close(fd);
	execv(argv[4], &argv[4]);
}

unix.superglobalmegacorp.com

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