lsystem.c (009e81b16465ea457c0e63fd49fe77f47cc27a5a) lsystem.c (1ea316270f1f75922ac53976d5d8808a41442f46)
1/*
2 * Copyright (C) 1984-2015 Mark Nudelman
3 *
4 * You may distribute under the terms of either the GNU General Public
5 * License or the Less License, as specified in the README file.
6 *
7 * For more information, see the README file.
8 */

--- 24 unchanged lines hidden (view full) ---

33
34#if HAVE_SYSTEM
35
36/*
37 * Pass the specified command to a shell to be executed.
38 * Like plain "system()", but handles resetting terminal modes, etc.
39 */
40 public void
1/*
2 * Copyright (C) 1984-2015 Mark Nudelman
3 *
4 * You may distribute under the terms of either the GNU General Public
5 * License or the Less License, as specified in the README file.
6 *
7 * For more information, see the README file.
8 */

--- 24 unchanged lines hidden (view full) ---

33
34#if HAVE_SYSTEM
35
36/*
37 * Pass the specified command to a shell to be executed.
38 * Like plain "system()", but handles resetting terminal modes, etc.
39 */
40 public void
41lsystem(cmd, donemsg)
42 char *cmd;
43 char *donemsg;
41lsystem(char *cmd, char *donemsg)
44{
42{
45 register int inp;
43 int inp;
46#if HAVE_SHELL
44#if HAVE_SHELL
47 register char *shell;
48 register char *p;
45 char *shell;
46 char *p;
49#endif
50 IFILE save_ifile;
51#if MSDOS_COMPILER && MSDOS_COMPILER!=WIN32C
52 char cwd[FILENAME_MAX+1];
53#endif
54
55 /*
56 * Print the command which is to be executed,

--- 188 unchanged lines hidden (view full) ---

245 * If the mark is after the current screen, the section between
246 * the top line displayed and the mark is piped.
247 * If the mark is before the current screen, the section between
248 * the mark and the bottom line displayed is piped.
249 * If the mark is on the current screen, or if the mark is ".",
250 * the whole current screen is piped.
251 */
252 public int
47#endif
48 IFILE save_ifile;
49#if MSDOS_COMPILER && MSDOS_COMPILER!=WIN32C
50 char cwd[FILENAME_MAX+1];
51#endif
52
53 /*
54 * Print the command which is to be executed,

--- 188 unchanged lines hidden (view full) ---

243 * If the mark is after the current screen, the section between
244 * the top line displayed and the mark is piped.
245 * If the mark is before the current screen, the section between
246 * the mark and the bottom line displayed is piped.
247 * If the mark is on the current screen, or if the mark is ".",
248 * the whole current screen is piped.
249 */
250 public int
253pipe_mark(c, cmd)
254 int c;
255 char *cmd;
251pipe_mark(int c, char *cmd)
256{
257 POSITION mpos, tpos, bpos;
258
259 /*
260 * mpos = the marked position.
261 * tpos = top of screen.
262 * bpos = bottom of screen.
263 */

--- 15 unchanged lines hidden (view full) ---

279 return (pipe_data(cmd, tpos, mpos));
280}
281
282/*
283 * Create a pipe to the given shell command.
284 * Feed it the file contents between the positions spos and epos.
285 */
286 public int
252{
253 POSITION mpos, tpos, bpos;
254
255 /*
256 * mpos = the marked position.
257 * tpos = top of screen.
258 * bpos = bottom of screen.
259 */

--- 15 unchanged lines hidden (view full) ---

275 return (pipe_data(cmd, tpos, mpos));
276}
277
278/*
279 * Create a pipe to the given shell command.
280 * Feed it the file contents between the positions spos and epos.
281 */
282 public int
287pipe_data(cmd, spos, epos)
288 char *cmd;
289 POSITION spos;
290 POSITION epos;
283pipe_data(char *cmd, POSITION spos, POSITION epos)
291{
284{
292 register FILE *f;
293 register int c;
285 FILE *f;
286 int c;
294 extern FILE *popen();
295
296 /*
297 * This is structured much like lsystem().
298 * Since we're running a shell program, we must be careful
299 * to perform the necessary deinitialization before running
300 * the command, and reinitialization after it.
301 */

--- 72 unchanged lines hidden ---
287 extern FILE *popen();
288
289 /*
290 * This is structured much like lsystem().
291 * Since we're running a shell program, we must be careful
292 * to perform the necessary deinitialization before running
293 * the command, and reinitialization after it.
294 */

--- 72 unchanged lines hidden ---