Deleted Added
full compact
lsystem.c (89019) lsystem.c (128345)
1/*
1/*
2 * Copyright (C) 1984-2000 Mark Nudelman
2 * Copyright (C) 1984-2002 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 about less, or for information on how to
8 * contact the author, see the README file.
9 */
10

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

125#if HAVE_SHELL
126 p = NULL;
127 if ((shell = lgetenv("SHELL")) != NULL && *shell != '\0')
128 {
129 if (*cmd == '\0')
130 p = save(shell);
131 else
132 {
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 about less, or for information on how to
8 * contact the author, see the README file.
9 */
10

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

125#if HAVE_SHELL
126 p = NULL;
127 if ((shell = lgetenv("SHELL")) != NULL && *shell != '\0')
128 {
129 if (*cmd == '\0')
130 p = save(shell);
131 else
132 {
133 char *esccmd;
134 if ((esccmd = esc_metachars(cmd)) == NULL)
133 char *esccmd = shell_quote(cmd);
134 if (esccmd != NULL)
135 {
136 p = (char *) ecalloc(strlen(shell) +
135 {
136 p = (char *) ecalloc(strlen(shell) +
137 strlen(cmd) + 7, sizeof(char));
138 sprintf(p, "%s -c \"%s\"", shell, cmd);
139 } else
140 {
141 p = (char *) ecalloc(strlen(shell) +
142 strlen(esccmd) + 5, sizeof(char));
137 strlen(esccmd) + 5, sizeof(char));
143 sprintf(p, "%s -c %s", shell, esccmd);
138 sprintf(p, "%s %s %s", shell, shell_coption(), esccmd);
144 free(esccmd);
145 }
146 }
147 }
148 if (p == NULL)
149 {
150 if (*cmd == '\0')
151 p = save("sh");
152 else
153 p = save(cmd);
154 }
139 free(esccmd);
140 }
141 }
142 }
143 if (p == NULL)
144 {
145 if (*cmd == '\0')
146 p = save("sh");
147 else
148 p = save(cmd);
149 }
155
156 system(p);
157 free(p);
158#else
159#if MSDOS_COMPILER==DJGPPC
160 /*
161 * Make stdin of the child be in cooked mode.
162 */
163 setmode(0, O_TEXT);

--- 352 unchanged lines hidden ---
150 system(p);
151 free(p);
152#else
153#if MSDOS_COMPILER==DJGPPC
154 /*
155 * Make stdin of the child be in cooked mode.
156 */
157 setmode(0, O_TEXT);

--- 352 unchanged lines hidden ---