Module: wine
Branch: master
Commit: 203c538aaa2ca940822791e4af42822bfdb59f53
URL: http://source.winehq.org/git/wine.git/?a=commit;h=203c538aaa2ca940822791e4a…
Author: Andrew Nguyen <arethusa26(a)gmail.com>
Date: Sat Oct 3 17:00:59 2009 -0500
cmd: Fix copy option handling in batch mode.
---
programs/cmd/builtins.c | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c
index f5dfbf0..bccba85 100644
--- a/programs/cmd/builtins.c
+++ b/programs/cmd/builtins.c
@@ -171,7 +171,7 @@ void WCMD_copy (void) {
WIN32_FIND_DATA fd;
HANDLE hff;
BOOL force, status;
- WCHAR outpath[MAX_PATH], srcpath[MAX_PATH], copycmd[3];
+ WCHAR outpath[MAX_PATH], srcpath[MAX_PATH], copycmd[4];
DWORD len;
static const WCHAR copyCmdW[] = {'C','O','P','Y','C','M','D','\0'};
BOOL copyToDir = FALSE;
@@ -238,8 +238,20 @@ void WCMD_copy (void) {
else if (strstrW (quals, parmY))
force = TRUE;
else {
+ /* By default, we will force the overwrite in batch mode and ask for
+ * confirmation in interactive mode. */
+ force = !!context;
+
+ /* If COPYCMD is set, then we force the overwrite with /Y and ask for
+ * confirmation with /-Y. If COPYCMD is neither of those, then we use the
+ * default behavior. */
len = GetEnvironmentVariable (copyCmdW, copycmd, sizeof(copycmd)/sizeof(WCHAR));
- force = (len && len < (sizeof(copycmd)/sizeof(WCHAR)) && ! lstrcmpiW (copycmd, parmY));
+ if (len && len < (sizeof(copycmd)/sizeof(WCHAR))) {
+ if (!lstrcmpiW (copycmd, parmY))
+ force = TRUE;
+ else if (!lstrcmpiW (copycmd, parmNoY))
+ force = FALSE;
+ }
}
/* Loop through all source files */
Module: wine
Branch: master
Commit: a1c66499bf6b93bc2c027b5786fe73615b1f8fb7
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a1c66499bf6b93bc2c027b578…
Author: Wim Lewis <wiml(a)hhhh.org>
Date: Fri Oct 2 15:23:34 2009 -0700
winex11: Fix font metric cache filename generation.
Recognize Mac OS X's launchd pathnames as being local. Avoid
generating an invalid pathname if $DISPLAY contains slashes.
Don't include the screen number in the cache filename.
---
dlls/winex11.drv/xfont.c | 54 +++++++++++++++++++++++++++++++++++----------
1 files changed, 42 insertions(+), 12 deletions(-)
diff --git a/dlls/winex11.drv/xfont.c b/dlls/winex11.drv/xfont.c
index f761e9b..5e160cc 100644
--- a/dlls/winex11.drv/xfont.c
+++ b/dlls/winex11.drv/xfont.c
@@ -1830,18 +1830,10 @@ static char* XFONT_UserMetricsCache( char* buffer, int* buf_size )
const char *confdir = wine_get_config_dir();
const char *display_name = XDisplayName(NULL);
int len = strlen(confdir) + strlen(INIFontMetrics) + strlen(display_name) + 8;
- int display = 0;
- int screen = 0;
+ unsigned int display = 0;
+ unsigned int screen = 0;
char *p, *ext;
- /*
- ** Normalize the display name, since on Red Hat systems, DISPLAY
- ** is commonly set to one of either 'unix:0.0' or ':0' or ':0.0'.
- ** after this code, all of the above will resolve to ':0.0'.
- */
- if (!strncmp( display_name, "unix:", 5 )) display_name += 4;
- p = strchr(display_name, ':');
- if (p) sscanf(p + 1, "%d.%d", &display, &screen);
if ((len > *buf_size) &&
!(buffer = HeapReAlloc( GetProcessHeap(), 0, buffer, *buf_size = len )))
@@ -1854,8 +1846,46 @@ static char* XFONT_UserMetricsCache( char* buffer, int* buf_size )
ext = buffer + strlen(buffer);
strcpy( ext, display_name );
- if (!(p = strchr( ext, ':' ))) p = ext + strlen(ext);
- sprintf( p, ":%d.%d", display, screen );
+ /*
+ ** Normalize the display name. The format of DISPLAY is
+ ** [protocol/] [hostname] :[:] num [.num]
+ **
+ ** - on Red Hat systems, DISPLAY is commonly set to one of
+ ** either 'unix:0.0' or ':0' or ':0.0'.
+ ** - on MacOS X systems, DISPLAY is commonly set to
+ ** /tmp/foo/:0
+ **
+ ** after this code, all of the above will resolve to ':0.0'.
+ */
+ p = strrchr(ext, ':');
+ if (p)
+ {
+ sscanf(p + 1, "%u.%u", &display, &screen);
+ *p = 0;
+ if (display > 9999)
+ {
+ WARN("unlikely X11 display number\n");
+ *buffer = 0;
+ return buffer;
+ }
+ }
+ if (!strcmp( ext, "unix" ) ||
+ !strcmp( ext, "localhost" ))
+ *ext = 0;
+ if (!strncmp( ext, "/tmp/", 5 ))
+ *ext = 0; /* assume pathnames are local */
+
+ /* Deal with the possibility of slashes in the display name */
+ for( p = ext; *p; p++ )
+ if ( *p == '/' )
+ *p = '_';
+
+ /* X11 fonts are per-display, not per-screen, so don't
+ ** include the screen number in the font cache filename */
+ sprintf( ext + strlen(ext), ":%u", display );
+
+ TRACE("display '%s' -> cachefile '%s'\n", display_name, buffer);
+
return buffer;
}