Annotation of 43BSDReno/contrib/isode-beta/quipu/dish/edit.c, revision 1.1

1.1     ! root        1: /* edit.c - */
        !             2: 
        !             3: #ifndef        lint
        !             4: static char *rcsid = "$Header: /f/osi/quipu/dish/RCS/edit.c,v 7.1 90/07/09 14:47:08 mrose Exp $";
        !             5: #endif
        !             6: 
        !             7: /* 
        !             8:  * $Header: /f/osi/quipu/dish/RCS/edit.c,v 7.1 90/07/09 14:47:08 mrose Exp $
        !             9:  *
        !            10:  *
        !            11:  * $Log:       edit.c,v $
        !            12:  * Revision 7.1  90/07/09  14:47:08  mrose
        !            13:  * sync
        !            14:  * 
        !            15:  * Revision 7.0  89/11/23  22:20:04  mrose
        !            16:  * Release 6.0
        !            17:  * 
        !            18:  */
        !            19: 
        !            20: /*
        !            21:  *                               NOTICE
        !            22:  *
        !            23:  *    Acquisition, use, and distribution of this module and related
        !            24:  *    materials are subject to the restrictions of a license agreement.
        !            25:  *    Consult the Preface in the User's Manual for the full terms of
        !            26:  *    this agreement.
        !            27:  *
        !            28:  */
        !            29: 
        !            30: 
        !            31: #include "manifest.h"
        !            32: #include "quipu/util.h"
        !            33: #include "psap.h"
        !            34: #include "tailor.h"
        !            35: #include <fcntl.h>
        !            36: #include <sys/stat.h>
        !            37: 
        !            38: extern char     fname[];
        !            39: 
        !            40: #define        OPT     (!frompipe || rps -> ps_byteno == 0 ? opt : rps)
        !            41: #define        RPS     (!frompipe || opt -> ps_byteno == 0 ? rps : opt)
        !            42: extern char    frompipe;
        !            43: extern PS      opt, rps;
        !            44: 
        !            45: editentry (argc, argv)
        !            46: int             argc;
        !            47: char          **argv;
        !            48: {
        !            49:        char            editbuf[LINESIZE];
        !            50: 
        !            51:        if (argc != 1) {
        !            52:                Usage (argv[0]);
        !            53:                return (NOTOK);
        !            54:        }
        !            55: 
        !            56:        (void) sprintf (editbuf, "%s %s",
        !            57:                        _isodefile (isodebinpath, "editentry"), fname);
        !            58: 
        !            59:        return (execprog (editbuf));
        !            60: }
        !            61: 
        !            62: 
        !            63: execprog (str)
        !            64: char           *str;
        !            65: {
        !            66:        char            prog[LINESIZE];
        !            67:        int             res;
        !            68:        extern char     inbuf[];
        !            69:        extern int      fd;
        !            70:        extern char     remote_prob;
        !            71: 
        !            72:        if (frompipe) {
        !            73: 
        !            74:                /* sleep (1) */ /* needed on startup ? */
        !            75: 
        !            76:                (void) sprintf (prog, "e%s", str);
        !            77: 
        !            78:                send_pipe_aux (prog);
        !            79: 
        !            80:                if ((res = read_pipe_aux (prog,LINESIZE)) < 1) {
        !            81:                        (void) fprintf (stderr, "read failure\n");
        !            82:                        remote_prob = TRUE;
        !            83:                        return (NOTOK);
        !            84:                } else {
        !            85:                        if (res == 0) {
        !            86:                                (void) fprintf (stderr, "read (0) failure\n");
        !            87:                                remote_prob = TRUE;
        !            88:                                return (NOTOK);
        !            89:                        }
        !            90:                        if ((res == 1) && (*prog == 'e')) {
        !            91:                                remote_prob = FALSE;
        !            92:                                return (NOTOK);  /* remote error - abandon ! */
        !            93:                        } 
        !            94:                        if (*fname != '/') {
        !            95:                                char            tempbuf[LINESIZE];
        !            96: 
        !            97:                                /* relative path... prefix cwd */
        !            98:                                *(prog + res) = 0;
        !            99:                                (void) sprintf (tempbuf, "%s/%s", prog, fname);
        !           100:                                (void) strcpy (fname, tempbuf);
        !           101:                        }
        !           102:                }
        !           103:        } else
        !           104:                if (system (str) != 0)
        !           105:                        return (NOTOK);
        !           106: 
        !           107:        return (OK);
        !           108: }
        !           109: 
        !           110: 
        !           111: get_password (str,buffer)
        !           112: char * str;
        !           113: char * buffer;
        !           114: {
        !           115: 
        !           116:        char            prog[LINESIZE];
        !           117:        int             res;
        !           118:        extern char     inbuf[];
        !           119:        extern int      fd;
        !           120:        extern char     remote_prob;
        !           121:        char *          getpassword ();
        !           122: 
        !           123:        if (frompipe) {
        !           124:                (void) sprintf (prog, "p%s", str);
        !           125: 
        !           126:                send_pipe_aux (prog);
        !           127: 
        !           128:                if ((res = read_pipe_aux (prog,LINESIZE)) < 1) {
        !           129:                        (void) fprintf (stderr, "read failure\n");
        !           130:                        remote_prob = TRUE;
        !           131:                        return;
        !           132:                } else {
        !           133:                        if (res == 0) {
        !           134:                                (void) fprintf (stderr, "read (0) failure\n");
        !           135:                                remote_prob = TRUE;
        !           136:                                return;
        !           137:                        }
        !           138:                        if ((res == 1) && (*prog == 'e')) {
        !           139:                                remote_prob = FALSE;
        !           140:                                return;
        !           141:                        } 
        !           142:                        *(prog+res) = 0;
        !           143:                        (void) strcpy (buffer, prog);
        !           144:                }
        !           145:        } else {
        !           146:                (void) sprintf (buffer,"Enter password for \"%s\": ",str);
        !           147:                (void) strcpy (buffer,getpassword (buffer));
        !           148:        }
        !           149: }
        !           150: 
        !           151: yesno (str)
        !           152: char * str;
        !           153: {
        !           154:        char            prog[LINESIZE];
        !           155:        int             res;
        !           156:        extern char     inbuf[];
        !           157:        extern int      fd;
        !           158:        extern char     remote_prob;
        !           159:        char *          getpassword ();
        !           160: 
        !           161:        if (frompipe) {
        !           162:                (void) sprintf (prog, "y%s", str);
        !           163: 
        !           164:                send_pipe_aux (prog);
        !           165: 
        !           166:                if ((res = read_pipe_aux (prog,LINESIZE)) < 1) {
        !           167:                        (void) fprintf (stderr, "read failure\n");
        !           168:                        remote_prob = TRUE;
        !           169:                        return FALSE;
        !           170:                } else {
        !           171:                        if (res == 0) {
        !           172:                                (void) fprintf (stderr, "read (0) failure\n");
        !           173:                                remote_prob = TRUE;
        !           174:                                return FALSE;
        !           175:                        }
        !           176:                        if ((res == 1) && (*prog == 'e')) {
        !           177:                                remote_prob = FALSE;
        !           178:                                return FALSE;
        !           179:                        } 
        !           180:                }
        !           181:        } else {
        !           182:                ps_printf (OPT,"%s",str);
        !           183:                (void) fgets (prog, sizeof prog, stdin);
        !           184:        }
        !           185: 
        !           186:        if (prog[0] == 'y')
        !           187:                return TRUE;
        !           188:        else
        !           189:                return FALSE;
        !           190: }

unix.superglobalmegacorp.com

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