Annotation of researchv10no/cmd/odist/v10/connect.c, revision 1.1.1.1

1.1       root        1: /* usage: connect hostname (answer|send|notice) (in|out) program [ args ... ] */
                      2: 
                      3: #include <ipc.h>
                      4: #include <string.h>
                      5: #include "../paths.h"
                      6: 
                      7: int
                      8: main(int argc, char *argv[])
                      9: {
                     10:        int fd;
                     11: 
                     12:        if (argc < 5)
                     13:                return 1;
                     14: 
                     15:        chdir(SDIR);
                     16: 
                     17:        fd = ipcopen(ipcpath(argv[1], "dk", "dist"), "heavy bsdauth");
                     18:        if (fd < 0) {
                     19:                perror(argv[1]);
                     20:                return 1;
                     21:        }
                     22: 
                     23:        write(fd, argv[2], strlen(argv[2]) + 1);
                     24: 
                     25:        if (strchr(argv[3], 'i'))
                     26:                dup2(fd, 0);
                     27:        if (strchr(argv[3], 'o'))
                     28:                dup2(fd, 1);
                     29:        close(fd);
                     30:        execv(argv[4], &argv[4]);
                     31: }

unix.superglobalmegacorp.com

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