From 1d7b373ae7da47cac00fb8f413e90e70a9dcf688 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net> Date: Fri, 1 May 1998 08:32:10 -0700 Subject: [PATCH] bugfix for NT Rev: src/fdlib.c:1.17 Rev: src/signal_handler.c:1.58 --- src/fdlib.c | 5 ++++- src/signal_handler.c | 42 +++++++++++++++++++++++++++++++----------- 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/src/fdlib.c b/src/fdlib.c index b5de1ff136..40d488fd73 100644 --- a/src/fdlib.c +++ b/src/fdlib.c @@ -3,7 +3,7 @@ #include "error.h" #include <math.h> -RCSID("$Id: fdlib.c,v 1.16 1998/03/28 15:37:24 grubba Exp $"); +RCSID("$Id: fdlib.c,v 1.17 1998/05/01 15:31:23 hubbe Exp $"); #ifdef HAVE_WINSOCK_H @@ -157,6 +157,9 @@ FD fd_open(char *file, int open_mode, int create_mode) mt_unlock(&fd_mutex); + if(open_mode & fd_APPEND) + fd_lseek(fd,0,SEEK_END); + FDDEBUG(fprintf(stderr,"Opened %s file as %d (%d)\n",file,fd,x)); return fd; diff --git a/src/signal_handler.c b/src/signal_handler.c index f816d8a568..c17081fcd2 100644 --- a/src/signal_handler.c +++ b/src/signal_handler.c @@ -22,7 +22,7 @@ #include "builtin_functions.h" #include <signal.h> -RCSID("$Id: signal_handler.c,v 1.57 1998/04/30 16:29:56 hubbe Exp $"); +RCSID("$Id: signal_handler.c,v 1.58 1998/05/01 15:32:10 hubbe Exp $"); #ifdef HAVE_PASSWD_H # include <passwd.h> @@ -735,26 +735,46 @@ void f_create_process(INT32 args) void *env=NULL; /* Quote command to allow all characters (if possible) */ + /* Damn! NT doesn't have quoting! The below code attempts to + * fake it + */ { int e,d; dynamic_buffer buf; initialize_buf(&buf); for(e=0;e<cmd->size;e++) { - if(e) low_my_putchar(' ', &buf); - low_my_putchar('"', &buf); - for(d=0;d<ITEM(cmd)[e].u.string->len;d++) + int quote; + if(e) { - switch(ITEM(cmd)[e].u.string->str[d]) + low_my_putchar(' ', &buf); + quote=STRCHR(ITEM(cmd)[e].u.string->str,'"') || + STRCHR(ITEM(cmd)[e].u.string->str,' '); + }else{ + quote=0; + } + + if(quote) + { + low_my_putchar('"', &buf); + + for(d=0;d<ITEM(cmd)[e].u.string->len;d++) { - case '"': - case '\\': - low_my_putchar('\\', &buf); - default: - low_my_putchar(ITEM(cmd)[e].u.string->str[d], &buf); + switch(ITEM(cmd)[e].u.string->str[d]) + { + case '"': + case '\\': + low_my_putchar('\\', &buf); + default: + low_my_putchar(ITEM(cmd)[e].u.string->str[d], &buf); + } } + low_my_putchar('"', &buf); + }else{ + low_my_binary_strcat(ITEM(cmd)[e].u.string->str, + ITEM(cmd)[e].u.string->len, + &buf); } - low_my_putchar('"', &buf); } low_my_putchar(0, &buf); command_line=(TCHAR *)buf.s.str; -- GitLab