Index: utils/cygcheck.cc
===================================================================
RCS file: /cvs/src/src/winsup/utils/cygcheck.cc,v
retrieving revision 1.33
diff -u -p -r1.33 cygcheck.cc
--- utils/cygcheck.cc	25 Mar 2003 01:20:04 -0000	1.33
+++ utils/cygcheck.cc	27 Mar 2003 07:57:04 -0000
@@ -26,6 +26,7 @@ int sysinfo = 0;
 int givehelp = 0;
 int keycheck = 0;
 int check_setup = 0;
+int install_type = 0;
 
 #ifdef __GNUC__
 typedef long long longlong;
@@ -1310,24 +1311,64 @@ check_keys ()
   return 0;
 }
 
+static int
+check_install_type (void)
+{
+  HKEY cyg_hkey;
+  long lret;
+  bool status = false;
+  int ret = 0;
+  
+  lret = RegOpenKeyEx (HKEY_LOCAL_MACHINE,
+		       "SOFTWARE\\Cygnus Solutions\\Cygwin\\mounts v2\\/",
+		       0, KEY_READ, &cyg_hkey);
+
+  if (lret == ERROR_SUCCESS)
+    printf ("Cygwin was installed for \"All Users\"\n");
+    RegCloseKey (cyg_hkey);
+    status = true;
+
+  if (!status)
+    {
+      lret = RegOpenKeyEx (HKEY_CURRENT_USER,
+                           "Software\\Cygnus Solutions\\Cygwin\\mounts v2\\/",
+                           0, KEY_READ, &cyg_hkey);
+
+      if (lret == ERROR_SUCCESS)
+        {
+          printf ("Cygwin was installed for \"Just You\"\n");
+          RegCloseKey (cyg_hkey);
+        }
+      else
+        {
+          keyeprint ("check_install_type: RegOpenKeyEx");
+          ret = 1;
+        }
+    }
+
+  return (ret);
+}
+
 static void
 usage (FILE * stream, int status)
 {
   fprintf (stream, "\
 Usage: cygcheck [OPTIONS] [program ...]\n\
  -c, --check-setup  check packages installed via setup.exe\n\
+ -i, --install-type check who cygwin was installed for\n\
  -s, --sysinfo      system information (not with -k)\n\
  -v, --verbose      verbose output (indented) (for -s or programs)\n\
  -r, --registry     registry search (requires -s)\n\
  -k, --keycheck     perform a keyboard check session (not with -s)\n\
  -h, --help         give help about the info (not with -c)\n\
  -V, --version      output version information and exit\n\
-You must at least give either -s or -k or a program name\n");
+You must at least give either -i, -s or -k or a program name\n");
   exit (status);
 }
 
 struct option longopts[] = {
   {"check-setup", no_argument, NULL, 'c'},
+  {"install-type", no_argument, NULL, 'i'},
   {"sysinfo", no_argument, NULL, 's'},
   {"registry", no_argument, NULL, 'r'},
   {"verbose", no_argument, NULL, 'v'},
@@ -1337,7 +1378,7 @@ struct option longopts[] = {
   {0, no_argument, NULL, 0}
 };
 
-static char opts[] = "chkrsvV";
+static char opts[] = "cihkrsvV";
 
 static void
 print_version ()
@@ -1376,6 +1417,9 @@ main (int argc, char **argv)
       case 'c':
 	check_setup = 1;
 	break;
+      case 'i':
+	install_type = 1;
+	break;
       case 'r':
 	registry = 1;
 	break;
@@ -1397,17 +1441,20 @@ main (int argc, char **argv)
   argc -= optind;
   argv += optind;
 
-  if (argc == 0 && !sysinfo && !keycheck && !check_setup)
+  if (argc == 0 && !sysinfo && !install_type && !keycheck && !check_setup)
     if (givehelp)
       usage (stdout, 0);
     else
       usage (stderr, 1);
 
-  if ((check_setup || sysinfo) && keycheck)
+  if ((check_setup || install_type || sysinfo) && keycheck)
     usage (stderr, 1);
 
   if (keycheck)
     return check_keys ();
+  
+  if (install_type)
+    return check_install_type ();
 
   init_paths ();
 
