aboutsummaryrefslogtreecommitdiff
path: root/winsup/utils
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2003-11-07 18:30:35 +0000
committerCorinna Vinschen <corinna@vinschen.de>2003-11-07 18:30:35 +0000
commit0a5ea9471bff6e0fb314b0a6361c6f57224f0505 (patch)
tree721cf74a60928061f2cc5d4d7c7ef21af3c789c3 /winsup/utils
parent182d0e28a7712d11a40f9b91412cce1f7843a7ec (diff)
downloadnewlib-0a5ea9471bff6e0fb314b0a6361c6f57224f0505.zip
newlib-0a5ea9471bff6e0fb314b0a6361c6f57224f0505.tar.gz
newlib-0a5ea9471bff6e0fb314b0a6361c6f57224f0505.tar.bz2
* cygpath.cc (main): Allow multiple pathnames on command line.
Diffstat (limited to 'winsup/utils')
-rw-r--r--winsup/utils/ChangeLog4
-rw-r--r--winsup/utils/cygpath.cc35
2 files changed, 17 insertions, 22 deletions
diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog
index eb46b1c..64f4433 100644
--- a/winsup/utils/ChangeLog
+++ b/winsup/utils/ChangeLog
@@ -1,3 +1,7 @@
+2003-11-07 Mark Blackburn <marklist@fangorn.ca>
+
+ * cygpath.cc (main): Allow multiple pathnames on command line.
+
2003-11-04 Corinna Vinschen <corinna@vinschen.de>
* passwd.c (PrintPW): Turn around meaning printed for "Password not
diff --git a/winsup/utils/cygpath.cc b/winsup/utils/cygpath.cc
index 68a2407..e1942be 100644
--- a/winsup/utils/cygpath.cc
+++ b/winsup/utils/cygpath.cc
@@ -9,6 +9,8 @@ details. */
#define NOCOMATTRIBUTE
+#define _WIN32_IE 0x0400
+
#include <shlobj.h>
#include <stdio.h>
#include <string.h>
@@ -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
{