* cygpath.cc (usage): Clean up usage output.
(dowin): Correct output of -t mixed for -ADHPSW options.
This commit is contained in:
parent
7c1d8db987
commit
33bd2d1268
|
@ -1,3 +1,8 @@
|
||||||
|
2002-06-18 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
|
||||||
|
|
||||||
|
* cygpath.cc (usage): Clean up usage output.
|
||||||
|
(dowin): Correct output of -t mixed for -ADHPSW options.
|
||||||
|
|
||||||
2002-06-14 Corinna Vinschen <corinna@vinschen.de>
|
2002-06-14 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* passwd.c: Rearrange includes to avoid unnecessary warnings.
|
* passwd.c: Rearrange includes to avoid unnecessary warnings.
|
||||||
|
|
|
@ -60,29 +60,33 @@ usage (FILE * stream, int status)
|
||||||
{
|
{
|
||||||
if (!ignore_flag || !status)
|
if (!ignore_flag || !status)
|
||||||
fprintf (stream, "\
|
fprintf (stream, "\
|
||||||
Usage: %s (-u|--unix)|(-w|--windows) [options] filename\n\n\
|
Usage: %s (-u|-w|-t TYPE) [-c HANDLE] [-f FILE] [options] NAME\n\n\
|
||||||
-u|--unix print Unix form of filename\n\
|
%s [-ADHPSW] \n\n\
|
||||||
-w|--windows print Windows form of filename\n\n\
|
Output type options (required):\n\
|
||||||
Other options:\n\
|
-u|--unix print Unix form of NAME (default)\n\
|
||||||
-a|--absolute output absolute path\n\
|
-w|--windows print Windows form of NAME \n\n\
|
||||||
-c|--close handle close handle (for use in captured process)\n\
|
-t|--type print Windows form of NAME with TYPE one of\n\
|
||||||
-f|--file file read file for input path information\n\
|
|
||||||
-i|--ignore ignore missing argument\n\
|
|
||||||
-l|--long-name print Windows long form of filename (with -w only)\n\
|
|
||||||
-p|--path filename argument is a path\n\
|
|
||||||
-s|--short-name print Windows short form of filename (with -w only)\n\
|
|
||||||
-t|--type print Windows form of filename with specified\n\
|
|
||||||
dos drive letter with backslashes (C:\\WINNT)\n\
|
dos drive letter with backslashes (C:\\WINNT)\n\
|
||||||
mixed drive letter with regular slashes (C:/WINNT)\n\
|
mixed drive letter with regular slashes (C:/WINNT)\n\
|
||||||
|
Path conversion options:\n\
|
||||||
|
-a|--absolute output absolute path\n\
|
||||||
|
-c|--close HANDLE close HANDLE (for use in captured process)\n\
|
||||||
|
-f|--file FILE read FILE for input; use - to read from STDIN\n\
|
||||||
|
-i|--ignore ignore missing argument\n\
|
||||||
|
-l|--long-name print Windows long form of NAME (with -w only)\n\
|
||||||
|
-p|--path NAME is a PATH list (i.e., '/bin:/usr/bin')\n\
|
||||||
|
-s|--short-name print Windows short form of NAME (with -w only)\n\
|
||||||
|
System information output:\n\
|
||||||
-A|--allusers use `All Users' instead of current user for -D, -P\n\
|
-A|--allusers use `All Users' instead of current user for -D, -P\n\
|
||||||
-D|--desktop output `Desktop' directory and exit\n\
|
-D|--desktop output `Desktop' directory and exit\n\
|
||||||
-H|--homeroot output `Profiles' directory (home root) and exit\n\
|
-H|--homeroot output `Profiles' directory (home root) and exit\n\
|
||||||
-P|--smprograms output Start Menu `Programs' directory and exit\n\
|
-P|--smprograms output Start Menu `Programs' directory and exit\n\
|
||||||
-S|--sysdir output system directory and exit\n\
|
-S|--sysdir output system directory and exit\n\
|
||||||
-W|--windir output `Windows' directory and exit\n\n\
|
-W|--windir output `Windows' directory and exit\n\n\
|
||||||
Informative output:\n\
|
Other options:\n\
|
||||||
-h|--help print this help, then exit\n\
|
-h|--help output usage information and exit\n\
|
||||||
-v|--version output version information and exit\n", prog_name);
|
-v|--version output version information and exit\n\
|
||||||
|
", prog_name, prog_name);
|
||||||
exit (ignore_flag ? 0 : status);
|
exit (ignore_flag ? 0 : status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,6 +303,33 @@ get_long_name (const char *filename)
|
||||||
return strcpy (sbuf, buf);
|
return strcpy (sbuf, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
convert_slashes (char* name)
|
||||||
|
{
|
||||||
|
while ((name = strchr (name, '\\')) != NULL)
|
||||||
|
{
|
||||||
|
if (*name == '\\')
|
||||||
|
*name = '/';
|
||||||
|
name++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *
|
||||||
|
get_mixed_name (const char* filename)
|
||||||
|
{
|
||||||
|
char* mixed_buf = strdup (filename);
|
||||||
|
|
||||||
|
if (mixed_buf == NULL)
|
||||||
|
{
|
||||||
|
fprintf (stderr, "%s: out of memory\n", prog_name);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
convert_slashes (mixed_buf);
|
||||||
|
|
||||||
|
return mixed_buf;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dowin (char option)
|
dowin (char option)
|
||||||
{
|
{
|
||||||
|
@ -342,7 +373,7 @@ dowin (char option)
|
||||||
GetProfilesDirectoryAPtr = (BOOL (*) (LPSTR, LPDWORD))
|
GetProfilesDirectoryAPtr = (BOOL (*) (LPSTR, LPDWORD))
|
||||||
GetProcAddress (hinst, "GetProfilesDirectoryA");
|
GetProcAddress (hinst, "GetProfilesDirectoryA");
|
||||||
if (GetProfilesDirectoryAPtr)
|
if (GetProfilesDirectoryAPtr)
|
||||||
(*GetProfilesDirectoryAPtr) (buf, &len);
|
(*GetProfilesDirectoryAPtr) (buf, &len);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GetWindowsDirectory (buf, MAX_PATH);
|
GetWindowsDirectory (buf, MAX_PATH);
|
||||||
|
@ -372,39 +403,14 @@ dowin (char option)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (shortname_flag)
|
if (shortname_flag)
|
||||||
buf = get_short_name (buf);
|
buf = get_short_name (buf);
|
||||||
|
if (mixed_flag)
|
||||||
|
buf = get_mixed_name (buf);
|
||||||
}
|
}
|
||||||
printf ("%s\n", buf);
|
printf ("%s\n", buf);
|
||||||
exit (0);
|
exit (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
convert_slashes (char* name)
|
|
||||||
{
|
|
||||||
while ((name = strchr (name, '\\')) != NULL)
|
|
||||||
{
|
|
||||||
if (*name == '\\')
|
|
||||||
*name = '/';
|
|
||||||
name++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *
|
|
||||||
get_mixed_name (const char* filename)
|
|
||||||
{
|
|
||||||
char* mixed_buf = strdup (filename);
|
|
||||||
|
|
||||||
if (mixed_buf == NULL)
|
|
||||||
{
|
|
||||||
fprintf (stderr, "%s: out of memory\n", prog_name);
|
|
||||||
exit (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
convert_slashes (mixed_buf);
|
|
||||||
|
|
||||||
return mixed_buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
doit (char *filename)
|
doit (char *filename)
|
||||||
{
|
{
|
||||||
|
@ -641,7 +647,6 @@ main (int argc, char **argv)
|
||||||
usage (stderr, 1);
|
usage (stderr, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options_from_file_flag && !file_arg)
|
if (options_from_file_flag && !file_arg)
|
||||||
|
|
Loading…
Reference in New Issue