From bfd5f850c86c2ee27eb93a8006537093f4b7843c Mon Sep 17 00:00:00 2001 From: Lisa Milne Date: Fri, 8 Dec 2023 23:50:00 +1000 Subject: [PATCH] documentation and version bump --- clite/core.js | 2 +- readme-libs.txt | 54 ++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 52 insertions(+), 4 deletions(-) diff --git a/clite/core.js b/clite/core.js index 1308b5e..ad4fa11 100644 --- a/clite/core.js +++ b/clite/core.js @@ -1,6 +1,6 @@ var clite = { state:{ - version:'0.3.8', + version:'0.3.9', isinit:false, runlevel:1 }, diff --git a/readme-libs.txt b/readme-libs.txt index 6bada42..58a5a0e 100644 --- a/readme-libs.txt +++ b/readme-libs.txt @@ -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.