Mail Archives: cygwin/2000/08/30/09:42:49
------=_NextPart_000_0015_01C012A9.5F0C0490
Content-Type: text/plain;
charset="koi8-r"
Content-Transfer-Encoding: 7bit
This patch adds dialog to select local directory to download files
into/install from. This allows you to avoid putting the whole Cygwin
distribution on desktop when installing directly from Internet :-) and avoid
constant copying of setup.exe into empty directory. I used it to install
several recent packages.
Some comments:
- I modified concat() to preserve leading '//' to work with UNC names - this
allows network browsing. I just installed CVS directly from network server. It
should not do any harm as far as I can tell.
- resource IDs are bogus. I undersand, that resource.h and res.rc are
autogenerated, so I did not want to manually renumber all resource IDs.
- may be, it makes sense to remember last used directory.
-andrej
Have a nice DOS!
B >>
------=_NextPart_000_0015_01C012A9.5F0C0490
Content-Type: application/octet-stream;
name="cygwin-setup.diff"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="cygwin-setup.diff"
Index: ChangeLog=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /cvs/src/src/winsup/cinstall/ChangeLog,v=0A=
retrieving revision 2.7=0A=
diff -u -r2.7 ChangeLog=0A=
--- ChangeLog 2000/08/30 01:05:41 2.7=0A=
+++ ChangeLog 2000/08/30 13:24:52=0A=
@@ -1,3 +1,25 @@=0A=
+2000-08-30 Andrej Borsenkow <Andrej DOT Borsenkow AT mow DOT siemens DOT ru>=0A=
+=0A=
+ * localdir.cc: new, local package directory selection dialog=0A=
+=0A=
+ * Makefile.in (OBJS): add localdir.o=0A=
+ * concat.cc (concat): preserve leading // to allow UNC names=0A=
+ * dialog.h: add prototype for do_local_dir=0A=
+ * download.cc (do_download): use local_dir as base directory=0A=
+ * fromcwd.cc (do_fromcwd): ditto=0A=
+ * install.cc (do_install): ditto=0A=
+ * log.cc (exit_setup): save log in local_dir, fall back to=0A=
+ current directory=0A=
+ * main.cc. (WinMain): initialize local_dir to cwd;=0A=
+ add call to do_local_dir=0A=
+ * net.cc (dialog_cmd): make DO_LOCAL_DIR next dialog=0A=
+ * source.cc (dialog_cmd): ditto=0A=
+ * res.rc: add DO_LOCAL_DIR dialog; remove "current directory"=0A=
+ from presented choices in IDD_SOURCE=0A=
+ * resource.h: defines for DO_LOCAL_DIR dialog=0A=
+ * root.cc (dialog_cmd): make DO_LOCAL_DIR previous dialog=0A=
+ * state.h: add local_dir variable=0A=
+=0A=
2000-08-29 DJ Delorie <dj AT redhat DOT com>=0A=
=0A=
* choose.cc (scan_downloaded_files): scan for existing files, so=0A=
Index: Makefile.in=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /cvs/src/src/winsup/cinstall/Makefile.in,v=0A=
retrieving revision 2.4=0A=
diff -u -r2.4 Makefile.in=0A=
--- Makefile.in 2000/08/30 01:05:41 2.4=0A=
+++ Makefile.in 2000/08/30 13:24:52=0A=
@@ -85,6 +85,7 @@=0A=
inilex.o \=0A=
iniparse.o \=0A=
install.o \=0A=
+ localdir.o \=0A=
log.o \=0A=
main.o \=0A=
mkdir.o \=0A=
Index: concat.cc=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /cvs/src/src/winsup/cinstall/concat.cc,v=0A=
retrieving revision 2.0=0A=
diff -u -r2.0 concat.cc=0A=
--- concat.cc 2000/08/08 00:27:54 2.0=0A=
+++ concat.cc 2000/08/30 13:24:52=0A=
@@ -71,7 +71,7 @@=0A=
*d++ =3D *++s;=0A=
*d++ =3D *++s;=0A=
}=0A=
- else if (*s =3D=3D '/')=0A=
+ else if (*s =3D=3D '/' && s !=3D rv)=0A=
while (s[1] =3D=3D '/')=0A=
s++;=0A=
}=0A=
Index: dialog.h=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /cvs/src/src/winsup/cinstall/dialog.h,v=0A=
retrieving revision 2.0=0A=
diff -u -r2.0 dialog.h=0A=
--- dialog.h 2000/08/08 00:27:54 2.0=0A=
+++ dialog.h 2000/08/30 13:24:53=0A=
@@ -32,6 +32,7 @@=0A=
D(do_fromcwd);=0A=
D(do_ini);=0A=
D(do_install);=0A=
+D(do_local_dir);=0A=
D(do_net);=0A=
D(do_other);=0A=
D(do_postinstall);=0A=
Index: download.cc=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /cvs/src/src/winsup/cinstall/download.cc,v=0A=
retrieving revision 2.2=0A=
diff -u -r2.2 download.cc=0A=
--- download.cc 2000/08/30 01:05:42 2.2=0A=
+++ download.cc 2000/08/30 13:24:53=0A=
@@ -44,7 +44,7 @@=0A=
for (i=3D0; i<npackages; i++)=0A=
if (package[i].action =3D=3D ACTION_NEW || package[i].action =3D=3D =
ACTION_UPGRADE)=0A=
{=0A=
- char *local =3D pi.install;=0A=
+ char *local =3D concat (local_dir, "/", pi.install, 0);=0A=
=0A=
struct stat s;=0A=
if (stat (local, &s) >=3D 0)=0A=
Index: fromcwd.cc=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /cvs/src/src/winsup/cinstall/fromcwd.cc,v=0A=
retrieving revision 2.3=0A=
diff -u -r2.3 fromcwd.cc=0A=
--- fromcwd.cc 2000/08/24 21:50:14 2.3=0A=
+++ fromcwd.cc 2000/08/30 13:24:53=0A=
@@ -141,16 +141,18 @@=0A=
void=0A=
do_fromcwd (HINSTANCE h)=0A=
{=0A=
- if (_access ("./setup.ini", 0) =3D=3D 0)=0A=
+ if (_access (concat (local_dir, "/setup.ini", 0), 0) =3D=3D 0)=0A=
{=0A=
- mirror_site =3D ".";=0A=
+ mirror_site =3D local_dir;=0A=
next_dialog =3D IDD_S_LOAD_INI;=0A=
return;=0A=
}=0A=
=0A=
next_dialog =3D IDD_CHOOSE;=0A=
=0A=
- find (".", found_file);=0A=
+ npackages =3D 0;=0A=
+ =0A=
+ find (local_dir, found_file);=0A=
=0A=
return;=0A=
}=0A=
Index: install.cc=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /cvs/src/src/winsup/cinstall/install.cc,v=0A=
retrieving revision 2.2=0A=
diff -u -r2.2 install.cc=0A=
--- install.cc 2000/08/30 01:05:42 2.2=0A=
+++ install.cc 2000/08/30 13:24:53=0A=
@@ -317,7 +317,7 @@=0A=
|| package[i].action =3D=3D ACTION_UPGRADE)=0A=
&& pi.install)=0A=
{=0A=
- char *local =3D pi.install, *cp, *fn, *base;=0A=
+ char *local =3D concat (local_dir, "/", pi.install, 0), *cp, =
*fn, *base;=0A=
=0A=
base =3D local;=0A=
for (cp=3Dpi.install; *cp; cp++)=0A=
Index: log.cc=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /cvs/src/src/winsup/cinstall/log.cc,v=0A=
retrieving revision 2.2=0A=
diff -u -r2.2 log.cc=0A=
--- log.cc 2000/08/30 01:05:42 2.2=0A=
+++ log.cc 2000/08/30 13:24:53=0A=
@@ -114,15 +114,20 @@=0A=
=0A=
log (LOG_TIMESTAMP, "Ending cygwin install");=0A=
=0A=
- if (source =3D=3D IDC_SOURCE_DOWNLOAD || !root_dir)=0A=
+ if (source =3D=3D IDC_SOURCE_DOWNLOAD && local_dir)=0A=
{=0A=
- log_save (LOG_BABBLE, "setup.log.full", 0);=0A=
- log_save (0, "setup.log", 1);=0A=
+ log_save (LOG_BABBLE, concat (local_dir, "/setup.log.full", 0), =
0);=0A=
+ log_save (0, concat (local_dir, "/setup.log", 0), 1);=0A=
}=0A=
- else=0A=
+ else if (root_dir)=0A=
{=0A=
log_save (LOG_BABBLE, concat (root_dir, "/setup.log.full", 0), 0);=0A=
log_save (0, concat (root_dir, "/setup.log", 0), 1);=0A=
+ }=0A=
+ else=0A=
+ {=0A=
+ log_save (LOG_BABBLE, "setup.log.full", 0);=0A=
+ log_save (0, "setup.log", 1);=0A=
}=0A=
=0A=
ExitProcess (exit_code);=0A=
Index: main.cc=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /cvs/src/src/winsup/cinstall/main.cc,v=0A=
retrieving revision 2.2=0A=
diff -u -r2.2 main.cc=0A=
--- main.cc 2000/08/25 01:32:08 2.2=0A=
+++ main.cc 2000/08/30 13:24:53=0A=
@@ -45,6 +45,8 @@=0A=
int next_dialog;=0A=
int exit_msg =3D 0;=0A=
=0A=
+char cwd[_MAX_PATH];=0A=
+=0A=
HINSTANCE hinstance;=0A=
=0A=
int WINAPI=0A=
@@ -59,8 +61,8 @@=0A=
=0A=
log (LOG_TIMESTAMP, "Starting cygwin install");=0A=
=0A=
- char cwd[_MAX_PATH];=0A=
GetCurrentDirectory (sizeof (cwd), cwd);=0A=
+ local_dir =3D strdup (cwd);=0A=
log (0, "Current Directory: %s", cwd);=0A=
=0A=
while (next_dialog)=0A=
@@ -69,6 +71,7 @@=0A=
{=0A=
case IDD_SPLASH: do_splash (h); break;=0A=
case IDD_SOURCE: do_source (h); break;=0A=
+ case IDD_LOCAL_DIR: do_local_dir (h); break;=0A=
case IDD_ROOT: do_root (h); break;=0A=
case IDD_NET: do_net (h); break;=0A=
case IDD_SITE: do_site (h); break;=0A=
Index: net.cc=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /cvs/src/src/winsup/cinstall/net.cc,v=0A=
retrieving revision 2.2=0A=
diff -u -r2.2 net.cc=0A=
--- net.cc 2000/08/30 01:05:42 2.2=0A=
+++ net.cc 2000/08/30 13:24:53=0A=
@@ -104,7 +104,7 @@=0A=
switch (source)=0A=
{=0A=
case IDC_SOURCE_DOWNLOAD:=0A=
- NEXT (IDD_SOURCE);=0A=
+ NEXT (IDD_LOCAL_DIR);=0A=
break;=0A=
case IDC_SOURCE_NETINST:=0A=
case IDC_SOURCE_CWD:=0A=
Index: res.rc=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /cvs/src/src/winsup/cinstall/res.rc,v=0A=
retrieving revision 2.3=0A=
diff -u -r2.3 res.rc=0A=
--- res.rc 2000/08/30 01:05:42 2.3=0A=
+++ res.rc 2000/08/30 13:24:54=0A=
@@ -36,13 +36,27 @@=0A=
DEFPUSHBUTTON "Next -->",IDOK,100,75,45,15,WS_DISABLED=0A=
PUSHBUTTON "Cancel",IDCANCEL,165,75,45,15=0A=
ICON IDI_CYGWIN,-1,5,5,20,20=0A=
- CONTROL "Download from Internet to Current Directory",=0A=
+ CONTROL "Download from Internet",=0A=
=
IDC_SOURCE_DOWNLOAD,"Button",BS_AUTORADIOBUTTON,55,15,=0A=
152,10=0A=
CONTROL "Install from Internet",IDC_SOURCE_NETINST,"Button",=0A=
BS_AUTORADIOBUTTON,55,30,75,10=0A=
- CONTROL "Install from Current =
Directory",IDC_SOURCE_CWD,"Button",=0A=
+ CONTROL "Install from local =
directory",IDC_SOURCE_CWD,"Button",=0A=
BS_AUTORADIOBUTTON,55,45,104,10=0A=
+END=0A=
+=0A=
+IDD_LOCAL_DIR DIALOG DISCARDABLE 0, 0, 215, 95=0A=
+STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU=0A=
+CAPTION "Local package directory"=0A=
+FONT 8, "MS Sans Serif"=0A=
+BEGIN=0A=
+ DEFPUSHBUTTON "Next -->",IDOK,100,75,45,15=0A=
+ PUSHBUTTON "Cancel",IDCANCEL,165,75,45,15=0A=
+ EDITTEXT IDC_LOCAL_DIR,55,25,127,12,ES_AUTOHSCROLL=0A=
+ LTEXT "Local package directory",IDC_STATIC,55,15,85,11=0A=
+ PUSHBUTTON "<-- Back",IDC_BACK,55,75,45,15=0A=
+ ICON IDI_CYGWIN,IDC_STATIC,5,5,20,20=0A=
+ PUSHBUTTON "Browse...",IDC_LOCAL_DIR_BROWSE,150,10,34,14=0A=
END=0A=
=0A=
IDD_ROOT DIALOG DISCARDABLE 0, 0, 215, 95=0A=
Index: resource.h=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /cvs/src/src/winsup/cinstall/resource.h,v=0A=
retrieving revision 2.3=0A=
diff -u -r2.3 resource.h=0A=
--- resource.h 2000/08/30 01:05:42 2.3=0A=
+++ resource.h 2000/08/30 13:24:54=0A=
@@ -81,6 +81,9 @@=0A=
#define IDC_CHOOSE_LIST 1039=0A=
#define IDC_INS_ACTION 1040=0A=
#define IDC_STATIC -1=0A=
+#define IDC_LOCAL_DIR_BROWSE 9994=0A=
+#define IDC_LOCAL_DIR 9995=0A=
+#define IDD_LOCAL_DIR 9997=0A=
=0A=
// Next default values for new objects=0A=
// =0A=
Index: root.cc=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /cvs/src/src/winsup/cinstall/root.cc,v=0A=
retrieving revision 2.1=0A=
diff -u -r2.1 root.cc=0A=
--- root.cc 2000/08/25 01:32:08 2.1=0A=
+++ root.cc 2000/08/30 13:24:54=0A=
@@ -202,7 +202,7 @@=0A=
=0A=
case IDC_BACK:=0A=
save_dialog (h);=0A=
- NEXT (IDD_SOURCE);=0A=
+ NEXT (IDD_LOCAL_DIR);=0A=
break;=0A=
=0A=
case IDCANCEL:=0A=
Index: source.cc=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /cvs/src/src/winsup/cinstall/source.cc,v=0A=
retrieving revision 2.1=0A=
diff -u -r2.1 source.cc=0A=
--- source.cc 2000/08/25 01:32:08 2.1=0A=
+++ source.cc 2000/08/30 13:24:54=0A=
@@ -65,16 +65,7 @@=0A=
=0A=
case IDOK:=0A=
save_dialog (h);=0A=
- switch (source)=0A=
- {=0A=
- case IDC_SOURCE_DOWNLOAD:=0A=
- NEXT (IDD_NET);=0A=
- break;=0A=
- case IDC_SOURCE_NETINST:=0A=
- case IDC_SOURCE_CWD:=0A=
- NEXT (IDD_ROOT);=0A=
- break;=0A=
- }=0A=
+ NEXT (IDD_LOCAL_DIR);=0A=
break;=0A=
=0A=
case IDC_BACK:=0A=
Index: state.h=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /cvs/src/src/winsup/cinstall/state.h,v=0A=
retrieving revision 2.0=0A=
diff -u -r2.0 state.h=0A=
--- state.h 2000/08/08 01:00:30 2.0=0A=
+++ state.h 2000/08/30 13:24:54=0A=
@@ -20,6 +20,8 @@=0A=
=0A=
extern int source;=0A=
=0A=
+extern char * local_dir;=0A=
+=0A=
extern char * root_dir;=0A=
extern int root_text;=0A=
extern int root_scope;=0A=
--- /dev/null Wed Aug 30 17:25:00 2000=0A=
+++ localdir.cc Wed Aug 30 17:24:45 2000=0A=
@@ -0,0 +1,159 @@=0A=
+/*=0A=
+ * Copyright (c) 2000, Red Hat, Inc.=0A=
+ *=0A=
+ * This program is free software; you can redistribute it and/or =
modify=0A=
+ * it under the terms of the GNU General Public License as =
published by=0A=
+ * the Free Software Foundation; either version 2 of the License, or=0A=
+ * (at your option) any later version.=0A=
+ *=0A=
+ * A copy of the GNU General Public License can be found at=0A=
+ * http://www.gnu.org/=0A=
+ *=0A=
+ * Written by Andrej Borsenkow <Andrej DOT Borsenkow AT mow DOT siemens DOT ru>=0A=
+ *=0A=
+ */=0A=
+=0A=
+/* The purpose of this file is to ask the user where they want the=0A=
+ root of the installation to be, and to ask whether the user prefers=0A=
+ text or binary mounts. */=0A=
+=0A=
+static char *cvsid =3D "\n%%% $Id: root.cc,v 2.1 2000/08/25 01:32:08 dj =
Exp $\n";=0A=
+=0A=
+#include "win32.h"=0A=
+#include <shlobj.h>=0A=
+#include <stdio.h>=0A=
+#include <stdlib.h>=0A=
+#include <ctype.h>=0A=
+=0A=
+#include "dialog.h"=0A=
+#include "resource.h"=0A=
+#include "state.h"=0A=
+#include "msg.h"=0A=
+#include "mount.h"=0A=
+#include "concat.h"=0A=
+#include "log.h"=0A=
+=0A=
+static void=0A=
+check_if_enable_next (HWND h)=0A=
+{=0A=
+ EnableWindow (GetDlgItem (h, IDOK), local_dir !=3D 0);=0A=
+}=0A=
+=0A=
+static void=0A=
+load_dialog (HWND h)=0A=
+{=0A=
+ eset (h, IDC_LOCAL_DIR, local_dir);=0A=
+ check_if_enable_next (h);=0A=
+}=0A=
+=0A=
+static void=0A=
+save_dialog (HWND h)=0A=
+{=0A=
+ local_dir =3D eget (h, IDC_LOCAL_DIR, local_dir);=0A=
+}=0A=
+=0A=
+=0A=
+static int CALLBACK=0A=
+browse_cb (HWND h, UINT msg, LPARAM lp, LPARAM data)=0A=
+{=0A=
+ switch (msg)=0A=
+ {=0A=
+ case BFFM_INITIALIZED:=0A=
+ if (local_dir)=0A=
+ SendMessage (h, BFFM_SETSELECTION, TRUE, (LPARAM)local_dir);=0A=
+ break;=0A=
+ }=0A=
+ return 0;=0A=
+}=0A=
+=0A=
+static void=0A=
+browse (HWND h)=0A=
+{=0A=
+ BROWSEINFO bi;=0A=
+ CHAR name[MAX_PATH];=0A=
+ LPITEMIDLIST pidl;=0A=
+ memset (&bi, 0, sizeof (bi));=0A=
+ bi.hwndOwner =3D h;=0A=
+ bi.pszDisplayName =3D name;=0A=
+ bi.lpszTitle =3D "Select download directory";=0A=
+ bi.ulFlags =3D BIF_RETURNONLYFSDIRS;=0A=
+ bi.lpfn =3D browse_cb;=0A=
+ pidl =3D SHBrowseForFolder (&bi);=0A=
+ if (pidl)=0A=
+ {=0A=
+ if (SHGetPathFromIDList (pidl, name))=0A=
+ eset (h, IDC_LOCAL_DIR, name);=0A=
+ }=0A=
+}=0A=
+=0A=
+=0A=
+static BOOL=0A=
+dialog_cmd (HWND h, int id, HWND hwndctl, UINT code)=0A=
+{=0A=
+ switch (id)=0A=
+ {=0A=
+=0A=
+ case IDC_LOCAL_DIR:=0A=
+ save_dialog (h);=0A=
+ check_if_enable_next (h);=0A=
+ break;=0A=
+=0A=
+ case IDC_LOCAL_DIR_BROWSE:=0A=
+ browse (h);=0A=
+ break;=0A=
+=0A=
+ case IDOK:=0A=
+ save_dialog (h);=0A=
+ switch (source)=0A=
+ {=0A=
+ case IDC_SOURCE_DOWNLOAD:=0A=
+ NEXT (IDD_NET);=0A=
+ break;=0A=
+ case IDC_SOURCE_NETINST:=0A=
+ case IDC_SOURCE_CWD:=0A=
+ NEXT (IDD_ROOT);=0A=
+ break;=0A=
+ default:=0A=
+ NEXT (0);=0A=
+ break;=0A=
+ }=0A=
+ break;=0A=
+=0A=
+ case IDC_BACK:=0A=
+ save_dialog (h);=0A=
+ NEXT (IDD_SOURCE);=0A=
+ break;=0A=
+=0A=
+ case IDCANCEL:=0A=
+ NEXT (0);=0A=
+ break;=0A=
+ }=0A=
+}=0A=
+=0A=
+static BOOL CALLBACK=0A=
+dialog_proc (HWND h, UINT message, WPARAM wParam, LPARAM lParam)=0A=
+{=0A=
+ switch (message)=0A=
+ {=0A=
+ case WM_INITDIALOG:=0A=
+ load_dialog (h);=0A=
+ return FALSE;=0A=
+ case WM_COMMAND:=0A=
+ return HANDLE_WM_COMMAND (h, wParam, lParam, dialog_cmd);=0A=
+ }=0A=
+ return FALSE;=0A=
+}=0A=
+=0A=
+extern char cwd[_MAX_PATH];=0A=
+=0A=
+void=0A=
+do_local_dir (HINSTANCE h)=0A=
+{=0A=
+ int rv =3D 0;=0A=
+ rv =3D DialogBox (h, MAKEINTRESOURCE (IDD_LOCAL_DIR), 0, dialog_proc);=0A=
+ if (rv =3D=3D -1)=0A=
+ fatal (IDS_DIALOG_FAILED);=0A=
+=0A=
+ log (0, "Selected local directory: %s", local_dir);=0A=
+}=0A=
+=0A=
------=_NextPart_000_0015_01C012A9.5F0C0490
Content-Type: text/plain; charset=us-ascii
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
------=_NextPart_000_0015_01C012A9.5F0C0490--
- Raw text -