Diff for /freem/src/cmd_zedit.c between versions 1.1 and 1.2

version 1.1, 2025/05/19 01:08:12 version 1.2, 2025/05/19 02:03:31
Line 26 Line 26
  *   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.2  2025/05/19 02:03:31  snw
    *   Reverse-engineer and document argumented ZPRINT (thanks to D. Wicksell)
    *
  *   Revision 1.1  2025/05/19 01:08:12  snw   *   Revision 1.1  2025/05/19 01:08:12  snw
  *   Add ZEDIT command (properly this time)   *   Add ZEDIT command (properly this time)
  *   *
Line 50  MRESULT cmd_zedit(MACTION *ra) Line 53  MRESULT cmd_zedit(MACTION *ra)
     short free_editor = FALSE;      short free_editor = FALSE;
   
     if (restricted_mode) {      if (restricted_mode) {
           /* we never shell out in restricted mode */
         retval = NOSTAND;          retval = NOSTAND;
         goto done;          goto done;
     }      }
   
     if (rou_name[0] == EOL) {      if (rou_name[0] == EOL) {
           /* there was no current routine */
         retval = NOPGM;          retval = NOPGM;
         goto done;          goto done;
     }              }        
Line 64  MRESULT cmd_zedit(MACTION *ra) Line 69  MRESULT cmd_zedit(MACTION *ra)
         NULLPTRCHK(tgt_editor,"cmd_zedit");          NULLPTRCHK(tgt_editor,"cmd_zedit");
                   
         snprintf (tgt_editor, STRLEN - 1, "/usr/bin/vi");          snprintf (tgt_editor, STRLEN - 1, "/usr/bin/vi");
   
           /* had to allocate the editor path on the heap,
              so we need to free it later */         
         free_editor = TRUE;          free_editor = TRUE;
     }      }
           
     if (*codptr == SP || *codptr == EOL) {      if (*codptr == SP || *codptr == EOL) {
           /* argumentless ZEDIT edits the current routine */
         stcpy (tgt_routine, rou_name);          stcpy (tgt_routine, rou_name);
     }      }
     else {      else {
           /* argumented ZEDIT edits a specified routine */
         expr (NAME);          expr (NAME);
                   
         if (varnam[0] == '^') {          if (varnam[0] == '^') {
Line 94  MRESULT cmd_zedit(MACTION *ra) Line 104  MRESULT cmd_zedit(MACTION *ra)
     stcnv_m2c (tgt_routine);      stcnv_m2c (tgt_routine);
           
     if ((rtn_get_path (tgt_routine, pth)) == FALSE) {      if ((rtn_get_path (tgt_routine, pth)) == FALSE) {
           /* the routine could not be found */
         retval = NOPGM;          retval = NOPGM;
         goto done;          goto done;
     }      }
           
     snprintf (editor_command, sizeof (editor_command) - 1, "%s %s", tgt_editor, pth);      snprintf (editor_command, sizeof (editor_command) - 1, "%s %s", tgt_editor, pth);
       
       /* make the environment friendly to running external programs */
     sig_attach (SIGUSR1, SIG_IGN);      sig_attach (SIGUSR1, SIG_IGN);
     set_io (UNIX);      set_io (UNIX);
   
     system (editor_command);      system (editor_command);
   
       /* back into mumps */
     set_io (MUMPS);      set_io (MUMPS);
     sig_attach (SIGUSR1, &oncld);      sig_attach (SIGUSR1, &oncld);
   

Removed from v.1.1  
changed lines
  Added in v.1.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>