remove '\n' from end of callout return
Sorry, i hit the second time that key in Mutt that sends the mail instead of selecting the file to attach? We have for every line of code one mail now, luckily the patch is so small :)
thanks,
Kay
Quoted 15 lines
Yes, there are only 3 lines in the patch, but this one is still better :)
Quoted 13 lines
Uups, new mail. It's better to attach the promised file :)
Attached is a patch to remove a possible newline from the end of the callout returned string. So we can use "echo" instead of "echo -n" in a callout script, to match with ID=
thanks,
Kay03-remove-newline-from-callout-return.diff
remove possible newline at end of callout output, for easier matching with ID=
namedev.c +7 -4
@@ -264,7 +264,7 @@pid_t pid;int value_set =0 ;char buffer[256 ]; -char *arg; +char *pos;char *args[CALLOUT_MAXARG ];int i;
@@ -286,9 +286,9 @@dup (fds[1 ]);/* dup write side of pipe to STDOUT */ if (strchr (dev->exec_program,' ' )) {/* callout with arguments */ - arg = dev->exec_program; + pos = dev->exec_program;for (i=0 ; i <CALLOUT_MAXARG -1 ; i++) { - args[i] =strsep (&arg," " ); + args[i] =strsep (&pos," " );if (args[i] ==NULL )break ; }
@@ -324,9 +324,12 @@ }else { value_set =1 ;strncpy (value, buffer, len); + pos = value +strlen (value)-1 ; +if (pos[0 ] =='\n' ) + pos[0 ] ='\0' ; +dbg ("callout returned '%s'" , value); } } -dbg ("callout returned '%s'" , value);close (fds[0 ]); res =wait (&status);if (res <0 ) {