fix hex regex in SH
[nedit-bw.git] / shell_command-make-input-parameter-optional.patch
blob68edba31aacf3a0fe414b2e8618ccdf521859d74
1 ---
3 doc/help.etx | 5 +++--
4 source/macro.c | 7 ++++---
5 2 files changed, 7 insertions(+), 5 deletions(-)
7 diff --quilt old/source/macro.c new/source/macro.c
8 --- old/source/macro.c
9 +++ new/source/macro.c
10 @@ -2781,17 +2781,18 @@ static int getenvMS(WindowInfo *window,
13 static int shellCmdMS(WindowInfo *window, DataValue *argList, int nArgs,
14 DataValue *result, char **errMsg)
16 - char stringStorage[2][TYPE_INT_STR_SIZE(int)], *cmdString, *inputString;
17 + char stringStorage[2][TYPE_INT_STR_SIZE(int)], *cmdString, *inputString = "";
19 - if (nArgs != 2)
20 + if (nArgs != 1 && nArgs != 2)
21 return wrongNArgsErr(errMsg);
22 if (!readStringArg(argList[0], &cmdString, stringStorage[0], errMsg))
23 return False;
24 - if (!readStringArg(argList[1], &inputString, stringStorage[1], errMsg))
25 + if (nArgs == 2 &&
26 + !readStringArg(argList[1], &inputString, stringStorage[1], errMsg))
27 return False;
29 /* Shell command execution requires that the macro be suspended, so
30 this subroutine can't be run if macro execution can't be interrupted */
31 if (MacroRunWindow()->macroCmdData == NULL) {
32 diff --quilt old/doc/help.etx new/doc/help.etx
33 --- old/doc/help.etx
34 +++ new/doc/help.etx
35 @@ -2691,14 +2691,15 @@ Macro Subroutines
36 .. off.
38 **set_cursor_pos( position )**
39 Set the cursor position for the current window.
41 -**shell_command( command, input_string )**
42 +**shell_command( command[, input_string] )**
43 Executes a shell command, feeding it input from input_string. On completion,
44 output from the command is returned as the function value, and the command's
45 - exit status is returned in the global variable $shell_cmd_status.
46 + exit status is returned in the global variable $shell_cmd_status. If the
47 + input_string is ommited or is "" the shell command get no input.
49 **split(string, separation_string [, search_type])**
50 Splits a string using the separator specified. Optionally the search_type
51 argument can specify how the separation_string is interpreted. The default
52 is "literal". The returned value is an array with keys beginning at 0.