delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2000/05/02/21:48:36

Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-developers-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-developers-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin-developers AT sourceware DOT cygnus DOT com
Date: Tue, 2 May 2000 22:50:06 -0400
Message-Id: <200005030250.WAA25471@envy.delorie.com>
From: DJ Delorie <dj AT delorie DOT com>
To: cygwin-developers AT sourceware DOT cygnus DOT com
In-reply-to: <20000502223534.A5858@cygnus.com> (message from Chris Faylor on
Tue, 2 May 2000 22:35:34 -0400)
Subject: Re: /cygdrive/windows ?
References: <20000502221327 DOT A5761 AT cygnus DOT com> <200005030228 DOT WAA25280 AT envy DOT delorie DOT com> <20000502223534 DOT A5858 AT cygnus DOT com>

`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':

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019