Mail Archives: cygwin-developers/2000/05/03/07:26:31
Thanks, DJ. I just wasn't getting the point of Chris' idea. This is much
better than storing it in the registry as one could change it anyway.
Earnie.
--- DJ Delorie <dj AT delorie DOT com> wrote:
>
> `cygpath --windir`
>
> The only time we'd need something like this visible outside a compiled
> application is a script, and a script can use cygpath to get the
> directory path and store it. Any compiled program can just call
> GetWindowsDirectory() itself.
>
> Index: cygpath.cc
> ===================================================================
> RCS file: /cvs/src/src/winsup/utils/cygpath.cc,v
> retrieving revision 1.3
> diff -p -2 -r1.3 cygpath.cc
> *** cygpath.cc 2000/04/13 05:23:30 1.3
> --- cygpath.cc 2000/05/03 02:49:35
> *************** static struct option long_options[] =
> *** 36,39 ****
> --- 36,41 ----
> { (char *) "version", no_argument, NULL, 'v' },
> { (char *) "windows", no_argument, NULL, 'w' },
> + { (char *) "windir", no_argument, NULL, 'W' },
> + { (char *) "sysdir", no_argument, NULL, 'S' },
> { 0, no_argument, 0, 0 }
> };
> *************** Usage: %s [-p|--path] (-u|--unix)|(-w|--
> *** 49,52 ****
> --- 51,56 ----
> -u|--unix print Unix form of filename\n\
> -w|--windows print Windows form of filename\n\
> + -W|--windir print `Windows' directory\n\
> + -S|--sysdir print `system' directory\n\
> -p|--path filename argument is a path\n",
> prog_name);
> *************** main (int argc, char **argv)
> *** 116,119 ****
> --- 120,124 ----
> int options_from_file_flag;
> char *filename;
> + char buf[MAX_PATH], buf2[MAX_PATH];
>
> prog_name = strrchr (argv[0], '/');
> *************** main (int argc, char **argv)
> *** 127,131 ****
> windows_flag = 0;
> options_from_file_flag = 0;
> ! while ((c = getopt_long (argc, argv, (char *) "hac:f:opuvw",
> long_options, (int *) NULL))
> != EOF)
> {
> --- 132,136 ----
> windows_flag = 0;
> options_from_file_flag = 0;
> ! while ((c = getopt_long (argc, argv, (char *) "hac:f:opSuvwW",
> long_options, (int *) NULL))
> != EOF)
> {
> *************** main (int argc, char **argv)
> *** 163,166 ****
> --- 168,183 ----
> windows_flag = 1;
> break;
> +
> + case 'W':
> + GetWindowsDirectory(buf, MAX_PATH);
> + cygwin_conv_to_posix_path(buf, buf2);
> + printf("%s\n", buf2);
> + exit(0);
> +
> + case 'S':
> + GetSystemDirectory(buf, MAX_PATH);
> + cygwin_conv_to_posix_path(buf, buf2);
> + printf("%s\n", buf2);
> + exit(0);
>
> case 'h':
__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/
- Raw text -