home *** CD-ROM | disk | FTP | other *** search
-
- /*
- * SETSTDIN.C
- *
- * $Header: Beta:src/uucp/src/lib/RCS/setstdin.c,v 1.1 90/02/02 12:08:28 dillon Exp Locker: dillon $
- *
- * (C) Copyright 1989-1990 by Matthew Dillon, All Rights Reserved.
- *
- * Sets stdin, stdout, and stderr to UUSER: handler
- */
-
- #include <stdio.h>
- #include "config.h"
-
- Prototype int SetStdin(int, char **);
-
- int
- SetStdin(ac, av)
- int ac;
- char **av;
- {
- short i;
- short getty = 0; /* from getty */
- char *device = "serial.device"; /* device name */
- long unit = 0; /* unit no. */
- char buf[64];
- FILE *f1, *f2, *f3;
-
- for (i = 1; i < ac; ++i) {
- char *ptr = av[i];
- if (*ptr != '-')
- continue;
- if (ptr[1] == 'D')
- device = av[++i];
- if (ptr[1] == 'U')
- unit = atoi(av[++i]);
- if (ptr[1] == 'G')
- getty = 1;
- }
- sprintf(buf, "UUSER:%s/%d/R1000G%d", device, unit, getty);
- f1 = freopen(buf, "r", stdin);
- f2 = freopen(buf, "w+", stdout);
- f3 = freopen(buf, "w+", stderr);
- return(f1 && f2 && f3);
- }
-
-