Lugaru's Epsilon
Programmer's
Editor

Context:
Epsilon User's Manual and Reference
   Changes from Older Versions
      . . .
      Enhanced Features in Epsilon 10
         Dired Enhancements in Epsilon 10
         Searching & Navigation in Epsilon 10
         Grep and Multifile Searching in Epsilon 10
         . . .
         Other Changes in Epsilon 10
      New EEL Primitives and Subroutines in Epsilon 10
         New File Primitives in Epsilon 10
         New Buffer Primitives in Epsilon 10
         New Process Primitives in Epsilon 10
         . . .
      Changes to EEL Primitives and Subroutines in Epsilon 10

Previous   Up    Next
Other Changes in Epsilon 10  Changes from Older Versions   New Buffer Primitives in Epsilon 10


Epsilon User's Manual and Reference > Changes from Older Versions > New EEL Primitives and Subroutines in Epsilon 10 >

New File Primitives in Epsilon 10


int get_file_read_only(char *fname)
int set_file_read_only(char *fname, int val)
int set_file_opsys_attribute(char *fname, int attribute)

The get_file_read_only( ) primitive returns 1 if the file fname has been set read-only, 0 if it's writable, or -1 if the file's read-only status can't be determined (perhaps because the file doesn't exist). The set_file_read_only( ) primitive sets the file fname read-only (if val is nonzero) or writable (if val is zero). It returns 0 if an error occurred, otherwise nonzero.

Under Unix, set_file_read_only( ) sets the file writable for the current user, group and others, as modified by the current umask setting (as if you'd just created the file). Other permission bits aren't modified.

The set_file_opsys_attribute( ) primitive sets the raw attribute of a file. The precise meaning of the attribute depends on the operating system: under Unix this sets the file's permission bits, while in other environments it can set such attributes as Hidden or System. The primitive returns nonzero if it succeeds. See the opsysattr member of the structure set by check_file( ) to retrieve the raw attribute of a file.

int fpatmatch(char *s, char *pat, int prefix, int fold)

The fpatmatch( ) primitive returns nonzero if a string s matches a pattern pat. It uses a simple filename-style pattern syntax: * matches any number of characters; ? matches a single character, and [a-z] match a character class (with the same character class syntax as other patterns in Epsilon). If prefix is nonzero, s must begin with text matching pat; otherwise pat must match all of s. If fold is nonzero, Epsilon folds characters before comparing according to the current buffer's folding rules.

char *look_on_path(char *fname, int flags, char *path, ?int skip)

The look_on_path( ) primitive looks for a file along a path. It's similar to the lookpath( ) primitive, but more flexible.

First, it fname is an absolute filename, it returns fname if fname is readable, otherwise NULL.

Next, if flags includes the flag PATH_ADD_CUR_DIR, Epsilon looks for the file in the current directory.

Next, if flags includes the flag PATH_ADD_EXE_DIR, Epsilon looks for the file in the directory containing Epsilon's executable. If flags includes PATH_ADD_EXE_PARENT, it looks in the parent of that directory.

Then it looks in each of the directories named by path, a list of directories separated by semicolon characters (colons under Unix).

As soon as it finds a readable file named fname in one of the above places, it stops and returns the absolute pathname of that file. If it can't locate any matching readable file, it returns NULL.

If you supply look_on_path( ) with an optional skip parameter of n, it will skip over the first n matches it finds (so long as its parameter is a relative pathname). You can use this to reject a file and look for the next one on a path.

int filename_rules(char *fname)

The filename_rules( ) primitive now returns additional codes in some cases that indicate the type of drive a file is located on, when Epsilon can determine this. FSYS_NETWORK indicates the file is on a different computer and is being accessed over a network. FSYS_CDROM indicates the file is on a CD-ROM disk. FSYS_REMOVABLE indicates the file is on a removable medium like a floppy disk or Zip disk. And FSYS_LOCAL indicates the file is on a local (non-network) hard disk. At most one of the these bits will be present.

Epsilon for Unix returns FSYS_CASE_SENSITIVE for all files, even if they happen to lie on a file system that might use different rules natively. It can't detect the type of drive a file is on either.



Previous   Up    Next
Other Changes in Epsilon 10  Changes from Older Versions   New Buffer Primitives in Epsilon 10


Lugaru Copyright (C) 1984, 2012 Lugaru Software Ltd. All Rights Reserved.