aboutsummaryrefslogtreecommitdiff
path: root/include/mingw.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* win32: retry when command needs elevated privilegesRon Yorston2025-02-031-0/+1
| | | | | | | | | | | | | | Some installer programs have an entry in their manifest to indicate that they need elevated privileges. The shell in busybox-w32 was unable to run such programs. When a program fails to run with ERROR_ELEVATION_REQUIRED, try again using ShellExecuteEx() with the 'runas' verb to give it elevated privileges. Adds 272-288 bytes. (GitHub issue #481)
* ash: match behaviour of cmd.exe in cd builtinRon Yorston2024-11-191-0/+1
| | | | | | | | | | | | | | The Windows API strips trailing dots and spaces from the last component of a path. cmd.exe handles this quirk when changing directory by adjusting its idea of the current directory to match reality. The shell in busybox-w32 didn't do this, leading to some confusion. Fix the shell's cd builtin so it works more like cmd.exe. Adds 64-80 bytes. (GitHub issue #478)
* Use builtin ffs also with GCCChristopher Wellons2024-09-211-1/+1
| | | | | | | | With CONFIG_DEBUG_PESSIMIZE=y (-O0) the ffs intrinsic is left as a function call, resulting in a linker error. The prefixed builtin is generally part of the "GNU C" dialect and is usable in any "GNU C" implementation, i.e. any compiler that defines __GNUC__. That includes Clang, GCC, and more.
* ash: optimise running of scripts (2)Ron Yorston2024-09-041-0/+1
| | | | | | | | | | | | | | | | | Commit 4b7b4a960 (ash: optimise running of scripts) avoided creation of a process when running a script. There's another case where we can do the same: if the script is being run from a FS_SHELLEXEC shell. - Check the necessary conditions for this to happen. - Allocate two extra slots in the argv array for FS_SHELLEXEC. - Set the index of the script file in the argv array. Without this the test 'pidof this' failed because the command name hadn't been correctly set. Adds 80-96 bytes.
* ash: optimise running of scriptsRon Yorston2024-08-191-0/+8
| | | | | | | | | | | | | | | | | | | | | | The BusyBox shell detects certain cases where forking a command is unnecessary (last command in a script or subshell, for example) and calls execve(2) instead. This doesn't help in the Windows port because execve(2) is implemented by creating a process. There is one case where it is possible to apply this optimisation: if the command is a script and the script interpreter is an applet. - Have evalcommand() pass a flag to indicate this situation to shellexec(). Also, allocate two spare elements before the start of the argv array. - If the flag is TRUE shellexec() passes the shell's PATH variable down to tryexec() so it can perform a test for applet override. - If tryexec() finds that all the necessary conditions apply it can run a script by directly invoking the interpreter's main(). Adds 192-224 bytes.
* win32: code shrinkRon Yorston2024-08-161-17/+17
| | | | | Add the FAST_FUNC qualifier to several Windows-specific functions. This has no effect in 64-bit builds but saves 336 bytes for 32-bit.
* win32: use 64-bit time on 32-bit platformsRon Yorston2024-08-141-0/+14
| | | | | | | | | | | | | | | | | | To avoid problems with dates in 2038 and beyond use 64-bit time values on 32-bit platforms. - Mostly this just requires a few preprocessor macros to choose the appropriate functions, structs and typedefs. - We have our own implementations of nanosleep(), clock_gettime() and clock_settime(). Omit the Windows include file that declares them. - Apply the hack for struct timeval in the 'ts' applet on 32-bit. Adds 1624 bytes on 32-bit, none on 64-bit. (GitHub issue #446)
* su: detect inability to raise privilegeRon Yorston2024-08-031-0/+5
| | | | | | | | | | | | When privilege has been dropped by the 'drop' applet, the 'su' applet is unable to raise it again because ShellExecuteEx() thinks it unnecessary. Detect this situation, report an error and return exit code 2. Costs 72-112 bytes. (GitHub issue #437)
* ash: read profile script relative to binaryRon Yorston2024-07-081-0/+1
| | | | | | | As well as trying to read '/etc/profile' also look for the script 'etc/profile' relative to the location of the running binary. Adds 64-96 bytes.
* win32: code shrink system drive handlingRon Yorston2024-07-071-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | A previous commit (e3bfe3695) revised the use of getsysdir() to obtain the system directory, and hence the system drive. See the commit message for the history to that point. Further improvements are possible: - Remove getsysdir() and push the calls to GetSystemDirectory() down into get_system_drive() and get_proc_addr(). - Check the return value of GetSystemDirectory(). It's unlikely to fail, but better safe than sorry. - Instead of making all callers of get_system_drive() check for a NULL return value always return a non-NULL pointer. If the drive can't be found an empty string is returned instead (which is what the callers were using anyway). - The function need_system_drive() was only used in one place (in httpd). Move the code there and remove the function. - Use concat_path_file() where possible. Saves 76-144 bytes.
* win32: add env var to control error dialogsRon Yorston2024-06-221-0/+1
| | | | | | | | | | | | | | | If the environment variable BB_CRITICAL_ERROR_DIALOGS is set to 1 critical error dialogs are enabled. If unset or set to any other value they aren't. In either case the error messages introduced by commit 790e37727 (win32: revert 'don't set error mode') are issued. The shell exports BB_CRITICAL_ERROR_DIALOGS to the environment immediately on any change so the setting takes effect at once. Adds 104-160 bytes. (GitHub issue #423)
* win32: allow for trailing separator in PATHRon Yorston2024-06-141-0/+1
| | | | | | | | | | | | | | | | | | | In recent versions of Windows the PATH environment variable has a trailing semicolon. This is insignificant to Windows because it's ignored. busybox-w32 conforms to the POSIX interpretation of PATH which treats an empty path element as denoting the current directory. As result, on these versions of Windows executables may by default be run from the current directory, contrary to usual Unix practice. Attempt to detect and remove the trailing semicolon on applet start up. If the user insists, they can add a trailing semicolon to the shell variable PATH and it will be respected in the conventional manner. Adds 88-112 bytes. (GitHub issue #422)
* win32: implement getppid(2)Ron Yorston2024-05-161-1/+1
| | | | | | | | | | | | | | busybox-w32 had a dummy implementation of getppid(2) which always returned 1. Provide a more realistic version. The effect is limited: - The PPID shell variable should report a sensible value. - The special value to omit the parent PID 'pidof -o %PPID' should work. Costs 48 bytes.
* kill: killing a zombie process should failRon Yorston2024-05-141-1/+0
| | | | | | | | | | | | | | | | | | | | | | | A process which has exited may still have its process handle held open by its children. Such a process doesn't appear in the process table. It is thus similar to a zombie process in UNIX. Using kill(1) to interact with such a process was seen to succeed, contrary to expectation. The code for "ordinary" signals in kill(2) did check if the process was still active but didn't treat an attempt to kill an inactive process as an error. Furthermore, sending SIGKILL or the fake signal 0 to a process didn't even check if the process was still active. Rearrange the implementation of kill(2) so that an attempt to signal an inactive process is treated as an error. This also consolidates handling of SIGKILL and signal 0 with "ordinary" signals. Saves 96 bytes. (GitHub issue #416)
* ash: add title built-inRon Yorston2024-04-091-0/+1
| | | | | | | | | | | | | | Implement a 'title' built-in for ash. It's very simple-minded, performs almost no error checking and is completely non-portable. - With no arguments it prints the current console title. - If arguments are provided the *first only* is set as the console title. Costs 88-116 bytes. (GitHub issue #401)
* win32: fix clang error/warningRon Yorston2023-12-311-0/+4
| | | | | | | | | | | | Since clang doesn't seem to know about ffs(3) make it use __builtin_ffs() instead. Fix a warning in process_escape() in winansi.c: result of comparison of constant -1 with expression of type 'WORD' (aka 'unsigned short') is always true. Change the error value returned by process_colour() from -1 to 0xffff. Costs 16 bytes.
* httpd: enable support for CGIRon Yorston2023-12-201-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | The upstream code uses fork/exec when running a CGI process. Emulate this by: - Spawning a child httpd process with the special '-I 0' option, along with the options provided on the server command line. This sets up the proper state then calls the cgi_handler() function. - The cgi_handler() function fixes the pipe file descriptors and starts another child process to run the CGI script. These processes are detached from the console on creation. When spawn() functions are run in P_DETACH mode they don't connect to the standard file descriptors. Normally this doesn't matter but the process which runs the CGI scripts needs to inherit the pipe endpoints. The create_detached_process() function handles this. See: https://github.com/rprichard/win32-console-docs/blob/master/README.md Adds about 2.9Kb to the size of the binary. (GitHub issue #266)
* httpd: fix return code when run in backgroundRon Yorston2023-12-151-1/+1
| | | | | | | | | | | When httpd was run in the background the return code of the parent process was incorrect. It seems when spawn() is run in _P_DETACH mode it returns 0 on success, not a process handle. Fix the test for the return code and alter mingw_spawn_detach() so it doesn't treat the return from spawn() as a handle. Saves 32 bytes.
* win32: only search PATH for compressorRon Yorston2023-11-141-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | mingw_fork_compressor() uses CreateProcess() to run the compressor program. This will often be an instance of BusyBox, but since the xv and lzma applets in BusyBox don't support compression it can be an external program. It was intended that the external program should be found using PATH. However, CreateProcess() looks in various other places before trying PATH. In particular, it first looks in the directory of the current executable, then in the current directory of the process. This can result in the wrong xz.exe or lzma.exe being found. Perform an explicit PATH search and force CreateProcess() to use the result. This change only affects the search for a compressor. The same problem also affects other uses of our popen(3) emulation. These may be addressed in future. Costs 64-80 bytes. (GitHub issue #376)
* sort: add support for sorting version stringsRon Yorston2023-10-011-0/+1
| | | | | | | | | | | Add an implementation of strverscmp from musl so that the 'sort -V' option works. Add '-V' to the trivial usage message. Costs 248-256 bytes. (GitHub issue #370)
* win32: convert exit codesRon Yorston2023-09-141-0/+2
| | | | | | | | | | | | | | | | | Add two utility functions to convert Windows process exit codes. - exit_code_to_wait_status() converts to a POSIX wait status. This is used in ash and the implementations of system(3) and mingw_wait3(). - exit_code_to_posix() converts to a POSIX exit code. (Not that POSIX has much to say about them.) As a result it's possible for more applets to report when child processes are killed as if by a signal. 'time', 'drop' and 'su -W', for example. Adds 64-80 bytes.
* win32: replace readlink(2)Ron Yorston2023-08-211-1/+0
| | | | | | | | | | | | | | | The Windows implementation of readlink(2) has caused problems in the past. As, for example, with commit c29dc205d2 (win32: fix implementation of readlink(2)). Most uses of readlink(2) in BusyBox are actually calls to the (considerably more convenient) library function xmalloc_readlink(). Implement a Windows version of that and used it instead of readlink(2). This improves the handling of symbolic links (and similar reparse points) in CJK and UTF-8 code pages. Saves 48-80 bytes.
* ash: detect console state on shell start upnoconsole2Ron Yorston2023-08-201-1/+0
| | | | | | | | | | | Set 'noconsole' to match the actual state of the console (normal/ iconified) when the shell is started. Thus ShowWindow() will only be called if the actual state differs from the default or user defined state. Costs 20-24 bytes. (GitHub issue #325)
* win32: support build with FEATURE_UNICODE_SUPPORTAvi Halachmi (:avih)2023-07-221-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | FEATURE_UTF8_MANIFEST enables Unicode args and filenames on Win 10+. FEATURE_UTF8_INPUT allows the shell prompt to digest correctly Unicode strings (as UTF8) which are typed or pasted. This commit adds support for building with FEATURE_UNICODE_SUPPORT (mostly by supporting 32 bit wchar_t which busybox expects): - Unicode-aware line-edit - for the most part cursor movement/del being (UTF8) codepoint-aware rather than assuming that one-byte equals one-char-on-screen. - Codepoint-aware operations in some other utils, like rev or wc -c. - When UNICODE_COMBINING_WCHARS and UNICODE_WIDE_WCHARS are enabled, some screen-width-aware operations, like with fold, ls, expand, etc. The busybox Unicode support is incomplete, and even less so with the builtin libc replacement functions, like wcwidth, which are active when UNICODE_USING_LOCALE is unset (mingw lacks those functions). FEATURE_CHECK_UNICODE_IN_ENV should be set so that Unicode is not hardcoded but rather depends on the ANSI codepage and some env vars: LC_ALL=C disables Unicode support, else it's enabled if ACP is UTF8. There's at least one known issue where the tab-completion-prefix-case is not updated correctly, e.g. ~/desk<tab> completes to ~/desktop/ instead of ~/Desktop/, because the code which handles it exists only at the non-unicode code paths, but that's not very critical. That seems to be the only case where mingw-specific code is disabled when Unicode is enabled, but there could be other unknown issues. None of the Unicode options is enabled by default, and the next commit will make it easier to create a build which supports Unicode.
* date: allow system date to be setRon Yorston2023-07-161-0/+1
| | | | | | | | | Implement clock_settime(2) and enable the '-s' option to allow the system time to be set. This requires elevated privileges. The code in date.c is now identical to upstream BusyBox. Costs 256-272 bytes.
* ash: properly echo console input to 'read' built-inRon Yorston2023-07-121-0/+1
| | | | | | | The 'read' shell built-in echoed console input to stdout. Echo directly to the console instead. Costs 124-136 bytes.
* win32: more console input character conversionsRon Yorston2023-07-071-0/+5
| | | | | | | | | | | | | Add wrappers for the following input functions with conversions for console input. Applications suitable for testing these changes are appended in brackets. - getchar (xargs) - fgetc (tac) - getline (shuf) - fgets (rev) Costs 112-120 bytes.
* win32: character conversion for fread(3)Ron Yorston2023-07-061-0/+2
| | | | | | | Some applets use fread(3): dd and od, for example. Perform the necessary conversion when input is coming from the console. Costs 96-112 bytes.
* win32: the great UTF8 ReadConsoleInput hackAvi Halachmi (:avih)2023-06-281-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since commit 597d31ee (EURO_INPUT), ReadConsoleInputA is the default. The main problem with that is that if the console codepage is UTF8, e.g. after "chcp 65001", then typing or pasting can result in a crash of the console itself (the Windows Terminal or cmd.exe window closes). Additionally and regardless of this crash, ReadConsoleInputA is apparently buggy with UTF8 CP also otherwise. For instance, on Windows 7 only ASCII values work - others become '?'. Or sometimes in Windows 10 (cmd.exe console but not Windows terminal) only key-up events arrive for some non-ASCII codepoints (without a prior key-down), and more. So this commit implements readConsoleInput_utf8 which delivers UTF8 Regardless of CP, including of surrogate pairs, and works on win 7/10. Other than fixing the crash and working much better with UTF8 console CP, it also allows a build with the UTF8 manifest to capture correctly arbitrary unicode inputs which are typed or pasted into the console regardless of the console CP. However, it doesn't look OK unless the console CP is set to UTF8 (which we don't do automatically, but the user can chcp 65001), and editing is still lacking due to missing screen-length awareness. To reproduce the crash: start a new console window, 'chcp 65001', run this program (or busybox sh), and paste "ಀ" or "😀" (U+0C80, U+1F600) #include <windows.h> int main() { HANDLE h = GetStdHandle(STD_INPUT_HANDLE); INPUT_RECORD r; DWORD n; while (ReadConsoleInputA(h, &r, 1, &n)) /* NOP */; return 0; }
* win32: don't assume console CP equals OEM CPAvi Halachmi (:avih)2023-06-281-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, console input was converted to the ANSI codepage using OemToChar[Buff], and ANSI to console conversion used CharToOem[Buff]. However, while typically true by default, it's not guaranteed that the console CP is the same as the OEM CP. Now the code uses the console input/output CP as appropriate instead of the OEM CP. It uses full wide-char conversion code, which was previously limited to FEATURE_EURO, and now may be used also otherwise. While at it, the code now bypasses the conversion altogether if the src/dst CPs happen to be identical - which can definitely happen. Other than saving some CPU cycles, this also happens to fix an issue with the UTF8 manifest (in both input and output), because apparently the Oem/Char conversion APIs fail to convert one char at a time (which is not a complete UTF8 codepoint sequence) even if both the OEM and the ANSI CPs are UTF8 (as is the case when using UTF8 manifest). Conversion is also skipped: - if the converted output would be longer than the input; - if the input length is 1 and the input is multi-byte.
* Fixes for old mingw-w64Ron Yorston2023-06-141-1/+5
| | | | | | | | | | | | | Allow current busybox-w32 to build with the CentOS 6 version of mingw-w64. - Fix declaration of setlinebuf(). (GitLab issue 116) - Define ENABLE_VIRTUAL_TERMINAL_INPUT. (GitLab issue 117) - Define IO_REPARSE_TAG_APPEXECLINK. - Avoid a compiler warning in coreutils/shuf.c.
* win32: fix euro symbol handlingRon Yorston2023-06-021-0/+5
| | | | | | | | | | | | Commit 2b4dbe5fa (libbb: speed up bb_get_chunk_from_file()) speeded up grep by a factor of two. However, it introduced a call to OemToCharBuff() in bb_get_chunk_from_file() which didn't have the fix for the euro symbol from commit 93a63809f9 (win32: add support for the euro currency symbol). Export the fixed version of OemToCharBuff() and use it. Saves 8 bytes (64-bit), adds 28 bytes (32-bit)
* ash: enable 'set -/+o noconsole'Ron Yorston2023-06-011-1/+1
| | | | | | | | | | | | | | Previously the 'noconsole' shell option could only be set as a shell command line option. Allow it to be changed from within the shell by 'set -o noconsole' or 'set +o noconsole'. The console window is now minimised rather than hidden. This makes it easier for the user to access the console when 'noconsole' is in effect. Adds 8-32 bytes. (GitHub issue #325)
* win32: crtl-c interrupts non-console applicationsRon Yorston2023-05-231-0/+1
| | | | | | | | | | | | | | | | | | | Commit 9db9b34ad (win32: ignore ctrl-c in parent of execve(2)) prevented a parent process from reacting to Ctrl-C while it was waiting for its child to complete. This avoids the problem where a shell and an interactive child end up competing for input after a Ctrl-C. However, a child process which isn't attached to the console (a GUI application, for example) can't then be killed by Ctrl-C. Instead of completely ignoring Ctrl-C give the parent a handler which detects if its child is attached to the console. If so it's left to handle Ctrl-C itself and the parent ignores the interrupt. If not the parent terminates the child and all its children as if by SIGINT. Costs 200 bytes.
* win32: changes to signal handlingRon Yorston2023-05-231-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Use an exit code of the form (signal << 24) when a process exits due to a signal. This replaces the previous use of (signal + 128). This makes it easier to distinguish exit codes from signals. Allow kill(2) to handle all defined signals, not just EXIT, TERM and KILL. The kill and timeout applets now accept any defined signals. Convert certain Windows status codes Unix-style signal codes. In ash: - Exit as if with SIGINT in raise_interrupt() rather than call raise(SIGINT). The latter returns an exit code of 3. - Detect if a child process exits as if with SIGINT. If not and if the parent is an interactive top-level shell, reset pending_int. This prevents the parent from seeing an INT if the child hasn't reported it exited due to INT. (Probably due to it being an interactive shell.) Costs 132-136 bytes.
* win32: code shrink copying of argvRon Yorston2023-04-281-0/+1
| | | | | | | There are two places where a copy of an argv array is made with extra space at the start. Move this code into a function. Saves 56-64 bytes.
* win32: export xappendword()Ron Yorston2023-04-231-0/+1
| | | | | | | Export the function xappendword() from make. Use it in drop and watch. Saves 8-80 bytes, an unusually large disparity.
* win32: case-sensitivity in tab completionRon Yorston2023-04-191-1/+0
| | | | | | | | | | | | | | | | | | The tab-completion code treated all matches as case-insensitive because that's how Microsoft Windows handles filenames. This is now inadequate, as shell builtins, functions and aliases are case sensitive. Modify the treatment of case-sensitivity in tab completion: - Track whether each potential match is case-insensitive (filename) or case-sensitive (shell builtin, function or alias). - When comparing matches use a case-insensitive comparison if either value is a filename. Otherwise use a case-sensitive comparison. Adds 64 bytes.
* win32: add fake HUP and QUIT signalsRon Yorston2023-04-031-0/+2
| | | | | | | | | | | It's fairly common for shell scripts to trap this set of signals: EXIT HUP INT QUIT TERM (or the numeric equivalent: 0 1 2 3 15) Add definitions for SIGHUP and SIGQUIT. We don't take any action if traps are defined for them, but at least scripts won't fail. (GitHub issue #303)
* win32: delay adjusting code pageRon Yorston2023-03-171-1/+0
| | | | | | | | | | | Commit 93a63809f9 (win32: add support for the euro currency symbol) caused all invocations of busybox-w32 to change code page 850 to 858. This has been known to cause problems with fonts in PowerShell (GitHub issue #207). Delay changing the code page until an i/o operation is imminent. Instances of PowerShell started by the `drop` applet during ssh login thus no longer have their code page adjusted.
* runuser: add 'drop' as an alias for runuserRon Yorston2023-03-161-0/+1
| | | | | | | | | | | | | | | | | | | The 'drop' alias for 'runuser' relaxes a number of constraints that were introduced for compatibility: - It works even if the current process doesn't have elevated privileges. - It isn't necessary to specify the name of the user. - Any command can be invoked, not just the BusyBox shell. - If the command doesn't specify a path 'drop' will first look for a BusyBox applet then search PATH. Adds 320-336 when built along with runuser. (GitHub issue #240)
* win32: code shrink detection of executablesRon Yorston2023-03-161-1/+2
| | | | | | | | | | | | Add a function, file_is_win32_exe(), to detect if a path refers to an executable. It tries adding extensions if necessary. Use this in a number of places to replace common code of the form path = alloc_ext_space(cmd); if (add_win32_extension(path) || file_is_executable(path)) Saves 32-48 bytes.
* runuser: new appletRon Yorston2023-03-131-0/+2
| | | | | | | | | | | | | | | | | | | | | Add a cut down, Windows-specific implementation of `runuser` from util-linux. This allows elevated privileges to be dropped when running in an SSH session. It also works when using `su` or starting busybox-w32 'as administrator'. There are complications: - The method used to drop privileges leaves the access token in the TokenIsElevated state. Detecting this is likely to be fragile. - The unprivileged shell is started by CreateProcessAsUserA(). In older versions of Windows this has to be loaded dynamically. Adds about 900 bytes. (GitHub issue #240)
* win32: changes to console mode handlingRon Yorston2023-03-051-1/+4
| | | | | | | | | | | | | | | | | | | Add the environment variable BB_TERMINAL_MODE as a more general way of controlling console/terminal mode setting. The default remains unchanged: use virtual terminal mode for output if possible but fall back to the console API with emulated ANSI escape sequences. Currently valid settings are: 0 Force use of console mode 1 Force use of virtual terminal mode for output 5 Prefer virtual terminal mode for output, fall back to console Other values won't do anything useful until code elsewhere has been updated. BB_SKIP_ANSI_EMULATION remains available for backwards compatibility. If both variables are set BB_TERMINAL_MODE takes precedence.
* win32: only count subdirectories if necessaryRon Yorston2023-01-231-0/+1
| | | | | | | | | | | | | | | | | Commit 7fb95a2a5 (win32: try to get link count for directories) allowed stat(2) to report accurate values of st_nlink for directories. There are only a couple of places in busybox-w32 where these values are required. Disable counting of subdirectories by default and only enable it when necessary. Microsoft kindly provide directories to test edge cases like this: C:/Windows/WinSxS (contains many subdirectories) C:/Windows/WinSxS/Manifests (contains many files) Adds 84-112 bytes.
* win32: revised implementation of setlinebuf(3)Ron Yorston2022-12-311-1/+1
| | | | | | | | | Microsoft Windows' setvbuf() doesn't support line buffering and doesn't accept 0 as a valid value for the buffer size argument. Replace the old macro definition with an implementation that doesn't do anything. It's only used if debug is enabled in ash so there's no effect on the default build.
* win32: remove declaration of vfork(2)Ron Yorston2022-10-311-1/+0
| | | | | | | Since vfork(2) is never used in busybox-w32 there's no need to declare it. Doing so provokes clang to issue a warning. (GitHub issue #239)
* win32: revert special treatment of Unix-style absolute pathsRon Yorston2022-10-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Commit 605972390 (win32: handle Unix-style absolute paths for executables) added special treatment of paths for executables starting with a slash. Such paths are absolute on Unix but are relative to the current drive on Windows. On reflection this commit did more than necessary. Later commits provided special treatment only for paths starting with locations traditionally used to contain binaries on Unix. This is probably sufficient. Problems introduced by commit 605972390 include: - If the current drive isn't the system drive tab completion of a command starting with a slash confusingly references the system drive. - Building busybox-w32 with w64devkit fails on drives other than the system drive. Revert the changes introduced by commit 605972390. This saves 192 bytes. (GitHub issue #239)
* win32: return reparse tag in struct statRon Yorston2022-05-191-0/+1
| | | | | | | | If a file is a junction or symlink return its tag in the st_tag member of struct stat. get_symlink_data() and is_symlink() also return the tag or zero, as appropriate.
* jn: new appletRon Yorston2022-05-161-0/+1
| | | | | | | | | | | | Add a Windows-specific applet to create a directory junction. Usage: jn DIR JUNC where DIR must be an existing directory on a local drive and JUNC must not currently exist. There isn't a simple WIN32 API to create directory junctions. The implementation of mklink in ReactOS provided useful inspiration.