From 0a5ea9471bff6e0fb314b0a6361c6f57224f0505 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 7 Nov 2003 18:30:35 +0000 Subject: [PATCH] * cygpath.cc (main): Allow multiple pathnames on command line. --- winsup/utils/ChangeLog | 4 ++++ winsup/utils/cygpath.cc | 35 +++++++++++++---------------------- 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog index eb46b1c38..64f4433ee 100644 --- a/winsup/utils/ChangeLog +++ b/winsup/utils/ChangeLog @@ -1,3 +1,7 @@ +2003-11-07 Mark Blackburn + + * cygpath.cc (main): Allow multiple pathnames on command line. + 2003-11-04 Corinna Vinschen * passwd.c (PrintPW): Turn around meaning printed for "Password not diff --git a/winsup/utils/cygpath.cc b/winsup/utils/cygpath.cc index 68a2407fc..e1942be34 100644 --- a/winsup/utils/cygpath.cc +++ b/winsup/utils/cygpath.cc @@ -9,6 +9,8 @@ details. */ #define NOCOMATTRIBUTE +#define _WIN32_IE 0x0400 + #include #include #include @@ -330,7 +332,6 @@ dowin (char option) char *buf, buf1[MAX_PATH], buf2[MAX_PATH]; DWORD len = MAX_PATH; WIN32_FIND_DATA w32_fd; - LPITEMIDLIST id; HINSTANCE k32; BOOL (*GetProfilesDirectoryAPtr) (LPSTR, LPDWORD) = 0; @@ -338,27 +339,15 @@ dowin (char option) switch (option) { case 'D': - SHGetSpecialFolderLocation (NULL, allusers_flag ? - CSIDL_COMMON_DESKTOPDIRECTORY : CSIDL_DESKTOPDIRECTORY, &id); - SHGetPathFromIDList (id, buf); - /* This if clause is a Fix for Win95 without any "All Users" */ - if (strlen (buf) == 0) - { - SHGetSpecialFolderLocation (NULL, CSIDL_DESKTOPDIRECTORY, &id); - SHGetPathFromIDList (id, buf); - } + if (!SHGetSpecialFolderPath (NULL, buf, allusers_flag ? + CSIDL_COMMON_DESKTOPDIRECTORY : CSIDL_DESKTOPDIRECTORY, FALSE)) + SHGetSpecialFolderPath (NULL, buf, CSIDL_DESKTOPDIRECTORY, FALSE); break; case 'P': - SHGetSpecialFolderLocation (NULL, allusers_flag ? - CSIDL_COMMON_PROGRAMS : CSIDL_PROGRAMS, &id); - SHGetPathFromIDList (id, buf); - /* This if clause is a Fix for Win95 without any "All Users" */ - if (strlen (buf) == 0) - { - SHGetSpecialFolderLocation (NULL, CSIDL_PROGRAMS, &id); - SHGetPathFromIDList (id, buf); - } + if (!SHGetSpecialFolderPath (NULL, buf, allusers_flag ? + CSIDL_COMMON_PROGRAMS : CSIDL_PROGRAMS, FALSE)) + SHGetSpecialFolderPath (NULL, buf, CSIDL_PROGRAMS, FALSE); break; case 'H': @@ -675,11 +664,13 @@ main (int argc, char **argv) if (output_flag) dowin (o); - if (optind != argc - 1) + if (optind > argc - 1) usage (stderr, 1); - filename = argv[optind]; - doit (filename); + for (int i=optind; argv[i]; i++) { + filename = argv[i]; + doit (filename); + } } else {