version 1.2, 2025/05/19 02:03:31
|
version 1.6, 2025/05/20 16:20:42
|
Line 1
|
Line 1
|
|
|
/* |
/* |
* |
|
* $Id$ |
* $Id$ |
* Implementation of the ZEDIT command |
* Implementation of the ZEDIT command |
* |
* |
Line 26
|
Line 24
|
* along with FreeM. If not, see <https://www.gnu.org/licenses/>. |
* along with FreeM. If not, see <https://www.gnu.org/licenses/>. |
* |
* |
* $Log$ |
* $Log$ |
|
* Revision 1.6 2025/05/20 16:20:42 snw |
|
* Update ROUTINE SSVN after ZEDIT and ZSAVE |
|
* |
|
* Revision 1.5 2025/05/20 14:36:06 snw |
|
* Documentation updates; raise ZCMMND instead of NOSTAND for restricted_mode restrictions |
|
* |
|
* Revision 1.4 2025/05/19 21:29:29 snw |
|
* Add basic tab completion to direct mode |
|
* |
|
* Revision 1.3 2025/05/19 17:57:20 snw |
|
* Extend ZEDIT to create the specified routine if it does not yet exist |
|
* |
* Revision 1.2 2025/05/19 02:03:31 snw |
* Revision 1.2 2025/05/19 02:03:31 snw |
* Reverse-engineer and document argumented ZPRINT (thanks to D. Wicksell) |
* Reverse-engineer and document argumented ZPRINT (thanks to D. Wicksell) |
* |
* |
Line 38
|
Line 48
|
**/ |
**/ |
|
|
#include <string.h> |
#include <string.h> |
|
#include <stdio.h> |
#include <stdlib.h> |
#include <stdlib.h> |
#include <ctype.h> |
#include <ctype.h> |
#include "mpsdef.h" |
#include "mpsdef.h" |
Line 51 MRESULT cmd_zedit(MACTION *ra)
|
Line 62 MRESULT cmd_zedit(MACTION *ra)
|
char editor_command[PATHLEN]; |
char editor_command[PATHLEN]; |
char *tgt_editor; |
char *tgt_editor; |
short free_editor = FALSE; |
short free_editor = FALSE; |
|
FILE *fp; |
|
|
if (restricted_mode) { |
if (restricted_mode) { |
/* we never shell out in restricted mode */ |
/* we never shell out in restricted mode */ |
retval = NOSTAND; |
retval = CMMND; |
goto done; |
goto done; |
} |
} |
|
|
Line 105 MRESULT cmd_zedit(MACTION *ra)
|
Line 117 MRESULT cmd_zedit(MACTION *ra)
|
|
|
if ((rtn_get_path (tgt_routine, pth)) == FALSE) { |
if ((rtn_get_path (tgt_routine, pth)) == FALSE) { |
/* the routine could not be found */ |
/* the routine could not be found */ |
retval = NOPGM; |
if ((fp = fopen (pth, "w")) == NULL) { |
goto done; |
retval = PROTECT; |
|
goto done; |
|
} |
|
|
|
fprintf (fp, "%s ; Created by FreeM Administrator\n QUIT\n", tgt_routine); |
|
fclose (fp); |
} |
} |
|
|
snprintf (editor_command, sizeof (editor_command) - 1, "%s %s", tgt_editor, pth); |
snprintf (editor_command, sizeof (editor_command) - 1, "%s %s", tgt_editor, pth); |
Line 117 MRESULT cmd_zedit(MACTION *ra)
|
Line 134 MRESULT cmd_zedit(MACTION *ra)
|
|
|
system (editor_command); |
system (editor_command); |
|
|
|
ssvn_routine_update (); |
|
|
/* back into mumps */ |
/* back into mumps */ |
set_io (MUMPS); |
set_io (MUMPS); |
sig_attach (SIGUSR1, &oncld); |
sig_attach (SIGUSR1, &oncld); |
|
|
retval = OK; |
retval = OK; |
|
codptr++; |
|
|
done: |
done: |
if (free_editor) free (tgt_editor); |
if (free_editor) free (tgt_editor); |