|
|
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: 3721 (0xe89)
Types: TextFile
Names: »edit.c«
└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
└─⟦35176feda⟧ »EurOpenD22/isode/isode-6.tar.Z«
└─⟦de7628f85⟧
└─⟦this⟧ »isode-6.0/quipu/dish/edit.c«
/* edit.c - */
#ifndef lint
static char *rcsid = "$Header: /f/osi/quipu/dish/RCS/edit.c,v 7.0 89/11/23 22:20:04 mrose Rel $";
#endif
/*
* $Header: /f/osi/quipu/dish/RCS/edit.c,v 7.0 89/11/23 22:20:04 mrose Rel $
*
*
* $Log: edit.c,v $
* Revision 7.0 89/11/23 22:20:04 mrose
* Release 6.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 "psap.h"
#include "tailor.h"
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
extern char fname[];
#define OPT (!frompipe || rps -> ps_byteno == 0 ? opt : rps)
#define RPS (!frompipe || opt -> ps_byteno == 0 ? rps : opt)
extern char frompipe;
extern PS opt, rps;
editentry (argc, argv)
int argc;
char **argv;
{
char editbuf[LINESIZE];
if (argc != 1) {
Usage (argv[0]);
return (NOTOK);
}
(void) sprintf (editbuf, "%s %s",
_isodefile (isodebinpath, "editentry"), fname);
return (execprog (editbuf));
}
execprog (str)
char *str;
{
char prog[LINESIZE];
int res;
extern char inbuf[];
extern int fd;
extern char remote_prob;
if (frompipe) {
/* sleep (1) */ /* needed on startup ? */
(void) sprintf (prog, "e%s", str);
send_pipe_aux (prog);
if ((res = read_pipe_aux (prog,LINESIZE)) < 1) {
(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];
int res;
extern char inbuf[];
extern int fd;
extern char remote_prob;
char * getpassword ();
if (frompipe) {
(void) sprintf (prog, "p%s", str);
send_pipe_aux (prog);
if ((res = read_pipe_aux (prog,LINESIZE)) < 1) {
(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) sprintf (buffer,"Enter password for \"%s\": ",str);
(void) strcpy (buffer,getpassword (buffer));
}
}
yesno (str)
char * str;
{
char prog[LINESIZE];
int res;
extern char inbuf[];
extern int fd;
extern char remote_prob;
char * getpassword ();
if (frompipe) {
(void) sprintf (prog, "y%s", str);
send_pipe_aux (prog);
if ((res = read_pipe_aux (prog,LINESIZE)) < 1) {
(void) fprintf (stderr, "read failure\n");
remote_prob = TRUE;
return FALSE;
} else {
if (res == 0) {
(void) fprintf (stderr, "read (0) failure\n");
remote_prob = TRUE;
return FALSE;
}
if ((res == 1) && (*prog == 'e')) {
remote_prob = FALSE;
return FALSE;
}
}
} else {
ps_printf (OPT,"%s",str);
(void) fgets (prog, sizeof prog, stdin);
}
if (prog[0] == 'y')
return TRUE;
else
return FALSE;
}