Annotation of researchv10dc/ipc/bin/pupu/pupu.c, revision 1.1.1.1

1.1       root        1: 
                      2:        static char     SCCSID[] = "@(#)pupu.c  2.1 DKHOST 85/01/15";
                      3: 
                      4: #include       <stdio.h>
                      5: #include       <sysexits.h>
                      6: #include       <string.h>
                      7: #include       <ipc.h>
                      8: #include       "tdefs.h"
                      9: 
                     10:        XcharP  iam;
                     11: int    DEBUG;
                     12:        
                     13: 
                     14:        Xchar   ebuf[BUFSIZ];
                     15: 
                     16:        Efn     printerr;
                     17: 
                     18:        int     dkverbose;
                     19: 
                     20: extern char * maphost() ;
                     21: extern char * miscfield() ;
                     22: 
                     23: main(argc, argv)
                     24:        PcharP  argv[];
                     25: {
                     26:        RcharP  p;
                     27:        Aint    fd;
                     28:        AcharP  dir;
                     29: 
                     30:        if (strcmp(&argv[0][strlen(argv[0])-2], "cc") == 0)
                     31:                argv[0][strlen(argv[0])-2] = '\0' ;
                     32:        iam = &argv[0][strlen(argv[0]) - 4];
                     33: 
                     34:        if (strcmp(argv[1], "-d") == 0) {
                     35:                DEBUG = 1 ;
                     36:                argv++ ; argc-- ;
                     37:        } else
                     38:                DEBUG = 0 ;
                     39:        if(strcmp(iam, "pupu") == 0)
                     40:                exit(ppremote(0));
                     41: 
                     42: /*     setbuf(stderr, ebuf);/**/
                     43: 
                     44:        if(argc < 4){
                     45:                fprintf(stderr, "Usage:  %s host file ... directory\n", iam);
                     46:                exit(EX_USAGE);
                     47:        }
                     48: 
                     49:        fd = ipcopen(ipcpath (argv[1], "dk", "pupu"), "heavy delim");
                     50: 
                     51:        if(fd < 0) {
                     52:                fprintf(stderr, "call to %s failed: %s\n", argv[1], errstr);
                     53:                exit(-fd);
                     54:        }
                     55: 
                     56:        dir = argv[argc - 1];
                     57: 
                     58:        argv[argc - 1] = 0;
                     59: 
                     60:        if(strcmp(iam, "push") == 0)
                     61:                exit(push(fd, &argv[2], dir, printerr, ""));
                     62:        else if(strcmp(iam, "pull") == 0)
                     63:                exit(pull(fd, &argv[2], dir, printerr, ""));
                     64:        else{
                     65:                fprintf(stderr, "Command name unrecognized -- must be 'push' or 'pull'\n");
                     66:                exit(EX_USAGE);
                     67:        }
                     68:        /* NOTREACHED */
                     69: }
                     70: 
                     71: printerr(msg)
                     72:        PcharP  msg;
                     73: {
                     74:        fprintf(stderr, "%s%s\n", iam, msg);
                     75: 
                     76:        fflush(stderr);
                     77: 
                     78:        return(0);
                     79: }

unix.superglobalmegacorp.com

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