documentation and version bump

This commit is contained in:
Lisa Milne 2023-12-08 23:50:00 +10:00
parent 6918e5dbed
commit bfd5f850c8
2 changed files with 52 additions and 4 deletions

View file

@ -1,6 +1,6 @@
var clite = {
state:{
version:'0.3.8',
version:'0.3.9',
isinit:false,
runlevel:1
},

View file

@ -255,14 +255,31 @@ stdio (libio.so): io.include('stdio')
// success!
stat('path')
fstat(fd)
lstat('path')
fstatat(fd,flags)
Returns a stat object with infomation about a file.
Returns null on error.
Editing the returned object does not change anything for the
actual file, it just means your stat object is now wrong.
fstatat returns data for the file descriptor fd.
flags may be either 0 or stdio.flags.AT_SYMLINK_NOFOLLOW
stat returns data for the file specified by path, or if the file
is a symbolic link, for the file the link points to.
equivalent to:
var fd = stdio.open('path',stdio.flags.O_RDONLY|stdio.flags.O_NOFOLLOW);
var st = stdio.fstatat(fd,stdio.flags.AT_SYMLINK_NOFOLLOW);
lstat returns data for the file specified by path, or if the file
is a symbolic link, for the link itself.
equivalent to:
var fd = stdio.open('path',stdio.flags.O_RDONLY);
var st = stdio.fstatat(fd,0);
var st = stdio.stat('/usr/home/guest/file.txt');
var st = stdio.fstat(fd);
var st = stdio.lstat('/usr/home/guest/file.txt');
var st = stdio.fstatat(fd,0);
Stat object contents:
st.name: string containing the file name
@ -301,7 +318,7 @@ stdio (libio.so): io.include('stdio')
The user has all permissions, the group has read and execute
permissions, others have only read permissions.
isattty(fd)
isatty(fd)
returns true if fd refers to a tty.
vfprintf(fd,format,args)
@ -391,3 +408,34 @@ curses (libcurses.so): io.include('curses')
and getmaxy(), but writes the results to the pointers passed
as arguments. See clite.ptr*() functions for how to create,
read, and write with pointers.
time (libtime.so): io.include('time')
Provides functions for interacting with system time.
asctime(timeptr)
Converts a time Object, as returned by gmtime() or localtime()
into a human readable string.
gmtime(time)
Converts an integer containing the number of seconds since epoch
into a time Object.
tm_sec:0, // seconds (0-60)
tm_min:0, // minutes (0-59)
tm_hour:0, // hour (0-23)
tm_mday:0, // day of month (0-31)
tm_mon:0, // month of year (0-11)
tm_year:0, // years since 1900
tm_wday:0, // day of week (0-6, sunday = 0)
tm_yday:0, // day of year (0-365)
tm_isdst:0 // 1 if daylight savings
localtime(time)
Converts an integer containing the number of seconds since epoch
into a time Object, taking into account the current time zone.
mktime(timeptr)
Converts a time Object into an integer containing the number of
seconds since epoch.
time()
Returns the current time, as seconds since epoch.