Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/src/smlnj-lib/Unix/unix-path.sml
ViewVC logotype

Diff of /sml/trunk/src/smlnj-lib/Unix/unix-path.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

sml/trunk/src/smlnj-lib/Unix/unix-path.sml revision 2, Sat Oct 4 23:33:09 1997 UTC sml/branches/SMLNJ/src/smlnj-lib/Unix/unix-path.sml revision 8, Sun Jan 18 01:01:29 1998 UTC
# Line 11  Line 11 
11  structure UnixPath : UNIX_PATH =  structure UnixPath : UNIX_PATH =
12    struct    struct
13    
14      structure FS : sig      datatype access_mode = datatype OS.FileSys.access_mode
         datatype access_mode = A_READ | A_WRITE | A_EXEC  
       end = OS.FileSys  
     open FS  
15    
16  (** WHAT IS THIS IN POSIX??? **)  (** WHAT IS THIS IN POSIX??? **)
17      datatype file_type = F_REGULAR | F_DIR | F_SYMLINK | F_SOCK | F_CHR | F_BLK      datatype file_type = F_REGULAR | F_DIR | F_SYMLINK | F_SOCK | F_CHR | F_BLK
# Line 33  Line 30 
30            end (* getPath *)            end (* getPath *)
31    
32      local      local
33        fun getFileTy path = Posix.FileSys.ST.fileType(Posix.FileSys.stat path)        structure ST = Posix.FileSys.ST
34        fun isFileTy (path, F_REGULAR) = Posix.FileSys.isReg(getFileTy path)        fun isFileTy (path, ty) = let
35          | isFileTy (path, F_DIR) = Posix.FileSys.isDir(getFileTy path)              val st = Posix.FileSys.stat path
36          | isFileTy (path, F_SYMLINK) = Posix.FileSys.isLink(getFileTy path)              in
37          | isFileTy (path, F_SOCK) = Posix.FileSys.isSock(getFileTy path)                case ty
38          | isFileTy (path, F_CHR) = Posix.FileSys.isChr(getFileTy path)                 of F_REGULAR => ST.isReg st
39          | isFileTy (path, F_BLK) = Posix.FileSys.isBlk(getFileTy path)                  | F_DIR => ST.isDir st
40                    | F_SYMLINK => ST.isLink st
41                    | F_SOCK => ST.isSock st
42                    | F_CHR => ST.isChr st
43                    | F_BLK => ST.isBlk st
44                  (* end case *)
45                end
46        fun access mode pathname = (OS.FileSys.access(pathname, mode))        fun access mode pathname = (OS.FileSys.access(pathname, mode))
47        fun accessAndType (mode, ftype) pathname = (        fun accessAndType (mode, ftype) pathname = (
48              OS.FileSys.access(pathname, mode)              OS.FileSys.access(pathname, mode)

Legend:
Removed from v.2  
changed lines
  Added in v.8

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0