File:  [MW Coherent from dump] / coherent / b / STREAMS / conf_79 / echo / strtest.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed May 29 04:56:36 2019 UTC (7 years, 2 months ago) by root
Branches: MarkWilliams, MAIN
CVS tags: relic, HEAD
coherent

#include <stropts.h>
#include <fcntl.h>
#include <stdio.h>


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

	if ((fd = open ("/dev/echo", O_RDWR)) == -1) {

		perror ("Couldn't open /dev/echo");
		return -1;
	}

	fprintf (stderr, "Returned %d\n", fd);

	fprintf (stderr, "PUSH ioctl () says %d\n", ioctl (fd, I_PUSH, "dump"));
	fprintf (stderr, "SRDOPT ioctl () says %d\n", ioctl (fd, I_SRDOPT, RMSGN));

	write (fd, "Foo!", 5);
	cnt = read (fd, buf, sizeof (buf));
	buf [cnt] = 0;

	fprintf (stderr, "Read %d bytes, result = %s\n", cnt, buf);

	close (fd);

	return 0;
}

unix.superglobalmegacorp.com

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