(cygpath_pipe): Don't call exit_cygpath. Let main atexit routine do that.
* pkg.c (init_pkgs): Accept root argument. Make registry key "cygwin
root"-specific.
* setup.c (filedel): Call exit_cygpath here so that we can be assured that
cygpath subprocess has died. This allows us to delete cygpath.exe and
cygwin1.dll.
(optionprompt): Initialize response to -1 so that second screen of mirrors will
appear.
(get_pkg_stuff): Don't attempt to use HKCLU. Pass root to init_pkgs.
* setup.h: Reflect init_pkgs prototype change.
+Sun Apr 30 22:37:34 2000 Christopher Faylor <cgf@cygnus.com>
+
+ * path.c (exit_cygpath): Wait for subprocess to exit before returning.
+ (cygpath_pipe): Don't call exit_cygpath. Let main atexit routine do
+ that.
+ * pkg.c (init_pkgs): Accept root argument. Make registry key "cygwin
+ root"-specific.
+ * setup.c (filedel): Call exit_cygpath here so that we can be assured
+ that cygpath subprocess has died. This allows us to delete cygpath.exe
+ and cygwin1.dll.
+ (optionprompt): Initialize response to -1 so that second screen of
+ mirrors will appear.
+ (get_pkg_stuff): Don't attempt to use HKCLU. Pass root to init_pkgs.
+ * setup.h: Reflect init_pkgs prototype change.
+
Sat Apr 29 23:53:30 2000 Christopher Faylor <cgf@cygnus.com>
* pkg.c (init_pkgs): Accept an argument to control what root registry
exit (1);
}
-static void
+void
exit_cygpath (void)
{
fclose (cygin);
fclose (cygout);
Sleep (0);
- TerminateProcess (hcygpath, 0);
+ if (WaitForSingleObject (hcygpath, 5000) != WAIT_OBJECT_0)
+ {
+ TerminateProcess (hcygpath, 0);
+ WaitForSingleObject (hcygpath, 5000);
+ }
+ CloseHandle (hcygpath);
}
static int
-cygpath_pipe ()
+cygpath_pipe (void)
{
int hpipein[2] = {-1, -1};
int hpipeout[2] = {-1, -1};
hcygpath = (HANDLE) xcreate_process (0, hout, hin, hin, buffer);
if (!hcygpath)
return 0;
- atexit (exit_cygpath);
signal (SIGINT, kill_cygpath);
_close (hpipein[1]);
_close (hpipeout[0]);
return NULL;
}
+#define REGWHERE "SOFTWARE\\Cygnus Solutions\\Cygwin\\Installed Components"
+
pkg *
-init_pkgs (int use_current_user)
+init_pkgs (const char *root, int use_current_user)
{
LONG res;
DWORD what;
- char empty[] = "";
+ char *p, empty[] = "";
char buf[4096];
DWORD ty, sz;
DWORD nc = 0;
static pkg stuff[1000];
- res = RegCreateKeyEx (use_current_user ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE,
- "SOFTWARE\\Cygnus Solutions\\Cygwin\\Installed Components",
- 0, empty, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkpkg, &what);
+ sprintf (buf, "%s\\%s", REGWHERE, root);
+ for (p = buf + sizeof (REGWHERE); (p = strchr (p, '\\')) != NULL; )
+ *p = '/';
+
+ res = RegCreateKeyEx (use_current_user ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE, buf,
+ 0, empty, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkpkg, &what);
if (res != ERROR_SUCCESS)
return NULL;
static void
filedel (void)
{
- int i;
+ int i, j;
+ extern void exit_cygpath (void);
+ exit_cygpath ();
for (i = 0; i < deleteme.count; i++)
- (void) _unlink (deleteme.array[i]);
+ for (j = 0; _unlink (deleteme.array[i]) && j < 20; j++)
+ Sleep (100);
sa_cleanup (&deleteme);
}
return SUCCEEDED (hres);
}
-
BOOL CALLBACK
output_file (HMODULE h, LPCTSTR type, LPTSTR name, LONG lparam)
{
return retval;
}
-
static void
setpath (const char *element)
{
{
char buffer[_MAX_PATH];
-
printf ((def ? "%s? [%s] " : "%s? "), text, def);
fflush (stdout);
fgets (buffer, sizeof (buffer), stdin);
static int
optionprompt (const char *text, SA * options)
{
- size_t n, response = 1;
+ size_t n, response = -1;
char buf[5];
size_t base;
return retval;
}
-
static HINTERNET
opensession ()
{
return retval;
}
-
/* Writes the startup batch file. */
static int
do_start_menu (const char *root)
return retval;
}
-
/* Basically a mkdir -p /somedir function. */
static void
mkdirp (const char *dir)
get_pkg_stuff (const char *root, int updating)
{
const char *ver, *ans;
- pkg *pkgstuff = init_pkgs (0);
+ pkg *pkgstuff = init_pkgs (root, 0);
static pkg dummy = {NULL, NULL};
- if (!pkgstuff)
- pkgstuff = init_pkgs (1); /* Use HKCU */
if (!updating || !pkgstuff)
return &dummy;
char *version;
} pkg;
-pkg *init_pkgs (int);
+pkg *init_pkgs (const char * root, int);
pkg * find_pkg (pkg *stuff, char *name);
int write_pkg (pkg *pkg, char *name, char *version);
int newer_pkg (pkg *pkg, char *version);