1variable Last_Process_Command = Null_String;
2
3define process_region ()
4{
5   variable cmd, tmp_file;
6   cmd = read_mini ("Pipe to command:", Last_Process_Command, Null_String);
7   !if (strlen (cmd)) return;
8
9   Last_Process_Command = cmd;
10
11   tmp_file = make_tmp_file ("/tmp/jedpipe");
12   cmd = strncat (cmd, " > ", tmp_file, " 2>&1", 4);
13
14   !if (dupmark ()) error ("Mark not set.");
15
16   if (pipe_region (cmd))
17     {
18	error ("Process returned a non-zero exit status.");
19     }
20   del_region ();
21   () = insert_file (tmp_file);
22   () = delete_file (tmp_file);
23}
24
25
26
27