From 1ac649ed7e226735967a47d45f394b3569e4bbad Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Mon, 18 Feb 2002 13:53:07 +0000 Subject: [PATCH] 2002-02-19 Robert Collins * configure.in (CXXFLAGS): Substitute at configure time, not runtime. * configure (CXXFLAGS): Regenerate. * Makefile.in (iniparse.o): Build via default rules - no errors now. * README: TODO list updates. 2002-02-19 Michael A Chase * String++.cc (String::concat):: Remove. (String::vconcat):: Ditto. * String++.h (String::concat):: Remove. (String::vconcat):: Ditto. * archive_tar.cc: Don't include concat.h. * archive_tar_file.cc: Don't include concat.h. * compress_bz.cc (compress_bz::peek): Don't log unneeded messages. (compress_bz::seek): Ditto. (compress_bz::~compress_bz): Ditto. * compress_gz.cc (compress_gz::peek): Ditto. (compress_gz::error): Ditto. (compress_gz::~compress_gz): Ditto. * concat.cc (vconcat): Remove. (concat): Ditto. * concat.h (vconcat): Remove. (concat): Ditto. * desktop.cc (desktop_icon): Use new cygpath. (make_etc_profile): Ditto. (uexists): Ditto. (make_passwd_group): Ditto. (save_icon): Ditto. (check_desktop): Remove concat use. (check_start_menu): Ditto. * download.cc (download_one): Use new mkpath_p correctly. Use LOG_PLAIN. * fromcwd.cc: Don't include concat.h. * geturl.cc (get_url_to_membuf): Use String log() call. (get_url_to_file): Ditto. * install.cc: Don't include concat.h. (uninstall_one): Use LOG_PLAIN. (replace_one): Ditto. (install_one_source): Ditto. (install_one): More char to String conversion. (do_install_thread): Use new cygpath. Use new create_mount. * io_stream.cc (io_stream::move): Use new log(). * io_stream_cygfile (io_stream_cygfile::io_stream_cygfile): Use new cygpath. (io_stream_cygfile::exists): Ditto. (io_stream_cygfile::remove): Ditto. (io_stream_cygfile::mklink): Ditto. (io_stream_cygfile::write): Ditto. (cygmkdir_p): Ditto. (io_stream_cygfile::move): Ditto. * io_stream_file.cc: Don't include log.h. (io_stream_file::write): Don't log unneeded messages. * localdir.cc: Don't include concat.h. (LocalDirPage::OnNext): Use LOG_PLAIN. * log.cc: Don't include log.h. (exit_setup): Use new cygpath. * log.h (log_level): Add new level LOG_PLAIN. * main.cc (WinMain): Use new log(). * mount.cc (SLASH_P): New macro from concat.h. (cygpath): Make String version globally visible. Remove varargs version. * mount,h: Ditto. * msg.cc (mbox): Use LOG_PLAIN. * net.cc (NetPage::OnNext): Ditto. * nio-ftp.cc (ftp_line): Use new log(). * nio-http.cc: Don't include log.h. (retry_get): Use alternative url variable. * package_db.cc: Don't include concat.h. (packagedb::flush): Don't use concat. * package_meta.cc: Don't include concat.h. (packagemeta::uninstall): Use new cygpath. * postinstall.cc (do_postinstall): Ditto. * root.cc (RootPage::OnNext): Use LOG_PLAIN. * script.cc: Don't include concat.h. (init_run_script): Use new cygpath. (run_script): More char * to String conversion. (try_run_script): Ditto. * site.cc: Don't include concat.h. (SitePage::OnNext): Use LOG_PLAIN. (SitePage::OnMessageCmd): Use new log(). * source.cc (SourcePage::OnDeactivate): Use LOG_PLAIN. --- ChangeLog | 84 ++++++++++++++++++++++++++++++++++++++++++++ Makefile.in | 8 ----- README | 8 +++-- String++.cc | 18 ---------- String++.h | 3 -- archive_tar.cc | 1 - archive_tar_file.cc | 1 - compress_bz.cc | 4 +-- compress_gz.cc | 3 -- concat.cc | 76 --------------------------------------- concat.h | 15 -------- configure | 2 +- configure.ac | 2 +- configure.in | 2 +- desktop.cc | 35 ++++++++++-------- download.cc | 12 ++++--- fromcwd.cc | 1 - geturl.cc | 4 +-- ini.cc | 6 ++-- install.cc | 69 ++++++++++++++++++++---------------- io_stream.cc | 2 +- io_stream_cygfile.cc | 25 +++++++------ io_stream_file.cc | 2 -- localdir.cc | 3 +- log.cc | 5 ++- log.h | 1 + main.cc | 4 +-- mount.cc | 29 +++++---------- mount.h | 2 +- msg.cc | 2 +- net.cc | 6 ++-- nio-ftp.cc | 2 +- nio-http.cc | 9 +++-- package_db.cc | 6 ++-- package_meta.cc | 10 +++--- postinstall.cc | 2 +- root.cc | 2 +- script.cc | 39 +++++++++----------- site.cc | 5 ++- source.cc | 6 ++-- 40 files changed, 234 insertions(+), 282 deletions(-) diff --git a/ChangeLog b/ChangeLog index ea0bdb4c..7af40741 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,87 @@ +2002-02-19 Robert Collins + + * configure.in (CXXFLAGS): Substitute at configure time, not runtime. + * configure (CXXFLAGS): Regenerate. + * Makefile.in (iniparse.o): Build via default rules - no errors now. + * README: TODO list updates. + +2002-02-19 Michael A Chase + + * String++.cc (String::concat):: Remove. + (String::vconcat):: Ditto. + * String++.h (String::concat):: Remove. + (String::vconcat):: Ditto. + * archive_tar.cc: Don't include concat.h. + * archive_tar_file.cc: Don't include concat.h. + * compress_bz.cc (compress_bz::peek): Don't log unneeded messages. + (compress_bz::seek): Ditto. + (compress_bz::~compress_bz): Ditto. + * compress_gz.cc (compress_gz::peek): Ditto. + (compress_gz::error): Ditto. + (compress_gz::~compress_gz): Ditto. + * concat.cc (vconcat): Remove. + (concat): Ditto. + * concat.h (vconcat): Remove. + (concat): Ditto. + * desktop.cc (desktop_icon): Use new cygpath. + (make_etc_profile): Ditto. + (uexists): Ditto. + (make_passwd_group): Ditto. + (save_icon): Ditto. + (check_desktop): Remove concat use. + (check_start_menu): Ditto. + * download.cc (download_one): Use new mkpath_p correctly. + Use LOG_PLAIN. + * fromcwd.cc: Don't include concat.h. + * geturl.cc (get_url_to_membuf): Use String log() call. + (get_url_to_file): Ditto. + * install.cc: Don't include concat.h. + (uninstall_one): Use LOG_PLAIN. + (replace_one): Ditto. + (install_one_source): Ditto. + (install_one): More char to String conversion. + (do_install_thread): Use new cygpath. + Use new create_mount. + * io_stream.cc (io_stream::move): Use new log(). + * io_stream_cygfile (io_stream_cygfile::io_stream_cygfile): Use new cygpath. + (io_stream_cygfile::exists): Ditto. + (io_stream_cygfile::remove): Ditto. + (io_stream_cygfile::mklink): Ditto. + (io_stream_cygfile::write): Ditto. + (cygmkdir_p): Ditto. + (io_stream_cygfile::move): Ditto. + * io_stream_file.cc: Don't include log.h. + (io_stream_file::write): Don't log unneeded messages. + * localdir.cc: Don't include concat.h. + (LocalDirPage::OnNext): Use LOG_PLAIN. + * log.cc: Don't include log.h. + (exit_setup): Use new cygpath. + * log.h (log_level): Add new level LOG_PLAIN. + * main.cc (WinMain): Use new log(). + * mount.cc (SLASH_P): New macro from concat.h. + (cygpath): Make String version globally visible. + Remove varargs version. + * mount,h: Ditto. + * msg.cc (mbox): Use LOG_PLAIN. + * net.cc (NetPage::OnNext): Ditto. + * nio-ftp.cc (ftp_line): Use new log(). + * nio-http.cc: Don't include log.h. + (retry_get): Use alternative url variable. + * package_db.cc: Don't include concat.h. + (packagedb::flush): Don't use concat. + * package_meta.cc: Don't include concat.h. + (packagemeta::uninstall): Use new cygpath. + * postinstall.cc (do_postinstall): Ditto. + * root.cc (RootPage::OnNext): Use LOG_PLAIN. + * script.cc: Don't include concat.h. + (init_run_script): Use new cygpath. + (run_script): More char * to String conversion. + (try_run_script): Ditto. + * site.cc: Don't include concat.h. + (SitePage::OnNext): Use LOG_PLAIN. + (SitePage::OnMessageCmd): Use new log(). + * source.cc (SourcePage::OnDeactivate): Use LOG_PLAIN. + 2002-02-19 Robert Collins * Makefile.in (OBJS): Add new object. diff --git a/Makefile.in b/Makefile.in index a0a3bd2c..f2f7340e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -255,14 +255,6 @@ else @$(CXX) @CXXFLAGS@ $(WARNONLY_CFLAGS) -c -o $@ $< -fno-rtti endif -iniparse.o: iniparse.cc -ifdef VERBOSE - $(CXX) @CXXFLAGS@ $(WARNONLY_CFLAGS) -fno-rtti -c -o $@ $< -else - @echo $(CXX) -c @CXXFLAGS@ $(WARNONLY_CFLAGS) ... $(/dev/null || mv iniparse.hh iniparse.h diff --git a/README b/README index 40e4cf0d..3e33f7c5 100644 --- a/README +++ b/README @@ -3,8 +3,10 @@ net releases. TODO: +* Chooser dialog needs work. +* Mirrors list orer is snafued. * Handle UNC paths for the localdir correctly. -* Don't downgrade if the curr version is <= installed. +* Don't downgrade if the curr version is <= installed? * support rpm/deb files for reading the package from. (To allow the maintainers the use of rpm/deb tools to create packages.) * make a librar(y|ies) for setup and cygcheck to use containing 1) Something to translate POSIX -> native. Currently called "cygpath" @@ -32,8 +34,7 @@ WISHLIST: * Mouse wheel support broken/missing for *some* users. * When in category view, and changing from prev->normal->exp the categories get collapsed This is non-intuitive. * mirrors.lst to be copied to setup.ini and cached locally. Then the master mirrors list is reserved for bootstrapping. - * clicking on a package that is in multiple categories should update the view of the package in both locations on screen. - * view button is not clear at first view. (the dotted highlight). + * clicking on a package that is in multiple categories should update the view of the package in both locations on screen. - Done? * remember the view mode - ie if you leave setup in partial, it returns to partial automatically. * new view - "action / category / package" * Downloading from the internet should be _able_ to list based on what is present in the cache, as opposed to what is installed. (To help building a complete install set for a different machine). @@ -49,6 +50,7 @@ WISHLIST: * Show bin and src download size recently completed +* view button is not clear at first view. (the dotted highlight). * continue downloading past errors, present log of failures at end (partial) * multiple mirror support, with setup.ini from each merged automagically. * installed packages aren't automatically upgraded. diff --git a/String++.cc b/String++.cc index ff86f6b6..90c8bdb8 100644 --- a/String++.cc +++ b/String++.cc @@ -160,24 +160,6 @@ String::casecompare (String const &aString, size_t const count) const return 0; } -String -String::concat (const char *aString, ...) -{ - va_list aList; - va_start (aList, aString); - - return vconcat (aString, aList); -} - -String -String::vconcat (const char *aString, va_list aList) -{ - char *tempString = ::vconcat(aString, aList); - String theString = String (tempString); - delete[] tempString; - return theString; -} - String & String::operator+= (String const &aString) { diff --git a/String++.h b/String++.h index ba6c1003..52b5130a 100644 --- a/String++.h +++ b/String++.h @@ -26,9 +26,6 @@ class String { class _data; public: // Static members first - static String concat (const char *s, ...); - static String vconcat (const char *, va_list); - inline String(); inline String (String const &); // We're notperformance bottlenecked. diff --git a/archive_tar.cc b/archive_tar.cc index 811aa46a..26ff961a 100644 --- a/archive_tar.cc +++ b/archive_tar.cc @@ -35,7 +35,6 @@ static const char *cvsid = #include "mkdir.h" #include "log.h" #include "filemanip.h" -#include "concat.h" #include "port.h" #if 0 diff --git a/archive_tar_file.cc b/archive_tar_file.cc index 9e3f8ab8..2deaf9d4 100644 --- a/archive_tar_file.cc +++ b/archive_tar_file.cc @@ -32,7 +32,6 @@ static const char *cvsid = "\n%%% $Id$\n"; #include "archive.h" #include "archive_tar.h" #include "log.h" -#include "concat.h" #include "port.h" diff --git a/compress_bz.cc b/compress_bz.cc index e9f47ba9..b15a65d0 100644 --- a/compress_bz.cc +++ b/compress_bz.cc @@ -137,7 +137,6 @@ ssize_t compress_bz::write (const void *buffer, size_t len) ssize_t compress_bz::peek (void *buffer, size_t len) { - log (LOG_TIMESTAMP, "compress_bz::peek called"); if (writing) { lasterr = EBADF; @@ -179,7 +178,7 @@ int compress_bz::seek (long where, io_stream_seek_t whence) { log (LOG_TIMESTAMP, "compress_bz::seek called"); - return -1; + return -1; } int @@ -207,7 +206,6 @@ compress_bz::get_mtime () compress_bz::~compress_bz () { - log (LOG_BABBLE, "compress_bz::~bz called"); if (initialisedOk) BZ2_bzDecompressEnd (&strm); destroyed = 1; diff --git a/compress_gz.cc b/compress_gz.cc index 4fdde30d..7a9d28d8 100644 --- a/compress_gz.cc +++ b/compress_gz.cc @@ -374,7 +374,6 @@ compress_gz::write (const void *buffer, size_t len) ssize_t compress_gz::peek (void *buffer, size_t len) { - log (LOG_TIMESTAMP, "compress_gz::peek called"); if (mode != 'r') return Z_STREAM_ERROR; /* can only peek 512 bytes */ @@ -418,7 +417,6 @@ compress_gz::seek (long where, io_stream_seek_t whence) int compress_gz::error () { -// log (LOG_TIMESTAMP, "compress_gz::error called"); return z_err; } @@ -466,7 +464,6 @@ compress_gz::destroy () compress_gz::~compress_gz () { - log (LOG_TIMESTAMP, "compress_gz::~gz called"); if (mode == 'w') { z_err = do_flush (Z_FINISH); diff --git a/concat.cc b/concat.cc index f62fc837..e08df4eb 100644 --- a/concat.cc +++ b/concat.cc @@ -21,87 +21,11 @@ static const char *cvsid = "\n%%% $Id$\n"; #endif - #include #include #include #include "concat.h" -char * -concat (const char *s, ...) -{ - va_list v; - - va_start (v, s); - - return vconcat (s, v); -} - -char * -vconcat (const char *s, va_list v) -{ - int len; - char *rv, *arg; - va_list save_v = v; - int unc; - - if (!s) - return 0; - - len = strlen (s); - - unc = SLASH_P (*s) && SLASH_P (s[1]); - - while (1) - { - arg = va_arg (v, char *); - if (arg == 0) - break; - len += strlen (arg); - } - va_end (v); - - rv = new char [len + 1]; - strcpy (rv, s); - v = save_v; - while (1) - { - arg = va_arg (v, char *); - if (arg == 0) - break; - strcat (rv, arg); - } - va_end (v); - - char *d, *p; - for (p = rv; *p; p++) - if (*p == '\\') - *p = '/'; - - /* concat is only used for urls and files, so we can safely - canonicalize the results */ - for (p = d = rv; *p; p++) - { - *d++ = *p; - /* special case for URLs */ - if (*p == ':' && p[1] == '/' && p[2] == '/' && p > rv + 1) - { - *d++ = *++p; - *d++ = *++p; - } - else if (*p == '/' || *p == '\\') - { - if (p == rv && unc) - p++; - while (p[1] == '/') - p++; - } - } - *d = 0; - - return rv; -} - char * backslash (char *s) { diff --git a/concat.h b/concat.h index 257b5507..a6118ae4 100644 --- a/concat.h +++ b/concat.h @@ -15,21 +15,6 @@ #include -/* Pass a null-terminated list of strings, and it concatenates them - into a single string. Warning - it assumes the result is a file - name or URL, and will canonicalize the result accordingly - (i.e. replace \ with /, collapse multiple /// to a single /, etc.) */ - -char *concat (const char *s, ...); -char *vconcat (const char *, va_list); - /* convert slashes to backslashes */ char *backslash (char *s); - -/* Used when treating / and \ as equivalent. */ -#define SLASH_P(ch) \ - ({ \ - char __c = (ch); \ - ((__c) == '/' || (__c) == '\\'); \ - }) diff --git a/configure b/configure index 337e5f01..73a7af31 100755 --- a/configure +++ b/configure @@ -875,7 +875,7 @@ fi test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } fi -CXXFLAGS='$(CFLAGS)' +CXXFLAGS="$CFLAGS" if test "$program_transform_name" = s,x,x,; then diff --git a/configure.ac b/configure.ac index 19c9995d..8e1d321d 100644 --- a/configure.ac +++ b/configure.ac @@ -64,7 +64,7 @@ if test -z "$CXX"; then test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) fi -CXXFLAGS='$(CFLAGS)' +CXXFLAGS="$CFLAGS" ]) AC_CANONICAL_SYSTEM diff --git a/configure.in b/configure.in index 19c9995d..8e1d321d 100644 --- a/configure.in +++ b/configure.in @@ -64,7 +64,7 @@ if test -z "$CXX"; then test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) fi -CXXFLAGS='$(CFLAGS)' +CXXFLAGS="$CFLAGS" ]) AC_CANONICAL_SYSTEM diff --git a/desktop.cc b/desktop.cc index 588d187c..5b79b838 100644 --- a/desktop.cc +++ b/desktop.cc @@ -108,7 +108,8 @@ make_link (String const &linkpath, String const &title, String const &target) if (_access (fname.cstr_oneuse(), 0) == 0) return; /* already exists */ - msg ("make_link %s, %s, %s\n", fname.cstr_oneuse(), title.cstr_oneuse(), target.cstr_oneuse()); + msg ("make_link %s, %s, %s\n", + fname.cstr_oneuse(), title.cstr_oneuse(), target.cstr_oneuse()); io_stream::mkpath_p (PATH_TO_FILE, fname); @@ -132,8 +133,11 @@ make_link (String const &linkpath, String const &title, String const &target) // sprintf (argbuf, "%s %s", COMMAND9XARGS, target.cstr_oneuse()); } - msg ("make_link_2 (%s, %s, %s, %s)", exepath.cstr_oneuse(), argbuf.cstr_oneuse(), iconname.cstr_oneuse(), fname.cstr_oneuse()); - make_link_2 (exepath.cstr_oneuse(), argbuf.cstr_oneuse(), iconname.cstr_oneuse(), fname.cstr_oneuse()); + msg ("make_link_2 (%s, %s, %s, %s)", + exepath.cstr_oneuse(), argbuf.cstr_oneuse(), + iconname.cstr_oneuse(), fname.cstr_oneuse()); + make_link_2 (exepath.cstr_oneuse(), argbuf.cstr_oneuse(), + iconname.cstr_oneuse(), fname.cstr_oneuse()); } static void @@ -154,7 +158,8 @@ start_menu (String const &title, String const &target) SHGetSpecialFolderLocation (NULL, CSIDL_PROGRAMS, &id); SHGetPathFromIDList (id, _path); path = String(_path); - msg ("Program directory for program link changed to: %s", path.cstr_oneuse()); + msg ("Program directory for program link changed to: %s", + path.cstr_oneuse()); } // end of Win95 addition path += "/Cygwin"; @@ -188,7 +193,7 @@ desktop_icon (String const &title, String const &target) static void make_cygwin_bat () { - batname = backslash (cygpath ("/cygwin.bat", 0)); + batname = backslash (cygpath ("/cygwin.bat")); /* if the batch file exists, don't overwrite it */ if (_access (batname.cstr_oneuse(), 0) == 0) @@ -212,7 +217,7 @@ make_cygwin_bat () static void make_etc_profile () { - String fname = cygpath ("/etc/profile", 0); + String fname = cygpath ("/etc/profile"); /* if the file exists, don't overwrite it */ if (_access (fname.cstr_oneuse(), 0) == 0) @@ -262,7 +267,7 @@ make_etc_profile () static int uexists (const char *path) { - String f = cygpath (path, 0); + String f = cygpath (path); int a = _access (f.cstr_oneuse(), 0); if (a == 0) return 1; @@ -272,7 +277,7 @@ uexists (const char *path) static void make_passwd_group () { - String fname = cygpath ("/etc/postinstall/passwd-grp.bat", 0); + String fname = cygpath ("/etc/postinstall/passwd-grp.bat"); io_stream::mkpath_p (PATH_TO_FILE, fname); FILE *p = fopen (fname.cstr_oneuse(), "wt"); @@ -308,7 +313,7 @@ out: static void save_icon () { - iconname = backslash (cygpath ("/cygwin.ico", 0)); + iconname = backslash (cygpath ("/cygwin.ico")); HRSRC rsrc = FindResource (NULL, "CYGWIN.ICON", "FILE"); if (rsrc == NULL) @@ -384,12 +389,12 @@ check_desktop (String const title, String const target) msg ("Desktop directory for deskop link changed to: %s", path); } // end of Win95 addition - String fname = String::concat (path, "/", title.cstr_oneuse(), ".lnk", 0); + String fname = String (path) + "/" + title + ".lnk"; if (_access (fname.cstr_oneuse(), 0) == 0) return 0; /* already exists */ - fname = String::concat (path, "/", title.cstr_oneuse(), ".pif", 0); /* check for a pif as well */ + fname = String (path) + "/" + title + ".pif"; /* check for a pif as well */ if (_access (fname.cstr_oneuse(), 0) == 0) return 0; /* already exists */ @@ -418,12 +423,12 @@ check_startmenu (String const title, String const target) } // end of Win95 addition strcat (path, "/Cygwin"); - String fname = String::concat (path, "/", title.cstr_oneuse(), ".lnk", 0); + String fname = String (path) + "/" + title + ".lnk"; if (_access (fname.cstr_oneuse(), 0) == 0) return 0; /* already exists */ - fname = String::concat (path, "/", title.cstr_oneuse(), ".pif", 0); /* check for a pif as well */ + fname = String (path) + "/" + title + ".pif"; /* check for a pif as well */ if (_access (fname.cstr_oneuse(), 0) == 0) return 0; /* already exists */ @@ -467,10 +472,10 @@ DesktopSetupPage::OnInit () verinfo.dwOSVersionInfoSize = sizeof (verinfo); GetVersionEx (&verinfo); root_desktop = - check_desktop ("Cygwin", backslash (cygpath ("/cygwin.bat", 0))); + check_desktop ("Cygwin", backslash (cygpath ("/cygwin.bat"))); root_menu = check_startmenu ("Cygwin Bash Shell", - backslash (cygpath ("/cygwin.bat", 0))); + backslash (cygpath ("/cygwin.bat"))); load_dialog (GetHWND ()); } diff --git a/download.cc b/download.cc index 5152d709..7b167578 100644 --- a/download.cc +++ b/download.cc @@ -110,10 +110,11 @@ download_one (packagesource & pkgsource, HWND owner) rfc1738_escape_part (pkgsource.sites[n]-> key) + "/" + pkgsource.Canonical (); - io_stream::mkpath_p (PATH_TO_FILE, (String ("file://") + local).cstr_oneuse()); + io_stream::mkpath_p (PATH_TO_FILE, String ("file://") + local); - if (get_url_to_file(String (pkgsource.sites[n]->key) + "/" + pkgsource.Canonical (), - local + ".tmp", pkgsource.size, owner)) + if (get_url_to_file(pkgsource.sites[n]->key + "/" + + pkgsource.Canonical (), + local + ".tmp", pkgsource.size, owner)) { /* FIXME: note new source ? */ continue; @@ -123,7 +124,7 @@ download_one (packagesource & pkgsource, HWND owner) size_t size = get_file_size (local + ".tmp"); if (size == pkgsource.size) { - log (LOG_TIMESTAMP, "Downloaded %s", local.cstr_oneuse()); + log (LOG_PLAIN, String ("Downloaded ") + local); if (_access (local.cstr_oneuse(), 0) == 0) remove (local.cstr_oneuse()); rename ((local + ".tmp").cstr_oneuse(), local.cstr_oneuse()); @@ -135,7 +136,8 @@ download_one (packagesource & pkgsource, HWND owner) } else { - log (LOG_TIMESTAMP, "Download %s wrong size (%u actual vs %d expected)", + log (LOG_PLAIN, + "Download %s wrong size (%u actual vs %d expected)", local.cstr_oneuse(), size, pkgsource.size); remove ((local + ".tmp").cstr_oneuse()); continue; diff --git a/fromcwd.cc b/fromcwd.cc index dbb220b4..28b4b84b 100644 --- a/fromcwd.cc +++ b/fromcwd.cc @@ -40,7 +40,6 @@ static const char *cvsid = #include "ini.h" #include "resource.h" -#include "concat.h" #include "state.h" #include "dialog.h" #include "msg.h" diff --git a/geturl.cc b/geturl.cc index e27c6a4f..06474a49 100644 --- a/geturl.cc +++ b/geturl.cc @@ -115,7 +115,7 @@ progress (int bytes) io_stream * get_url_to_membuf (String const &_url, HWND owner) { - log (LOG_BABBLE, "get_url_to_membuf %s", _url.cstr_oneuse()); + log (LOG_BABBLE, String ("get_url_to_membuf ") + _url); is_local_install = (source == IDC_SOURCE_CWD); init_dialog (_url, 0, owner); NetIO *n = NetIO::open (_url.cstr_oneuse()); @@ -193,7 +193,7 @@ int get_url_to_file (String const &_url, String const &_filename, int expected_length, HWND owner, BOOL allow_ftp_auth) { - log (LOG_BABBLE, "get_url_to_file %s %s", _url.cstr_oneuse(), _filename.cstr_oneuse()); + log (LOG_BABBLE, String ("get_url_to_file ") + _url + " " + _filename); if (total_download_bytes > 0) { int df = diskfull (get_root_dir ().cstr_oneuse()); diff --git a/ini.cc b/ini.cc index 6c33164b..cec56644 100644 --- a/ini.cc +++ b/ini.cc @@ -65,10 +65,12 @@ find_routine (char *path, unsigned int fsize) { if (!strstr (path, "setup.ini") ) return; - io_stream *ini_file = io_stream::open (String ("file://") + local_dir + "/" + path, "rb"); + io_stream *ini_file = io_stream::open (String ("file://") + local_dir + "/" + + path, "rb"); if (!ini_file) { - note (NULL, IDS_SETUPINI_MISSING, (String ("file://") + local_dir + "/" + path).cstr_oneuse()); + note (NULL, IDS_SETUPINI_MISSING, (String ("file://") + local_dir + "/" + + path).cstr_oneuse()); return; } else diff --git a/install.cc b/install.cc index fb2df208..5d1a8c9c 100644 --- a/install.cc +++ b/install.cc @@ -39,7 +39,6 @@ static const char *cvsid = "\n%%% $Id$\n"; #include "resource.h" #include "ini.h" #include "dialog.h" -#include "concat.h" #include "geturl.h" #include "state.h" #include "diskfull.h" @@ -122,7 +121,7 @@ uninstall_one (packagemeta & pkgm) { Progress.SetText1 ("Uninstalling..."); Progress.SetText2 (pkgm.name.cstr_oneuse()); - log (LOG_TIMESTAMP, String("Uninstalling ") + pkgm.name); + log (LOG_PLAIN, String("Uninstalling ") + pkgm.name); pkgm.uninstall (); num_uninstalls++; } @@ -139,7 +138,7 @@ replace_one (packagemeta & pkg) int errors = 0; Progress.SetText1 ("Replacing..."); Progress.SetText2 (pkg.name.cstr_oneuse()); - log (LOG_TIMESTAMP, String( "Replacing ") + pkg.name); + log (LOG_PLAIN, String( "Replacing ") + pkg.name); pkg.uninstall (); errors += @@ -183,7 +182,7 @@ install_one_source (packagemeta & pkgm, packagesource & source, char msg[64]; strcpy (msg, "Installing"); Progress.SetText1 (msg); - log (LOG_TIMESTAMP, "%s %s", msg, source.Cached ()); + log (LOG_PLAIN, String (msg) + " " + source.Cached ()); io_stream *tmp = io_stream::open (source.Cached (), "rb"); archive *thefile = 0; if (tmp) @@ -215,7 +214,9 @@ install_one_source (packagemeta & pkgm, packagesource & source, //extract to temp location if (archive::extract_file (thefile, prefixURL, prefixPath, ".new") != 0) { - log (LOG_TIMESTAMP, String("Unable to install file ")+ prefixURL+prefixPath+ fn); + log (LOG_PLAIN, + String("Unable to install file ") + + prefixURL + prefixPath + fn); errors++; } else @@ -227,13 +228,16 @@ install_one_source (packagemeta & pkgm, packagesource & source, /* Get the short file names */ char source[MAX_PATH]; unsigned int len = - GetShortPathName (cygpath ("/", fn.cstr_oneuse(), ".new", 0).cstr_oneuse(), + GetShortPathName (cygpath (String ("/") + fn + + ".new").cstr_oneuse(), source, MAX_PATH); if (!len || len > MAX_PATH) { log (LOG_TIMESTAMP, "Unable to schedule reboot replacement of file %s with %s (Win32 Error %ld)", - cygpath ("/", fn.cstr_oneuse(), 0).cstr_oneuse(), cygpath ("/", fn.cstr_oneuse(), ".new", 0).cstr_oneuse(), + cygpath (String ("/") + fn).cstr_oneuse(), + cygpath (String ("/") + fn + + ".new").cstr_oneuse(), GetLastError ()); ++errors; } @@ -241,14 +245,16 @@ install_one_source (packagemeta & pkgm, packagesource & source, { char dest[MAX_PATH]; len = - GetShortPathName (cygpath ("/", fn.cstr_oneuse(), 0).cstr_oneuse(), dest, - MAX_PATH); + GetShortPathName (cygpath (String ("/") + + fn).cstr_oneuse(), + dest, MAX_PATH); if (!len || len > MAX_PATH) { log (LOG_TIMESTAMP, "Unable to schedule reboot replacement of file %s with %s (Win32 Error %ld)", - cygpath ("/", fn.cstr_oneuse(), 0).cstr_oneuse(), cygpath ("/", fn.cstr_oneuse(), - ".new", 0).cstr_oneuse(), + cygpath (String ("/") + fn).cstr_oneuse(), + cygpath (String ("/") + fn + + ".new").cstr_oneuse(), GetLastError ()); ++errors; @@ -260,8 +266,9 @@ install_one_source (packagemeta & pkgm, packagesource & source, { log (LOG_TIMESTAMP, "Unable to schedule reboot replacement of file %s with %s (Win32 Error %ld)", - cygpath ("/", fn.cstr_oneuse(), 0).cstr_oneuse(), cygpath ("/", fn.cstr_oneuse(), - ".new", 0).cstr_oneuse(), + cygpath (String ("/") + fn).cstr_oneuse(), + cygpath (String ("/") + fn + + ".new").cstr_oneuse(), GetLastError ()); ++errors; } @@ -275,14 +282,16 @@ install_one_source (packagemeta & pkgm, packagesource & source, * - we need a io method to get win32 paths * or to wrap this system call */ - if (!MoveFileEx (cygpath ("/", fn.cstr_oneuse(), ".new", 0).cstr_oneuse(), - cygpath ("/", fn.cstr_oneuse(), 0).cstr_oneuse(), + if (!MoveFileEx (cygpath (String ("/") + fn + + ".new").cstr_oneuse(), + cygpath (String ("/") + fn).cstr_oneuse(), MOVEFILE_DELAY_UNTIL_REBOOT | MOVEFILE_REPLACE_EXISTING)) { log (LOG_TIMESTAMP, "Unable to schedule reboot replacement of file %s with %s (Win32 Error %ld)", - cygpath ("/", fn.cstr_oneuse(), 0).cstr_oneuse(), cygpath ("/", fn.cstr_oneuse(), ".new", 0).cstr_oneuse(), + cygpath (String ("/") + fn).cstr_oneuse(), + cygpath (String ("/") + fn + ".new").cstr_oneuse(), GetLastError ()); ++errors; } @@ -334,37 +343,37 @@ install_one (packagemeta & pkg) /* FIXME: make a upgrade method and reinstate this */ #if 0 - char msg[64]; + String msg; if (!pkg->installed) - strcpy (msg, "Installing"); + msg = "Installing"; else { int n = strcmp (pi->version, pkg->installed->version); if (n < 0) - strcpy (msg, "Reverting"); + msg = "Reverting"; else if (n == 0) - strcpy (msg, "Reinstalling"); + msg = "Reinstalling"; else - strcpy (msg, "Upgrading"); + msg = "Upgrading"; } switch (pkg->action) { case ACTION_PREV: - strcat (msg, " previous version..."); + msg += " previous version..."; break; case ACTION_CURR: - strcat (msg, "..."); + msg += "..."; break; case ACTION_TEST: - strcat (msg, " test version..."); + msg += " test version..."; break; default: /* FIXME: log this somehow */ break; } - SetWindowText (ins_action, msg); - log (0, "%s%s", msg, file); + SetWindowText (ins_action, msg.cstr_oneuse()); + log (LOG_PLAIN, msg + " " + file); #endif return errors; @@ -421,7 +430,7 @@ do_install_thread (HINSTANCE h, HWND owner) for (i = 0; standard_dirs[i]; i++) { - String p = cygpath (standard_dirs[i], 0); + String p = cygpath (standard_dirs[i]); if (p.size()) io_stream::mkpath_p (PATH_TO_DIR, p); } @@ -441,9 +450,9 @@ do_install_thread (HINSTANCE h, HWND owner) int istext = (root_text == IDC_ROOT_TEXT) ? 1 : 0; int issystem = (root_scope == IDC_ROOT_SYSTEM) ? 1 : 0; - create_mount ("/", get_root_dir ().cstr_oneuse(), istext, issystem); - create_mount ("/usr/bin", cygpath ("/bin", 0), istext, issystem); - create_mount ("/usr/lib", cygpath ("/lib", 0), istext, issystem); + create_mount ("/", get_root_dir (), istext, issystem); + create_mount ("/usr/bin", cygpath ("/bin"), istext, issystem); + create_mount ("/usr/lib", cygpath ("/lib"), istext, issystem); set_cygdrive_flags (istext, issystem); /* Let's hope people won't uninstall packages before installing [b]ash */ diff --git a/io_stream.cc b/io_stream.cc index 2d1485d8..2707136d 100644 --- a/io_stream.cc +++ b/io_stream.cc @@ -226,7 +226,7 @@ io_stream::move (String const &from, String const &to) /* http urls can symlink to http or ftp url's */ } #endif - log (LOG_TIMESTAMP, "Unsupported url providers for %s", from.cstr_oneuse()); + log (LOG_TIMESTAMP, String ("Unsupported url providers for ") + from); return 1; } diff --git a/io_stream_cygfile.cc b/io_stream_cygfile.cc index 8e47da91..20ecb8fe 100644 --- a/io_stream_cygfile.cc +++ b/io_stream_cygfile.cc @@ -60,7 +60,7 @@ io_stream_cygfile::io_stream_cygfile (String const &name, String const &mode) : /* TODO: assign a errno for "no mount table :} " */ return; - fname = cygpath (name.cstr_oneuse(), 0); + fname = cygpath (name); lmode = mode; fp = fopen (fname.cstr_oneuse(), mode.cstr_oneuse()); if (!fp) @@ -79,7 +79,7 @@ int io_stream_cygfile::exists (String const &path) { get_root_dir_now (); - if (get_root_dir ().size() && _access (cygpath (path.cstr_oneuse(), 0).cstr_oneuse(), 0) == 0) + if (get_root_dir ().size() && _access (cygpath (path).cstr_oneuse(), 0) == 0) return 1; return 0; } @@ -94,22 +94,22 @@ io_stream_cygfile::remove (String const &path) /* TODO: assign a errno for "no mount table :} " */ return 1; - unsigned long w = GetFileAttributes (cygpath (path.cstr_oneuse(),0).cstr_oneuse()); + unsigned long w = GetFileAttributes (cygpath (path).cstr_oneuse()); if (w != 0xffffffff && w & FILE_ATTRIBUTE_DIRECTORY) { - char tmp[cygpath (path.cstr_oneuse(),0).size() + 10]; + char tmp[cygpath (path).size() + 10]; int i = 0; do { ++i; - sprintf (tmp, "%s.old-%d", cygpath (path.cstr_oneuse(),0).cstr_oneuse(), i); + sprintf (tmp, "%s.old-%d", cygpath (path).cstr_oneuse(), i); } while (GetFileAttributes (tmp) != 0xffffffff); fprintf (stderr, "warning: moving directory \"%s\" out of the way.\n", path.cstr_oneuse()); - MoveFile (cygpath (path.cstr_oneuse(),0).cstr_oneuse(), tmp); + MoveFile (cygpath (path).cstr_oneuse(), tmp); } - return !DeleteFileA (cygpath (path.cstr_oneuse(),0).cstr_oneuse()); + return !DeleteFileA (cygpath (path).cstr_oneuse()); } int @@ -121,20 +121,20 @@ io_stream_cygfile::mklink (String const &from, String const &to, switch (linktype) { case IO_STREAM_SYMLINK: - return mkcygsymlink (cygpath (from.cstr_oneuse(),0).cstr_oneuse(), to.cstr_oneuse()); + return mkcygsymlink (cygpath (from).cstr_oneuse(), to.cstr_oneuse()); case IO_STREAM_HARDLINK: { /* For now, just copy */ /* textmode alert: should we translate when linking from an binmode to a text mode mount and vice verca? */ - io_stream *in = io_stream::open (cygpath (to.cstr_oneuse(),0), "rb"); + io_stream *in = io_stream::open (cygpath (to), "rb"); if (!in) { log (LOG_TIMESTAMP, String("could not open ") + to +" for reading in mklink"); return 1; } - io_stream *out = io_stream::open (cygpath (from.cstr_oneuse(),0), "wb"); + io_stream *out = io_stream::open (cygpath (from), "wb"); if (!out) { log (LOG_TIMESTAMP, String("could not open ")+ from + " for writing in mklink"); @@ -180,7 +180,6 @@ io_stream_cygfile::write (const void *buffer, size_t len) ssize_t io_stream_cygfile::peek (void *buffer, size_t len) { - log (LOG_TIMESTAMP, "io_stream_cygfile::peek called"); if (fp) { int pos = ftell (fp); @@ -229,7 +228,7 @@ cygmkdir_p (enum path_type_t isadir, String const &name) if (!get_root_dir ().size()) /* TODO: assign a errno for "no mount table :} " */ return 1; - return mkdir_p (isadir == PATH_TO_DIR ? 1 : 0, cygpath (name.cstr_oneuse(),0).cstr_oneuse()); + return mkdir_p (isadir == PATH_TO_DIR ? 1 : 0, cygpath (name).cstr_oneuse()); } int @@ -278,7 +277,7 @@ io_stream_cygfile::move (String const &from, String const &to) if (!get_root_dir ().size()) /* TODO: assign a errno for "no mount table :} " */ return 1; - return rename (cygpath (from.cstr_oneuse(),0).cstr_oneuse(), cygpath (to.cstr_oneuse(),0).cstr_oneuse()); + return rename (cygpath (from).cstr_oneuse(), cygpath (to).cstr_oneuse()); } size_t diff --git a/io_stream_file.cc b/io_stream_file.cc index 11244c38..1bd7a10e 100644 --- a/io_stream_file.cc +++ b/io_stream_file.cc @@ -23,7 +23,6 @@ static const char *cvsid = #include #include #include -#include "log.h" #include "port.h" #include "mklink2.h" @@ -126,7 +125,6 @@ io_stream_file::write (const void *buffer, size_t len) ssize_t io_stream_file::peek (void *buffer, size_t len) { - log (LOG_TIMESTAMP, "io_stream_file::peek called"); if (fp) { int pos = ftell (fp); diff --git a/localdir.cc b/localdir.cc index 96fbd289..acae1619 100644 --- a/localdir.cc +++ b/localdir.cc @@ -34,7 +34,6 @@ static const char *cvsid = #include "state.h" #include "msg.h" #include "mount.h" -#include "concat.h" #include "log.h" #include "io_stream.h" @@ -175,7 +174,7 @@ LocalDirPage::OnNext () save_dialog (h); save_local_dir (); - log (LOG_TIMESTAMP, "Selected local directory: %s", local_dir.cstr_oneuse()); + log (LOG_PLAIN, String ("Selected local directory: ") + local_dir); if (SetCurrentDirectoryA (local_dir.cstr_oneuse())) { if (source == IDC_SOURCE_CWD) diff --git a/log.cc b/log.cc index a3b2f817..115aeceb 100644 --- a/log.cc +++ b/log.cc @@ -31,7 +31,6 @@ static const char *cvsid = #include "log.h" #include "dialog.h" #include "state.h" -#include "concat.h" #include "mkdir.h" #include "mount.h" @@ -135,8 +134,8 @@ exit_setup (int exit_code) } else { - log_save (LOG_BABBLE, cygpath ("/var/log/setup.log.full", 0), 0); - log_save (0, cygpath ("/var/log/setup.log", 0), 1); + log_save (LOG_BABBLE, cygpath ("/var/log/setup.log.full"), 0); + log_save (0, cygpath ("/var/log/setup.log"), 1); } ExitProcess (exit_code); diff --git a/log.h b/log.h index 24709f2f..b7559914 100644 --- a/log.h +++ b/log.h @@ -20,6 +20,7 @@ #include "String++.h" enum log_level { + LOG_PLAIN = 2, LOG_BABBLE = 1, LOG_TIMESTAMP = 2 }; diff --git a/main.cc b/main.cc index ea0be757..7b09685e 100644 --- a/main.cc +++ b/main.cc @@ -148,7 +148,7 @@ WinMain (HINSTANCE h, next_dialog = IDD_SPLASH; - log (LOG_TIMESTAMP, "Starting cygwin install, version %s", version); + log (LOG_PLAIN, String ("Starting cygwin install, version ") + version); SplashPage Splash; SourcePage Source; @@ -163,7 +163,7 @@ WinMain (HINSTANCE h, char cwd[_MAX_PATH]; GetCurrentDirectory (sizeof (cwd), cwd); local_dir = String (cwd); - log (LOG_TIMESTAMP, "Current Directory: %s", cwd); + log (LOG_TIMESTAMP, String ("Current Directory: ") + local_dir); char **argv; int argc; diff --git a/mount.cc b/mount.cc index 79096a55..02b5949e 100644 --- a/mount.cc +++ b/mount.cc @@ -33,10 +33,16 @@ static const char *cvsid = "\n%%% $Id$\n"; #include "resource.h" #include "dialog.h" #include "state.h" -#include "concat.h" #include "String++.h" +/* Used when treating / and \ as equivalent. */ +#define SLASH_P(ch) \ + ({ \ + char __c = (ch); \ + ((__c) == '/' || (__c) == '\\'); \ + }) + static struct mnt { String native; @@ -432,7 +438,7 @@ path_prefix_p (String const path1, String const path2) || path1.cstr_oneuse ()[len1 - 1] == ':'; } -static String +String cygpath (String const &thePath) { size_t max_len = 0; @@ -455,23 +461,6 @@ cygpath (String const &thePath) native = match->native; } else - native = match->native + "/" + String (thePath.cstr_oneuse () + max_len); + native = match->native + "/" + String (thePath.cstr_oneuse() + max_len); return native; } - -String -cygpath (const char *s, ...) -{ - va_list v; - - va_start (v, s); - char *path = vconcat (s, v); - if (strncmp (path, "./", 2) == 0) - memmove (path, path + 2, strlen (path + 2) + 1); - if (strncmp (path, "/./", 3) == 0) - memmove (path + 1, path + 3, strlen (path + 3) + 1); - - String thePath (path); - delete[]path; - return cygpath (thePath); -} diff --git a/mount.h b/mount.h index 1fe3f2b5..7116b393 100644 --- a/mount.h +++ b/mount.h @@ -32,6 +32,6 @@ void read_mounts (); mode consistent with the standard Cygwin mounts. */ void set_cygdrive_flags (int istext, int issystem); -String cygpath (const char *s, ...); +String cygpath (String const &); void set_root_dir (String const); String const get_root_dir (); diff --git a/msg.cc b/msg.cc index 1320e75f..af74ea8e 100644 --- a/msg.cc +++ b/msg.cc @@ -46,7 +46,7 @@ mbox (HWND owner, const char *name, int type, int id, va_list args) ExitProcess (0); vsprintf (buf, fmt, args); - log (LOG_TIMESTAMP, "mbox %s: %s", name, buf); + log (LOG_PLAIN, String ("mbox ") + name + ": " + buf); return MessageBox (owner, buf, "Cygwin Setup", type); } diff --git a/net.cc b/net.cc index 81815a51..25f0bf2f 100644 --- a/net.cc +++ b/net.cc @@ -113,9 +113,9 @@ NetPage::OnNext () { save_dialog (GetHWND ()); - log (LOG_TIMESTAMP, "net: %s", - (net_method == IDC_NET_IE5) ? "IE5" : - (net_method == IDC_NET_DIRECT) ? "Direct" : "Proxy"); + log (LOG_PLAIN, String ("net: ") + + ((net_method == IDC_NET_IE5) ? "IE5" : + (net_method == IDC_NET_DIRECT) ? "Direct" : "Proxy")); Progress.SetActivateTask (WM_APP_START_SITE_INFO_DOWNLOAD); return IDD_INSTATUS; diff --git a/nio-ftp.cc b/nio-ftp.cc index 417f28bd..75fc8ab3 100644 --- a/nio-ftp.cc +++ b/nio-ftp.cc @@ -47,7 +47,7 @@ ftp_line (SimpleSocket * s) do { last_line = s->gets (); - log (LOG_BABBLE, "ftp > %s", last_line ? last_line : "error"); + log (LOG_BABBLE, String ("ftp > ") + (last_line ? last_line : "error")); } while (last_line && (!isdigit (last_line[0]) || last_line[3] != ' ')); return atoi (last_line ? : "0"); diff --git a/nio-http.cc b/nio-http.cc index 6bc205aa..ab070115 100644 --- a/nio-http.cc +++ b/nio-http.cc @@ -30,7 +30,6 @@ static const char *cvsid = #include "state.h" #include "simpsock.h" #include "msg.h" -#include "concat.h" #include "netio.h" #include "nio-http.h" @@ -107,7 +106,7 @@ retry_get: } if (net_method == IDC_NET_PROXY) - s->printf ("GET %s HTTP/1.0\r\n", url); + s->printf ("GET %s HTTP/1.0\r\n", Purl); else s->printf ("GET %s HTTP/1.0\r\n", path); s->printf ("Host: %s:%d\r\n", host, port); @@ -161,15 +160,15 @@ retry_get: goto retry_get; } if (code == 500 /* ftp authentication through proxy required */ - && net_method == IDC_NET_PROXY && !strncmp (url, "ftp://", 6)) + && net_method == IDC_NET_PROXY && !strncmp (Purl, "ftp://", 6)) { get_ftp_auth (NULL); if (net_ftp_user && net_ftp_passwd) { delete s; - url = concat ("ftp://", net_ftp_user, - ":", net_ftp_passwd, "@", url + 6, 0); + Purl = (String ("ftp://") + net_ftp_user + + ":" + net_ftp_passwd + "@" + (Purl + 6)).cstr_oneuse(); goto retry_get; } } diff --git a/package_db.cc b/package_db.cc index f0f46581..8d3446d1 100644 --- a/package_db.cc +++ b/package_db.cc @@ -26,7 +26,6 @@ static const char *cvsid = #include #include #include -#include "concat.h" #include "io_stream.h" #include "compress.h" @@ -143,9 +142,8 @@ packagedb::flush () * to keep cygcheck happy. */ sprintf (line, "%s %s %d\n", pkgm.name.cstr_oneuse(), - concat (pkgm.name.cstr_oneuse(), "-", - pkgm.installed->Canonical_version ().cstr_oneuse(), - ".tar.bz2", 0), 0); + (pkgm.name + "-" + pkgm.installed->Canonical_version () + + ".tar.bz2").cstr_oneuse(), 0); ndb->write (line, strlen (line)); } } diff --git a/package_meta.cc b/package_meta.cc index 65d0773e..8de7aac0 100644 --- a/package_meta.cc +++ b/package_meta.cc @@ -21,7 +21,6 @@ static const char *cvsid = "\n%%% $Id$\n"; #include #include #include -#include "concat.h" #include "io_stream.h" #include "compress.h" @@ -158,7 +157,7 @@ packagemeta::uninstall () { dirs.add_subdirs (line); - String d = cygpath ("/", line.cstr_oneuse(),0); + String d = cygpath (String ("/") + line); DWORD dw = GetFileAttributes (d.cstr_oneuse()); if (dw != INVALID_FILE_ATTRIBUTES && !(dw & FILE_ATTRIBUTE_DIRECTORY)) @@ -174,7 +173,8 @@ packagemeta::uninstall () && !(dw & FILE_ATTRIBUTE_DIRECTORY)) { log (LOG_BABBLE, String("unlink ") + d); - SetFileAttributes (d.cstr_oneuse(), dw & ~FILE_ATTRIBUTE_READONLY); + SetFileAttributes (d.cstr_oneuse(), + dw & ~FILE_ATTRIBUTE_READONLY); DeleteFile (d.cstr_oneuse()); } line = installed->getnextfile (); @@ -185,9 +185,9 @@ packagemeta::uninstall () char *subdir = 0; while ((subdir = dirs.enumerate (subdir)) != 0) { - String d = cygpath ("/", subdir,0); + String d = cygpath (String ("/") + subdir); if (RemoveDirectory (d.cstr_oneuse())) - log (LOG_BABBLE, String("rmdir ")+ d); + log (LOG_BABBLE, String("rmdir ") + d); } try_run_script ("/etc/postremove/", name); } diff --git a/postinstall.cc b/postinstall.cc index cca43c5d..f2a5b8ee 100644 --- a/postinstall.cc +++ b/postinstall.cc @@ -43,5 +43,5 @@ do_postinstall (HINSTANCE h, HWND owner) next_dialog = 0; init_run_script (); SetCurrentDirectory (get_root_dir ().cstr_oneuse()); - find (cygpath ("/etc/postinstall", 0), run_script_in_etc_postinstall); + find (cygpath ("/etc/postinstall"), run_script_in_etc_postinstall); } diff --git a/root.cc b/root.cc index bc1a23bd..d8aeba3d 100644 --- a/root.cc +++ b/root.cc @@ -188,7 +188,7 @@ RootPage::OnNext () NEXT (IDD_LOCAL_DIR); - log (LOG_TIMESTAMP, String ("root: ") + get_root_dir () + + log (LOG_PLAIN, String ("root: ") + get_root_dir () + (root_text == IDC_ROOT_TEXT ? " text" : " binary") + (root_scope == IDC_ROOT_USER ? " user" : " system")); diff --git a/script.cc b/script.cc index 9c13507c..faa1d03c 100644 --- a/script.cc +++ b/script.cc @@ -27,7 +27,6 @@ static const char *cvsid = #include #include #include "log.h" -#include "concat.h" #include "filemanip.h" #include "mount.h" #include "io_stream.h" @@ -49,7 +48,7 @@ init_run_script () { for (int i = 0; shells[i]; i++) { - sh = backslash (cygpath (shells[i],0).cstr_oneuse()); + sh = backslash (cygpath (shells[i])); if (_access (sh.cstr_oneuse(), 0) == 0) break; sh = String(); @@ -57,11 +56,9 @@ init_run_script () char old_path[_MAX_PATH]; GetEnvironmentVariable ("PATH", old_path, sizeof (old_path)); - SetEnvironmentVariable ("PATH", - backslash (cygpath ("/bin;", - get_root_dir ().cstr_oneuse(), "/usr/bin;", - old_path, 0)).cstr_oneuse()); - + SetEnvironmentVariable ("PATH", backslash (cygpath ("/bin") + ";" + + cygpath ("/usr/bin") + ";" + + old_path).cstr_oneuse()); SetEnvironmentVariable ("CYGWINROOT", get_root_dir ().cstr_oneuse()); verinfo.dwOSVersionInfoSize = sizeof (verinfo); @@ -112,34 +109,32 @@ run_script (String const &dir, String const &fname) if (sh.size() && strcmp (ext, ".sh") == 0) { - char *f2 = concat (dir.cstr_oneuse(), fname.cstr_oneuse(), 0); - log (LOG_TIMESTAMP, "running: %s -c %s", sh.cstr_oneuse(), f2); - run (sh.cstr_oneuse(), "-c", f2); - delete[] f2; + String f2 = dir + fname; + log (LOG_PLAIN, String ("running: ") + sh + " -c " + f2); + run (sh.cstr_oneuse(), "-c", f2.cstr_oneuse()); } else if (cmd && strcmp (ext, ".bat") == 0) { - char *f2 = backslash (cygpath (dir.cstr_oneuse(), fname.cstr_oneuse(),0)).cstr(); - log (LOG_TIMESTAMP, "running: %s /c %s", cmd, f2); - run (cmd, "/c", f2); - delete[] f2; + String f2 = backslash (cygpath (dir + fname)); + log (LOG_PLAIN, String ("running: ") + cmd + " /c " + f2); + run (cmd, "/c", f2.cstr_oneuse()); } else return; /* if file exists then delete it otherwise just ignore no file error */ - io_stream::remove (String ("cygfile://") + dir+ fname+ ".done"); + io_stream::remove (String ("cygfile://") + dir + fname + ".done"); - io_stream::move (String ("cygfile://")+ dir+ fname, - String ("cygfile://")+ dir+ fname+ ".done"); + io_stream::move (String ("cygfile://") + dir + fname, + String ("cygfile://") + dir + fname+ ".done"); } void try_run_script (String const &dir, String const &fname) { - if (io_stream::exists (String ("cygfile://")+ dir+ fname+ ".sh")) - run_script (dir.cstr_oneuse(), concat (fname.cstr_oneuse(), ".sh", 0)); - if (io_stream::exists (String ("cygfile://")+ dir+ fname+ ".bat")) - run_script (dir.cstr_oneuse(), concat (fname.cstr_oneuse(), ".bat", 0)); + if (io_stream::exists (String ("cygfile://")+ dir + fname + ".sh")) + run_script (dir.cstr_oneuse(), (fname + ".sh").cstr_oneuse()); + if (io_stream::exists (String ("cygfile://")+ dir + fname + ".bat")) + run_script (dir.cstr_oneuse(), (fname + ".bat").cstr_oneuse()); } diff --git a/site.cc b/site.cc index eede92eb..a28a78ef 100644 --- a/site.cc +++ b/site.cc @@ -32,7 +32,6 @@ static const char *cvsid = #include "state.h" #include "geturl.h" #include "msg.h" -#include "concat.h" #include "log.h" #include "io_stream.h" #include "site.h" @@ -298,7 +297,7 @@ SitePage::OnNext () // Log all the selected URLs from the list. for (size_t n = 1; n <= site_list.number (); n++) - log (LOG_TIMESTAMP, "site: %s", site_list[n]->url.cstr_oneuse()); + log (LOG_PLAIN, String ("site: ") + site_list[n]->url); Progress.SetActivateTask (WM_APP_START_SETUP_INI_DOWNLOAD); return IDD_INSTATUS; @@ -415,7 +414,7 @@ bool SitePage::OnMessageCmd (int id, HWND hwndctl, UINT code) else { // Log the adding of this new URL. - log (LOG_BABBLE, "Adding site: %s", other_url.cstr_oneuse()); + log (LOG_BABBLE, String ("Adding site: ") + other_url); } // Assume the user wants to use it and select it for him. diff --git a/source.cc b/source.cc index ef434196..335061ce 100644 --- a/source.cc +++ b/source.cc @@ -118,7 +118,7 @@ SourcePage::OnBack () void SourcePage::OnDeactivate () { - log (LOG_TIMESTAMP, "source: %s", - (source == IDC_SOURCE_DOWNLOAD) ? "download" : - (source == IDC_SOURCE_NETINST) ? "network install" : "from cwd"); + log (LOG_PLAIN, String ("source: ") + + ((source == IDC_SOURCE_DOWNLOAD) ? "download" : + (source == IDC_SOURCE_NETINST) ? "network install" : "from cwd")); } -- 2.43.5