cvs: /php4/ext/standard exec.c
| From: | Andrei Zmievski | Date: | Tue, 22 Feb 2000 18:01:02 +0000 |
| Subject: | cvs: /php4/ext/standard exec.c | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-10659@lists.php.net to get a copy of this message | ||
andrei Tue Feb 22 10:01:02 2000 EDT
Modified files:
/php4/ext/standard exec.c
Log:
(PHP exec) Return last line of output properly.
Index: php4/ext/standard/exec.c
diff -u php4/ext/standard/exec.c:1.27 php4/ext/standard/exec.c:1.28
--- php4/ext/standard/exec.c:1.27 Sat Feb 19 15:41:20 2000
+++ php4/ext/standard/exec.c Tue Feb 22 10:00:32 2000
@@ -15,7 +15,7 @@
| Author: Rasmus Lerdorf |
+----------------------------------------------------------------------+
*/
-/* $Id: exec.c,v 1.27 2000/02/19 23:41:20 zeev Exp $ */
+/* $Id: exec.c,v 1.28 2000/02/22 18:00:32 andrei Exp $ */
#include <stdio.h>
#include "php.h"
@@ -166,6 +166,14 @@
while (l && isspace((int)buf[--l]));
if (l < t) buf[l + 1] = '\0';
+ /* Return last line from the shell command */
+ if (PG(magic_quotes_runtime)) {
+ int len;
+
+ tmp = php_addslashes(buf, 0, &len, 0);
+ RETVAL_STRINGL(tmp,len,0);
+ } else
+ RETVAL_STRINGL(buf,l,1);
} else {
int b, i;
@@ -173,14 +181,6 @@
for (i = 0; i < b; i++)
if (output) (void)PUTC(buf[i]);
}
- }
-
- /* Return last line from the shell command */
- if (PG(magic_quotes_runtime) && type!=3) {
- int len;
-
- tmp = php_addslashes(buf, 0, &len, 0);
- RETVAL_STRINGL(tmp,len,0);
}
ret = pclose(fp);