From ffb51792be5170751cf581b1e9309d15a0d480a4 Mon Sep 17 00:00:00 2001 From: Benjamin Staneck Date: Mon, 14 Aug 2017 23:19:44 +0200 Subject: [PATCH 01/13] add appveyor CI --- .appveyor.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .appveyor.yml diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 000000000..3c60f9c92 --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,24 @@ +environment: + matrix: + - TOOLSET: vs2015 + +os: Visual Studio 2015 + +shallow_clone: true + +install: + # Download Premake + - ps: Start-FileDownload 'https://github.com/premake/premake-core/releases/download/v5.0.0-alpha8/premake-5.0.0-alpha8-windows.zip' 'premake.zip' + + # Extract it in-place; premake5.exe is at the top level. + - 7z x premake.zip + + # Generate solution files using premake. + - premake5.exe %TOOLSET% + +configuration: + - Debug + - Release + +build: + project: .build/$(TOOLSET)/clink.sln \ No newline at end of file From d3a8d73320d34b93db7abc38ef2f70641eac0d7c Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 9 Jul 2017 03:23:36 -0500 Subject: [PATCH 02/13] fix premake config for 5.0alpha11+ * for premake 5.0alpha11, 'flags("Symbols")' became deprecated, replaced by the new symbols() API --- README.md | 2 +- premake5.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index acd57453e..931e3dcd8 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ Clink can be extended through its Lua API which allows easy creation context sen ### Building Clink -Clink's uses [Premake](http://premake.github.io) to generate Visual Studio solutions or makefiles for MinGW. Note that Premake >= 5.0-alpha8 is required. +Clink's uses [Premake](http://premake.github.io) to generate Visual Studio solutions or makefiles for MinGW. Note that Premake >= 5.0-alpha11 is required. 1. Cd to your clone of Clink. 2. Run "premake <toolchain>" (where "<toolchain>" is one of Premake's actions - see "premake --help") diff --git a/premake5.lua b/premake5.lua index ab547e715..25cd1089b 100644 --- a/premake5.lua +++ b/premake5.lua @@ -115,7 +115,7 @@ solution("clink") location(to) characterset("MBCS") - flags("Symbols") + symbols "on" flags("StaticRuntime") defines("HAVE_CONFIG_H") defines("HANDLE_MULTIBYTE") From 5ebc4a645388bd53369595a0019f81aa2a6ed3c1 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 9 Jul 2017 03:09:42 -0500 Subject: [PATCH 03/13] add support for symbolically linked readline config files * fixes #461 * ref/see also: --- readline/readline/bind.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readline/readline/bind.c b/readline/readline/bind.c index 4c898a699..b53ff3c08 100644 --- a/readline/readline/bind.c +++ b/readline/readline/bind.c @@ -776,7 +776,7 @@ _rl_read_file (filename, sizep) char *buffer; int i, file; - if ((stat (filename, &finfo) < 0) || (file = open (filename, O_RDONLY, 0666)) < 0) + if (((file = open (filename, O_RDONLY, 0666)) < 0) || (fstat (file, &finfo) < 0)) return ((char *)NULL); file_size = (size_t)finfo.st_size; From f5c127783b7f2233395dc72288b75d8d8eb5d9b8 Mon Sep 17 00:00:00 2001 From: Benjamin Staneck Date: Mon, 14 Aug 2017 23:28:04 +0200 Subject: [PATCH 04/13] update to premake5-alpha11 --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index 3c60f9c92..014124735 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -8,7 +8,7 @@ shallow_clone: true install: # Download Premake - - ps: Start-FileDownload 'https://github.com/premake/premake-core/releases/download/v5.0.0-alpha8/premake-5.0.0-alpha8-windows.zip' 'premake.zip' + - ps: Start-FileDownload 'https://github.com/premake/premake-core/releases/download/v5.0.0-alpha11/premake-5.0.0-alpha11-windows.zip' 'premake.zip' # Extract it in-place; premake5.exe is at the top level. - 7z x premake.zip From c70dd251d378023fe263eaaaa645034ffa7e1a01 Mon Sep 17 00:00:00 2001 From: Benjamin Staneck Date: Mon, 14 Aug 2017 23:43:14 +0200 Subject: [PATCH 05/13] let appveyor create a zip --- .appveyor.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index 014124735..0abe9f2f8 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,3 +1,4 @@ +version: 0.4.9-{build} environment: matrix: - TOOLSET: vs2015 @@ -6,6 +7,9 @@ os: Visual Studio 2015 shallow_clone: true +matrix: + fast_finish: true + install: # Download Premake - ps: Start-FileDownload 'https://github.com/premake/premake-core/releases/download/v5.0.0-alpha11/premake-5.0.0-alpha11-windows.zip' 'premake.zip' @@ -21,4 +25,15 @@ configuration: - Release build: - project: .build/$(TOOLSET)/clink.sln \ No newline at end of file + project: .build/$(TOOLSET)/clink.sln + +artifacts: + - path: .build\$(TOOLSET)\bin\$(configuration)\ + type: zip + name: clink_0.4.9 + + # - path: clink_0.4.9-{build}_pdb.zip + # name: clink_0.4.9-{build}_pdb.zip + + # - path: clink_0.4.9-{build}_setup.exe + # name: clink_0.4.9-{build}_setup.exe From 5bfc04a9c52b2daa67be401c9bcfe29ca4721e75 Mon Sep 17 00:00:00 2001 From: Benjamin Staneck Date: Tue, 15 Aug 2017 00:19:41 +0200 Subject: [PATCH 06/13] version the zip name --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index 0abe9f2f8..bdfb117d5 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -30,7 +30,7 @@ build: artifacts: - path: .build\$(TOOLSET)\bin\$(configuration)\ type: zip - name: clink_0.4.9 + name: clink_$(APPVEYOR_BUILD_VERSION) # - path: clink_0.4.9-{build}_pdb.zip # name: clink_0.4.9-{build}_pdb.zip From 4217e6defd3914e338c3597c168f88ae54111e51 Mon Sep 17 00:00:00 2001 From: Faheem Pervez Date: Thu, 13 Jul 2017 02:14:09 +0100 Subject: [PATCH 07/13] Fix testing for an alias's existence with Win 10's newer Conhost --- clink/dll/doskey.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clink/dll/doskey.c b/clink/dll/doskey.c index 5147f1ec7..f69ed264b 100644 --- a/clink/dll/doskey.c +++ b/clink/dll/doskey.c @@ -185,8 +185,8 @@ int begin_doskey(wchar_t* chars, unsigned max_chars) exe = wcsrchr(exe_path, L'\\'); exe = (exe != NULL) ? (exe + 1) : exe_path; - // Check it exists. - if (!GetConsoleAliasW(alias, exe_path, 1, exe)) + // Check it exists. (ERROR_NOT_FOUND is set when an alias is, well, not found) + if (!GetConsoleAliasW(alias, exe_path, sizeof(wchar_t), exe) && GetLastError() != ERROR_INSUFFICIENT_BUFFER) return 0; // It does. Allocate space and fetch it. From 559ebd0f2319abb418500f0d0765d95fefe61560 Mon Sep 17 00:00:00 2001 From: Benjamin Staneck Date: Wed, 16 Aug 2017 18:35:38 +0200 Subject: [PATCH 08/13] Use clink_release instead of building manually. --- .appveyor.yml | 23 ++++++----------------- installer/premake5.lua | 2 +- premake5.lua | 6 +++--- 3 files changed, 10 insertions(+), 21 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index bdfb117d5..f92e9469f 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,11 +1,9 @@ version: 0.4.9-{build} environment: matrix: - - TOOLSET: vs2015 + - TOOLSET: vs2017 -os: Visual Studio 2015 - -shallow_clone: true +os: Visual Studio 2017 matrix: fast_finish: true @@ -21,19 +19,10 @@ install: - premake5.exe %TOOLSET% configuration: - - Debug - Release -build: - project: .build/$(TOOLSET)/clink.sln - -artifacts: - - path: .build\$(TOOLSET)\bin\$(configuration)\ - type: zip - name: clink_$(APPVEYOR_BUILD_VERSION) - - # - path: clink_0.4.9-{build}_pdb.zip - # name: clink_0.4.9-{build}_pdb.zip +build_script: + - premake5.exe clink_release - # - path: clink_0.4.9-{build}_setup.exe - # name: clink_0.4.9-{build}_setup.exe +after_build: + - ps: Get-ChildItem .build\release\**\*.zip | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } diff --git a/installer/premake5.lua b/installer/premake5.lua index 0192649cd..d809fc2f2 100644 --- a/installer/premake5.lua +++ b/installer/premake5.lua @@ -138,7 +138,7 @@ newaction { local x64_ok = true; local toolchain = "ERROR" if have_msbuild then - toolchain = _OPTIONS["clink_vs_ver"] or "vs2013" + toolchain = _OPTIONS["clink_vs_ver"] or "vs2017" exec(premake .. " --clink_ver=" .. clink_ver .. " " .. toolchain) ret = exec("msbuild /m /v:q /p:configuration=release /p:platform=win32 .build/" .. toolchain .. "/clink.sln") diff --git a/premake5.lua b/premake5.lua index 25cd1089b..aeb59bebf 100644 --- a/premake5.lua +++ b/premake5.lua @@ -39,15 +39,15 @@ function get_last_git_commit() return line:sub(1, 6) end - return "?" + return "unknown" end -------------------------------------------------------------------------------- function useXpToolset(base, cfg) local p = "v110_xp" if _ACTION > "vs2012" then - p = "v120_xp" - end + p = "v141_xp" + end if _ACTION > "vs2010" then _p(2,'%s', p) From c67589f039fc5c3ce8a17d8a44f602e4469872d3 Mon Sep 17 00:00:00 2001 From: Benjamin Staneck Date: Wed, 16 Aug 2017 21:07:49 +0200 Subject: [PATCH 09/13] add NSIS folder to the environment and add nsis installer to artifacts --- .appveyor.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index f92e9469f..ad8889e1a 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,10 +1,9 @@ version: 0.4.9-{build} environment: matrix: - - TOOLSET: vs2017 + - TOOLSET: vs2017 os: Visual Studio 2017 - matrix: fast_finish: true @@ -15,6 +14,9 @@ install: # Extract it in-place; premake5.exe is at the top level. - 7z x premake.zip + ## Add NSIS to PATH + - cmd: set PATH=%PATH%;C:\Program Files (x86)\NSIS\; + # Generate solution files using premake. - premake5.exe %TOOLSET% @@ -26,3 +28,7 @@ build_script: after_build: - ps: Get-ChildItem .build\release\**\*.zip | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } + +artifacts: + - path: installer/clink.nsi + name: clink \ No newline at end of file From 96d1a6194284a55a0c088c904ec064c1e526973e Mon Sep 17 00:00:00 2001 From: Benjamin Staneck Date: Wed, 16 Aug 2017 22:07:58 +0200 Subject: [PATCH 10/13] publish .exe installer instead of .nsi --- .appveyor.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index ad8889e1a..94f55bd58 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -26,9 +26,10 @@ configuration: build_script: - premake5.exe clink_release -after_build: - - ps: Get-ChildItem .build\release\**\*.zip | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } - artifacts: - - path: installer/clink.nsi - name: clink \ No newline at end of file + - path: .build/release/**/clink_DEV.zip + name: clink_DEV + - path: .build/release/**/clink_DEV_pdb.zip + name: clink_DEV_pdb + - path: .build/release/**/clink_DEV_setup.exe + name: clink_DEV_setup From ca4868714356b237bc04249c662d48c563cbbe60 Mon Sep 17 00:00:00 2001 From: Dan Johnston Date: Mon, 1 Jul 2019 21:12:51 -0700 Subject: [PATCH 11/13] Enable VT processing on stdout Not sure if there is a minimum Windows version, but this is needed on newer versions of Windows 10 (1903+) with the new Windows Terminal application. --- clink/dll/rl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clink/dll/rl.c b/clink/dll/rl.c index fd8b6e832..027875eb0 100644 --- a/clink/dll/rl.c +++ b/clink/dll/rl.c @@ -507,7 +507,8 @@ static char* call_readline_impl(const char* prompt) // Make sure that EOL wrap is on. Readline's told the terminal supports it. { - int stdout_flags = ENABLE_PROCESSED_OUTPUT|ENABLE_WRAP_AT_EOL_OUTPUT; + int stdout_flags = ENABLE_PROCESSED_OUTPUT|ENABLE_WRAP_AT_EOL_OUTPUT| + ENABLE_VIRTUAL_TERMINAL_PROCESSING; HANDLE handle_stdout = GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleMode(handle_stdout, stdout_flags); } From 3190bd25dbd85f1c24065dd037dd04208c6e99e4 Mon Sep 17 00:00:00 2001 From: Dan Johnston Date: Tue, 2 Jul 2019 14:48:31 -0700 Subject: [PATCH 12/13] Better fix for keeping VT processing enabled. Don't clobber previous console mode flags. Just ensure that the ones we need are set. This preserves VT_ENABLE_PROCESSING that is set by the host cmd.exe by default. --- clink/dll/rl.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/clink/dll/rl.c b/clink/dll/rl.c index 027875eb0..114bd210d 100644 --- a/clink/dll/rl.c +++ b/clink/dll/rl.c @@ -507,10 +507,11 @@ static char* call_readline_impl(const char* prompt) // Make sure that EOL wrap is on. Readline's told the terminal supports it. { - int stdout_flags = ENABLE_PROCESSED_OUTPUT|ENABLE_WRAP_AT_EOL_OUTPUT| - ENABLE_VIRTUAL_TERMINAL_PROCESSING; + int stdout_flags = ENABLE_PROCESSED_OUTPUT|ENABLE_WRAP_AT_EOL_OUTPUT; + int oldstdout_flags = 0; HANDLE handle_stdout = GetStdHandle(STD_OUTPUT_HANDLE); - SetConsoleMode(handle_stdout, stdout_flags); + GetConsoleMode(handle_stdout, &oldstdout_flags); + SetConsoleMode(handle_stdout, stdout_flags|oldstdout_flags); } // Initialisation From e2e692c0bb01bb50217d4a8f59076f1cd6fbd55f Mon Sep 17 00:00:00 2001 From: Benjamin Staneck Date: Fri, 24 Jul 2020 18:30:40 +0200 Subject: [PATCH 13/13] fix crash after upgrade to latest windows 10 --- clink/dll/doskey.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clink/dll/doskey.c b/clink/dll/doskey.c index f69ed264b..e0ba63c6f 100644 --- a/clink/dll/doskey.c +++ b/clink/dll/doskey.c @@ -73,7 +73,7 @@ int continue_doskey(wchar_t* chars, unsigned max_chars) { wchar_t* read = g_state.alias_next; - if (g_state.alias_text == NULL) + if (g_state.alias_text == NULL || read == NULL) return 0; if (*read == '\0')