Diff for /gforth/mkdir.fs between versions 1.1 and 1.5

version 1.1, 2008/08/19 20:18:58 version 1.5, 2008/10/06 21:46:15
Line 1 Line 1
 \ socket interface  \ mkdir wrapper
   
 \ Copyright (C) 2008 Free Software Foundation, Inc.  \ Copyright (C) 2008 Free Software Foundation, Inc.
   
Line 17 Line 17
 \ You should have received a copy of the GNU General Public License  \ You should have received a copy of the GNU General Public License
 \ along with this program. If not, see http://www.gnu.org/licenses/.  \ along with this program. If not, see http://www.gnu.org/licenses/.
   
 require cstr.fs  \ there is now a primitive =MKDIR
 c-library mkdir  [IFUNDEF] =mkdir
 \c #include <sys/stat.h>      [IFUNDEF] c-library
 \c #include <sys/types.h>          \ define dummy mkdir
 c-function mkdir1 mkdir a n -- n ( pathname\0 mode -- f )          : =mkdir ( c-addr u mode -- ior )
 \c #include <errno.h>              2drop drop 0 ;
 \c #define IOR(flag)    ((flag)? -512-errno : 0)      [ELSE]
 c-function f>ior IOR n -- n ( f -- ior )          require cstr.fs
           c-library mkdir
 : mkdir ( c-addr u mode -- ior )          \c #include <sys/stat.h>
     >r 1 tilde_cstr r> mkdir1 f>ior ;          \c #include <sys/types.h>
 end-c-library          c-function mkdir mkdir a n -- n ( pathname\0 mode -- f )
           \c #include <errno.h>
           \c #define IOR(flag)    ((flag)? -512-errno : 0)
           c-function f>ior IOR n -- n ( f -- ior )
               
           : =mkdir ( c-addr u mode -- ior )
           >r 1 tilde_cstr r> mkdir f>ior ;
           end-c-library
       [THEN]
   [THEN]
   
   : mkdir-parents { c-addr u mode -- ior }
       \G create the directory @i{c-addr u} and all its parents with
       \G mode @i{mode} (modified by umask)
       c-addr u begin { d: s }
           s 1 /string '/' scan 2dup while ( s1 s1addr )
               c-addr tuck - mode =mkdir drop
       repeat
       drop 2drop
       c-addr u mode =mkdir ;
   
           
   

Removed from v.1.1  
changed lines
  Added in v.1.5


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>