$save nolist /* *============================================================================ * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE * * Permission to use for any purpose, modify, copy, and make enhancements * and derivative works of the software is granted if attribution is given to * R.M. Gillmore, dba the ACME Software Deli, as the author * * While the ACME Software Deli does not work for money, there is nonetheless * a significant amount of work involved. The ACME Software Deli maintains the * rights to all code written, though it may be used and distributed as long as * the following conditions are maintained. * * 1. The copyright statement at the top of each code block is maintained in * your distribution. * 2. You do not identify yourself as the ACME Software Deli * 3. Any changes made to the software are sent to the ACME Software Deli *============================================================================ */ $if not DIRFUNCT_EXT_INCLUDED $set (DIRFUNCT_EXT_INCLUDED) /* * $Id: dirFunct.ext 1157 2025-05-05 00:35:39Z rmgillmore $ */ $include (..\lib\comnDefs.ext) /* * data type definitions for stat() */ declare _dev_t literally 'word', _ino_t literally 'word', _mode_t literally 'word', short literally 'integer', __int32 literally 'dword', __time32_t literally 'dword'; /* * st_dev This field describes the device on which this file resides. * (The major(3) and minor(3) macros may be useful to decompose * the device ID in this field.) * * st_ino This field contains the file's inode number. * * st_mode * This field contains the file type and mode. See inode(7) for * further information. * * st_nlink * This field contains the number of hard links to the file. * * st_uid This field contains the user ID of the owner of the file. * * st_gid This field contains the ID of the group owner of the file. * * st_rdev * This field describes the device that this file (inode) repre- * sents. * * st_size * This field gives the size of the file (if it is a regular file * or a symbolic link) in bytes. The size of a symbolic link is * the length of the pathname it contains, without a terminating * null byte. * * st_blksize * This field gives the "preferred" block size for efficient * filesystem I/O. * * st_blocks * This field indicates the number of blocks allocated to the * file, in 512-byte units. (This may be smaller than * st_size/512 when the file has holes.) * * st_atime * This is the time of the last access of file data. * * st_mtime * This is the time of last modification of file data. * * st_ctime * This is the file's last status change timestamp (time of last * change to the inode). */ declare stat_t literally 'structure ( st_dev _dev_t, st_ino _ino_t, st_mode _mode_t, st_nlink short, st_uid short, st_gid short, st_rdev _dev_t, st_size __int32, st_atime __time32_t, st_mtime __time32_t, st_ctime __time32_t )'; $if 0 S_IFMT 0170000 bit mask for the file type bit field S_IFSOCK 0140000 socket S_IFLNK 0120000 symbolic link S_IFREG 0100000 regular file S_IFBLK 0060000 block device S_IFDIR 0040000 directory S_IFCHR 0020000 character device S_IFIFO 0010000 FIFO $endif declare STAT_DIRBIT literally '0100$0000$0000$0000b', STAT_FILEBIT literally '1000$0000$0000$0000b'; $if not statFunctionSource stat: procedure ( pathString, statAddress ) integer external; declare pathString pointer, statAddress pointer; end stat; $endif $if not mkdirSource mkdir: procedure ( pathString ) word external; declare pathString pointer; end mkdir; $endif $if not rmdirSource rmdir: procedure ( pathString ) word external; declare pathString pointer; end rmdir; $endif $if not chdirSource chdir: procedure ( pathString ) word external; declare pathString pointer; end chdir; $endif /* * bit masks for the attribute returned from attrib() */ declare READONLY_MASK literally '01b', HIDDEN_MASK literally '010b', SYSTEM_MASK literally '0100b', VOLUMELABEL_MASK literally '0$1000b', SUBDIR_MASK literally '01$0000b', ARCHIVE_MASK literally '010$0000b'; $if not fileAttributesSource /* * attrib is used to change file attribute flags. The flag string is specified as: * "[-a|+a] [-h|+h] [-r|+r] [-s|+s]" * * attrib adds attribute flags to a file (with the '+' operator) or * removes attribute flags (with the '-' operator). * * attrib supports the following attribute bits: * * a Archive bit. Used by some backup programs to indicate a new file. * r Read-only bit. Used to indicate a read-only file. Files with this * attribute set cannot easily be erased by accident (using conventional * programs). * s System bit. Indicates the file is an operating system file. * h Hidden bit. Used to make files hidden from the standard operating * system commands * * the returned attributes is an array of bits, defined thusly: * 7 6 5 4 3 2 1 0 * 1 -- read-only * 1 -- hidden * 1 -- system * 1 -- volume label * 1 -- sub-directory * 1 -- archive * 1 -- unused * 1 -- unused */ attrib: procedure ( pathString, flagStringPtr, returnedAttributesPtr ) word external; declare pathString pointer, flagStringPtr pointer, returnedAttributesPtr pointer; /* to a byte */ end attrib; $endif $if not isDirImplementation isDir: procedure ( pathStringPtr ) word external; declare pathStringPtr pointer; end isDir; $endif $if not DIRFUNCT_IMPLEMENTATION rename: procedure ( pathString ) word external; declare pathString pointer; end rename; delete: procedure ( pathString ) word external; declare pathString pointer; end delete; $endif $endif $restore