static char *rcsid
= "$Header: /f/osi/quipu/dish/RCS/edit.c,v 7.2 91/02/22 09:40:31 mrose Interim $";
* $Header: /f/osi/quipu/dish/RCS/edit.c,v 7.2 91/02/22 09:40:31 mrose Interim $
* Revision 7.2 91/02/22 09:40:31 mrose
* Revision 7.1 90/07/09 14:47:08 mrose
* Revision 7.0 89/11/23 22:20:04 mrose
* 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
#define OPT (!frompipe || rps -> ps_byteno == 0 ? opt : rps)
#define RPS (!frompipe || opt -> ps_byteno == 0 ? rps : opt)
(void) sprintf (str
, "%s %s",
_isodefile (isodebinpath
, "editentry"), fname
);
return (system (str
) ? NOTOK
: OK
);
(void) sprintf (prog
, "e%s\n", str
);
if ((res
= read_pipe_aux (prog
,sizeof prog
)) < 1) {
(void) fprintf (stderr
, "read failure\n");
if ((res
== 1) && (*prog
== 'e')) {
return (NOTOK
); /* remote error - abandon ! */
/* relative path... prefix cwd */
(void) sprintf (tempbuf
, "%s/%s", prog
, fname
);
(void) strcpy (fname
, tempbuf
);
"operation not allowed when using directory assistance server!\n");
if ((fp
= fopen (fname
, "r+")) == NULL
) {
ps_printf (OPT
, "unable to open %s for rw: %s\n",
fname
, sys_errname (errno
));
if (fstat (fileno (fp
), &st
) == NOTOK
|| (st
.st_mode
& S_IFMT
) != S_IFREG
|| (cc
= st
.st_size
) == 0) {
ps_printf (OPT
, "%s: not a regular file\n", fname
);
(void) sprintf (prog
, "e%d\n", cc
);
if ((res
= read_pipe_aux (prog
, sizeof prog
)) < 1) {
(void) fprintf (stderr
, "read failure\n");
if ((res
== 1) && (*prog
== 'e')) {
if ((cp
= malloc ((unsigned) (cc
))) == NULL
) {
ps_printf (OPT
, "out of memory\n");
for (dp
= cp
, j
= cc
; j
> 0; dp
+= i
, j
-= i
)
switch (i
= fread (dp
, sizeof *dp
, j
, fp
)) {
ps_printf (OPT
, "error reading %s: %s\n",
fname
, sys_errname (errno
));
ps_printf (OPT
, "premature eof reading %s\n",
if ((res
= read_pipe_aux2 (&cp
, &cc
)) < 1) {
(void) ps_printf (OPT
, "read failure\n");
(void) ps_printf (OPT
, "remote protocol error: %s\n",
if ((fp
= fopen (fname
, "w")) == NULL
) {
ps_printf (OPT
, "unable to re-open %s for writing: %s\n",
fname
, sys_errname (errno
));
if (fwrite (cp
, sizeof *cp
, cc
, fp
) == 0) {
ps_printf (OPT
, "error writing %s: %s\n",
fname
, sys_errname (errno
));
get_password (str
,buffer
)
(void) sprintf (prog
, "p%s\n", str
);
if ((res
= read_pipe_aux (prog
,sizeof prog
)) < 1) {
(void) fprintf (stderr
, "read failure\n");
(void) strcpy (buffer
, prog
+ 1);
(void) sprintf (buffer
,"Enter password for \"%s\": ",str
);
(void) strcpy (buffer
,getpassword (buffer
));
(void) sprintf (prog
, "y%s\n", str
);
if (read_pipe_aux (prog
,sizeof prog
) < 1) {
(void) fprintf (stderr
, "read failure\n");
ps_printf (OPT
,"%s",str
);
(void) fgets (prog
, sizeof prog
, stdin
);