aboutsummaryrefslogtreecommitdiff
path: root/jim-file.c
AgeCommit message (Collapse)AuthorFilesLines
2023-06-20file: use 64 bit stat functions if necessarySteve Bennett1-3/+3
Some 32 bit systems may require explicit use of stat64, etc. Fixes #263
2023-02-13windows: compatibility changesSteve Bennett1-1/+3
_fullpath isn't necessarily available, so check for it symlink() isn't useful enough on Windows to use Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-02-09build: handle old compilers without restrict keywordSteve Bennett1-0/+4
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2023-01-31file normalize: on Windows use _fullpath()mrv961-19/+29
Fixes #91
2022-12-26file normalise: ensure realpath() buffer is long enoughSteve Bennett1-0/+4
On some systems, 1024 isn't enough so use PATH_MAX if available. Fixes: #247 Signed-off-by: Steve Bennett <steveb@workware.net.au>
2022-04-14aio: TIP 603 - Implement stat of an open file handleSteve Bennett1-5/+7
Although the interface is different ('$handle stat' vs 'chan configure -stat') the behaviour is the same. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2022-02-22file: delete: Fix --force and --Steve Bennett1-2/+2
The command line processing was wrong such that 'file delete -force abc' would also try to delete files named 'delete' and '-force' in the current directory. If the current directory was writable, this would succeed, but it not writable this would fail and so the desired target was not deleted. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2021-01-10package: add ABI version checkingSteve Bennett1-3/+1
jim.h now includes JIM_ABI_VERSION that should be incremented whenever the ABI changes. Then all loadable modules should call Jim_CheckAbiVersion() to make sure they are loaded against the correct version. Add Jim_PackageProvideCheck() that does both Jim_CheckAbiVersion() and Jim_PackageProvide() to simplify the implementation of loadable extensions. Also rename the "big" sqlite3 extension to just sqlite to avoid a naming conflict with the smaller jim-sqlite3 extension. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-05file: stat: Fixes for 64 bit times on WindowsSteve Bennett1-17/+17
While -D__MINGW_USE_VC2005_COMPAT enables a 64-bit time_t, it is necessary to explicitly use _stat64 to access the stat structure containing 64 bit times. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-04tests: Fixes to recent tests for windowsSteve Bennett1-1/+6
Mostly just avoiding running certain tests, but also: - rename() won't overwrite an existing file on Windows - ensure that eof returns 0 or 1 - in aio.test, create and read the file in binary mode Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-04file readlink: change error message to match TclSteve Bennett1-1/+1
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2020-05-04file: rootname, dirname fixes to match TclSteve Bennett1-7/+7
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2019-10-18file: Add file splitSteve Bennett1-0/+36
This subcommand was missing as it wasn't part of the original Tcl 6.7 Signed-off-by: Steve Bennett <steveb@workware.net.au>
2019-10-18file: Better support for trailing slashes in pathnamesSteve Bennett1-7/+50
e.g. file tail /abc/def/ => def Signed-off-by: Steve Bennett <steveb@workware.net.au>
2018-09-21file: Add microsecond resolution for mtime: mtimeusSteve Bennett1-14/+61
Note that actual support is dependent upon the underlying operating system and filesystem. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2017-10-21file: __MSYS__ signifies windows tooSteve Bennett1-1/+1
Needed to make file join work with msys2 Signed-off-by: Steve Bennett <steveb@workware.net.au>
2017-10-17signal, exec, wait, pid: improvements, especially to execSteve Bennett1-1/+1
- fix popen [open "|pipeline ..."] to return meaningful status in close (but note that stderr is not captured) - popen pipelines can now be used as the target of exec redirection - overally improvements to exec on windows. Now crt file descriptors are used throughout - add support for [pid], [wait] and popen on windows - os.wait is now wait, and integrates with [exec ... &] to be able to wait for running background tasks - [socket pipe] is now also [pipe] and is supported on windows - [file tempfile] is supported on windows - move duplicated code between jim-aio.c and jim-exec.c to jimiocompat.c - Fix [exec] on windows to match unix semantics wrt sharing the parent stream unless redirected rather than using /dev/null - On windows redirect to or from /dev/null is automatically converted to NUL: - If signal support is disabled, implement a minimal Jim_SignalId() for exec and wait - aio now supports getfd, to return the underlying file descriptor. This is used by exec to support redirection, and allows popen channels to support exec redirection. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2016-09-28file: update file stat to use Jim_DictMerge()Steve Bennett1-8/+10
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2014-12-04file: updates for WindowsSteve Bennett1-12/+15
Mainly, [file join] should leave the trailing slash on c:/ Signed-off-by: Steve Bennett <steveb@workware.net.au>
2014-11-28file: add support for file linkSteve Bennett1-0/+47
Currently only on systems that support both hard and symbolic links. Update docs for 'file link' and some other [file] commands Signed-off-by: Steve Bennett <steveb@workware.net.au>
2014-08-03Temporary file creation should respect $TMPDIRSteve Bennett1-18/+1
This applies to [exec] and [file tempfile] Reported-by: Jakub Wilk Signed-off-by: Steve Bennett <steveb@workware.net.au>
2014-04-28exec, file: set umask before mkstempSteve Bennett1-0/+2
Set umask so that temp files are created with permissions 0600. Courtesy of coverity. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2014-04-23file: avoid mem leak on mkstemp failureSteve Bennett1-0/+1
Courtesy of coverity Signed-off-by: Steve Bennett <steveb@workware.net.au>
2014-03-03file: fix stat file size for large filesSteve Bennett1-1/+1
Reported-by: Andy <jimdevel@hummypkg.org.uk> Signed-off-by: Steve Bennett <steveb@workware.net.au>
2014-01-21many comment changes, some small code changesSteve Bennett1-11/+6
Sweep through and clean up all (most) of the comments in the code. While there, adjust some variable and function names to be more consistent, and make a few small code changes - again, mostly for consistency. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2014-01-15file: simplify [file stat], var now optionalSteve Bennett1-51/+58
The varname is now optional. The return value is a dictionary. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2012-09-20Add support for glob -directoryAlexander Shpilkin1-1/+3
Implement support for the -directory option to the [glob] command. The -tails option is accepted for Tcl compatibility, but ignored; the command always behaves as if -tails were given.
2012-02-21file normalize only works with an existing pathSteve Bennett1-2/+3
Because file normalize uses realpath(), the path must exist. This is not 100% compatible with Tcl which can also normalize nonexistent paths. Don't ignore the error from realpath() Signed-off-by: Steve Bennett <steveb@workware.net.au>
2012-01-19Fix some warnings identified by iccSteve Bennett1-6/+8
The Intel C Compiler Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-11-24Create build-jim-ext for building extensionsSteve Bennett1-3/+2
Simplifies the process of building loadable extensions Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-11-09Typo in error messageSteve Bennett1-1/+1
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-11-07Allow building with MSVC on windowsSteve Bennett1-9/+34
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-11-07Remove use of designated initialisersSteve Bennett1-151/+151
For better compatibility c89 compatibility. Also simplify jim-subcmd. Remove -usage and command descriptions. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-09-12Remove all trailing whitespace in sourceSteve Bennett1-5/+5
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-08-30Change Jim_EvalObjPrefix to accept arbitrary objectsAlexander Shpilkin1-2/+2
Jim_EvalObjPrefix now accepts an arbitrary Jim_Obj as a prefix, with Jim_EvalPrefix being equivalent to the older version.
2011-08-18Implement 'file mtime <file> newtime'Steve Bennett1-4/+26
Allows a file to be "touched" Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-08-03Fix commit cbeb3ea: unset missing array elementSteve Bennett1-2/+2
Although [dict unset] should not complain about being unable to unset a missing element, unset via array syntax (dict sugar) should - to be compatible with Tcl. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-07-12Fix a string length error in [file join] from 3b317b1Steve Bennett1-0/+1
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-07-12Fix some [file join] casesSteve Bennett1-2/+11
In particular, file join / anything Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-07-07Add support for file delete -forceSteve Bennett1-5/+15
Will recursively remove directories, even if not empty. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-07-07Do just enough to make Jim useable with msys/mingwSteve Bennett1-0/+21
Convert some paths from backslashes to forward slashes Handle splitting/joining paths which look like z:/abc/def Identify the platform as mingw Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-06-28Fix support for 64-bit mingwSteve Bennett1-1/+1
- Check for mkdir with one arg at configure time - mingw can't really do select(), so support only time events in eventloop - Declare dlerror() to be compatible with mingw Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-06-01Add Jim_String() macroSteve Bennett1-15/+15
It is very common to get the string value without the length. Jim_String() is a macro which does that. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2011-05-09If [file normalize] isn't implemented, give a messageSteve Bennett1-3/+4
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-12-16Use the new Jim_EvalObjPrefix() for 'file copy'Steve Bennett1-10/+1
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-12-06Fix error message from [cd]Steve Bennett1-1/+1
Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-11-09Allow jim to be used as an autoconf subdirSteve Bennett1-0/+1
Ensure that no public headers include the autoconf header, jimautoconf.h, as it leads to problems with redefined symbols. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Licence wording updates.Steve Bennett1-4/+1
Per v0.51, don't refer to the FreeBSD licence Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Portability fixesSteve Bennett1-2/+6
Especially for eCos, mingw32 and cygwin Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Ensure that Tcl extensions can be built-in or externalSteve Bennett1-0/+3
All C extensions must call Jim_PackageProvide() make-c-ext ensures that Tcl extensions call Jim_PackageProvide() if compiled in. Signed-off-by: Steve Bennett <steveb@workware.net.au>