aboutsummaryrefslogtreecommitdiff
path: root/jim-file.c
AgeCommit message (Collapse)AuthorFilesLines
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>
2010-10-15Rename GetFileType() -> JimGetFileType()Steve Bennett1-4/+4
To avoid clash on win32 Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Clean up the indentation messSteve Bennett1-46/+65
Use 'indent'. Not perfect, but at least consistent. Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Improvements to jim configureSteve Bennett1-21/+47
Create and use config.h Check for backtrace, fork, vfork, syslog, regcomp and others Disable extensions which require missing functions/features Check for one arg vs. two arg mkdir() Distinguish between mingw and native windows The aio extension has reduced functionality for ANSI C only Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Improvements to 'file mkdir', 'file delete'Steve Bennett1-10/+59
file mkdir will now create intermediate directories file delete can now also delete empty directories Signed-off-by: Steve Bennett <steveb@workware.net.au>
2010-10-15Improve stack trace handlingSteve Bennett1-1/+1
*: Get rid of JIM_ERR_ADDSTACK and use interp->addStackTrace instead *: 'return -code error' doesn't add a stack frame *: Rename _file_copy to {file copy} for better error messages *: Use 'return -code' to prevent excessive levels in the stack trace Also rename info_nameofexecutable to {info nameofexecutable}
2010-10-15Add support for 'file copy'Steve Bennett1-0/+21
2010-10-15Add Jim_SetResultFormatted() for simplied messagesSteve Bennett1-22/+16
Makes creating error messages much simpler Also convert a couple of long if/else to switch Also some error message improvements Also fix some memory leaks
2010-10-15Implement 'file tempfile'Steve Bennett1-0/+28
From TIP #201: http://www.tcl.tk/cgi-bin/tct/tip/210.html
2010-10-15Enhance env, fix error messagesSteve Bennett1-1/+1
env command allows a default to be supplied Fix wrong 'file rename' error message
2010-10-15Build improvements, bug fixes and compiler warningsSteve Bennett1-0/+1
Remove unimplemented 'after restart|expire' from eventloop Allow libjim to be build as a shared library On some platforms, regex.h needs stdlib.h first Use ualarm() only for times < 1 second Fix warnings found by clang static analyser *: printf/syslog %m isn't portable *: some variables set but never read *: some possible null pointer references (although mostly impossible) *: also minor fixes to jim unit tests Fix 'syslog -options <n>' Must null terminate readlink() result
2010-10-15Bugs, features and testsSteve Bennett1-0/+55
source fails with zero length file unknown can't be called recursively *: This can be useful when using unknown to dynamically load code, which may in turn want to dynamically load code *: Limit it to 50 recursions though Allow string greater/less comparison *: Comparing two strings for order did not work Implement file join *: It's not to hard and is handy when working with the current dir, "" Don't omit [unknown] completely from stack trace *: Since we lose valuable informtion, just omit the name Fix return from case Turn regexp patterns into real objects *: Thus caching the compiled regexps Allow error to rethrow an error Replace bcopy() with more standard memcpy() Fixes to parray, improve errorInfo *: errorInfo takes an optional stack trace Add tests for rethrowing errors via errorInfo Fix ndelay *: Was looking at wrong param *: Also fix usage/help for aio.socket Package should be able to call exit *: Currently any return from a package is changed to JIM_ERR Line counting is incorrect for backlash newline
2010-10-15Build fixes, better Jim_EvalFile()Steve Bennett1-11/+6
*: make-c-ext is now make-c-ext.tcl *: build doc/Tcl.html with asciidoc *: Jim_SetIntResult -> Jim_SetResultInt *: Jim_EvalFile() now reads the file contents in one go
2010-10-15Convert jim-aio.c to use subcmdSteve Bennett1-1/+2
Also: - make stream.server set SO_REUSEADDR - do object reference properly for callbacks - white space cleanup in jim-eventloop.c - fix the pwd command - add support for JIM_MODFLAG_FULLARGV to subcmd - make verbose runtests easier to read - bio might not be available
2010-10-15Small improvementsSteve Bennett1-1/+4
Save (but then cleanup) generated extensions Add package and readdir to 'all' extensions Order of static extensions matters!! Simple C define support for configured extensions Fix some compiler warnings
2010-10-15Make static extensions buildSteve Bennett1-1/+1
Also clean up some white space
2010-10-15Import various tinytcl compatibility packagesSteve Bennett1-1/+1
Also fix 'file type'
2010-10-15Add file and exec (along with subcmd support)Steve Bennett1-0/+677