|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T e
Length: 3590 (0xe06) Types: TextFile Names: »edit.c«
└─⟦3d0c2be1b⟧ Bits:30001254 ISODE-5.0 Tape └─⟦eba4602b1⟧ »./isode-5.0.tar.Z« └─⟦d3ac74d73⟧ └─⟦this⟧ »isode-5.0/quipu/dish/edit.c«
/* edit.c - */ #ifndef lint static char *rcsid = "$Header: /f/osi/quipu/dish/RCS/edit.c,v 6.0 89/03/18 23:40:43 mrose Rel $"; #endif /* * $Header: /f/osi/quipu/dish/RCS/edit.c,v 6.0 89/03/18 23:40:43 mrose Rel $ * * * $Log: edit.c,v $ * Revision 6.0 89/03/18 23:40:43 mrose * Release 5.0 * */ /* * NOTICE * * Acquisition, use, and distribution of this module and related * materials are subject to the restrictions of a license agreement. * Consult the Preface in the User's Manual for the full terms of * this agreement. * */ #include "quipu/util.h" #include <fcntl.h> #include <sys/types.h> #include <sys/stat.h> extern LLog *log_dua; extern char fname[]; extern char * sprintf (); #ifndef BINDIR #define BINDIR "/usr" #endif editentry (argc, argv) int argc; char **argv; { char editbuf[LINESIZE]; if (argc != 1) { Usage (argv[0]); return (NOTOK); } (void) sprintf (editbuf, "%s/editentry %s", BINDIR, fname); return (execprog (editbuf)); } execprog (str) char *str; { char prog[LINESIZE]; extern char frompipe; int file, res; extern char inbuf[]; extern int fd; extern char remote_prob; if (frompipe) { if ((file = open (inbuf, O_WRONLY | O_NDELAY)) <= 0) { (void) fprintf (stderr, "error %d\n", file); LLOG (log_dua, LLOG_NOTICE, ("open result file failure...\n")); remote_prob = TRUE; return (NOTOK); } (void) sprintf (prog, "e%s", str); if (write (file, prog, strlen (prog)) < 0) { remote_prob = TRUE; (void) close (file); return(NOTOK); } (void) close (file); reopen_ret (); if ((res = read (fd, prog, LINESIZE)) < 0) { (void) fprintf (stderr, "read failure\n"); remote_prob = TRUE; return (NOTOK); } else { if (res == 0) { (void) fprintf (stderr, "read (0) failure\n"); remote_prob = TRUE; return (NOTOK); } if ((res == 1) && (*prog == 'e')) { remote_prob = FALSE; return (NOTOK); /* remote error - abandon ! */ } if (*fname != '/') { char tempbuf[LINESIZE]; /* relative path... prefix cwd */ *(prog + res) = 0; (void) sprintf (tempbuf, "%s/%s", prog, fname); (void) strcpy (fname, tempbuf); } } } else if (system (str) != 0) return (NOTOK); return (OK); } get_password (str,buffer) char * str; char * buffer; { char prog[LINESIZE]; extern char frompipe; int file, res; extern char inbuf[]; extern int fd; extern char remote_prob; if (frompipe) { if ((file = open (inbuf, O_WRONLY | O_NDELAY)) <= 0) { (void) fprintf (stderr, "error %d\n", file); LLOG (log_dua, LLOG_NOTICE, ("open result file failure...\n")); remote_prob = TRUE; return; } (void) sprintf (prog, "p%s", str); if (write (file, prog, strlen (prog)) < 0) { remote_prob = TRUE; (void) close (file); return; } (void) close (file); reopen_ret (); if ((res = read (fd, prog, LINESIZE)) < 0) { (void) fprintf (stderr, "read failure\n"); remote_prob = TRUE; return; } else { if (res == 0) { (void) fprintf (stderr, "read (0) failure\n"); remote_prob = TRUE; return; } if ((res == 1) && (*prog == 'e')) { remote_prob = FALSE; return; } *(prog+res) = 0; (void) strcpy (buffer, prog); } } else { (void) system ("stty -echo"); (void) printf ("Enter password for \"%s\": ",str); (void) gets (buffer); (void) system ("stty echo"); (void) printf ("\n"); } }