|
|
Initial revision
/* edit.c - */
#ifndef lint
static char *rcsid = "$Header: /var/lib/cvsd/repos/CSRG/43BSDReno/contrib/isode-beta/quipu/dish/edit.c,v 1.1 2018/04/24 16:12:56 root Exp $";
#endif
/*
* $Header: /var/lib/cvsd/repos/CSRG/43BSDReno/contrib/isode-beta/quipu/dish/edit.c,v 1.1 2018/04/24 16:12:56 root Exp $
*
*
* $Log: edit.c,v $
* Revision 1.1 2018/04/24 16:12:56 root
* Initial revision
*
* Revision 7.1 90/07/09 14:47:08 mrose
* sync
*
* 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 "manifest.h"
#include "quipu/util.h"
#include "psap.h"
#include "tailor.h"
#include <fcntl.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;
}
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.