Diff for /gforth/mkdir.fs between versions 1.3 and 1.7

version 1.3, 2008/10/06 20:40:32 version 1.7, 2010/12/31 18:09:02
Line 1 Line 1
 \ mkdir wrapper  \ mkdir wrapper
   
 \ Copyright (C) 2008 Free Software Foundation, Inc.  \ Copyright (C) 2008,2010 Free Software Foundation, Inc.
   
 \ This file is part of Gforth.  \ This file is part of Gforth.
   
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 mkdir 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> mkdir 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-p { c-addr u mode -- ior }  : mkdir-parents { c-addr u mode -- ior }
     \G create the directory @i{c-addr u} and all it's parents with      \G create the directory @i{c-addr u} and all its parents with
     \G mode @i{mode} (modified by umask)      \G mode @i{mode} (modified by umask)
     c-addr u begin { d: s }      c-addr u begin { d: s }
         s 1 /string '/' scan 2dup while ( s1 s1addr )          s 1 /string '/' scan 2dup while ( s1 s1addr )
Line 39  end-c-library Line 48  end-c-library
     repeat      repeat
     drop 2drop      drop 2drop
     c-addr u mode =mkdir ;      c-addr u mode =mkdir ;
   
           
   

Removed from v.1.3  
changed lines
  Added in v.1.7


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