Annotation of researchv9/ipc/src/libipc/ipcexec.c, revision 1.1.1.1

1.1       root        1: #include <ipc.h>
                      2: #include "defs.h"
                      3: 
                      4: /*
                      5:  *  Perform a remote execution of a command.
                      6:  */
                      7: ipcexec(name, param, cmd)
                      8:        char *name;
                      9:        char *param;
                     10:        char *cmd;
                     11: {
                     12:        return _ipcexec(name, "dk", "exec", param, cmd);
                     13: }
                     14: 
                     15: ipcmesgexec(name, param, cmd)
                     16:        char *name;
                     17:        char *param;
                     18:        char *cmd;
                     19: {
                     20:        return _ipcexec(name, "dk", "mesgexec", param, cmd);
                     21: }
                     22: 
                     23: _ipcexec(name, def, service, param, cmd)
                     24:        char *name;
                     25:        char *service;
                     26:        char *def;
                     27:        char *param;
                     28:        char *cmd;
                     29: {
                     30:        int fd, len;
                     31: 
                     32:        fd = ipcopen(ipcpath(name, def, service), param);
                     33:        if (fd<0)
                     34:                return -1;
                     35:        if (ipclogin(fd)<0) {
                     36:                close(fd);
                     37:                return -1;
                     38:        }
                     39:        len = strlen(cmd)+1;
                     40:        cmd[len-1] = '\n';
                     41:        if (write(fd, cmd, len)!=len) {
                     42:                errstr = "write error";
                     43:                close(fd);
                     44:                return -1;
                     45:        }
                     46:        cmd[len-1] = '\0';
                     47:        return fd;
                     48: }
                     49: 
                     50: ipcrexec(name, param, cmd)
                     51:        char *name;
                     52:        char *param;
                     53:        char *cmd;
                     54: {
                     55:        int fd;
                     56: 
                     57:        fd = ipcopen(ipcpath(name, "tcp", "tcp.514"), param);
                     58:        if (fd<0)
                     59:                return -1;
                     60:        if (ipcrogin(fd, cmd)<0) {
                     61:                close(fd);
                     62:                return -1;
                     63:        }
                     64:        return fd;
                     65: }

unix.superglobalmegacorp.com

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