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

version 1.3, 2008/10/06 20:40:32 version 1.6, 2010/12/30 21:46:14
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
           \c #include <sys/stat.h>
           \c #include <sys/types.h>
           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 ( c-addr u mode -- ior )  : mkdir-parents { c-addr u mode -- ior }
     >r 1 tilde_cstr r> mkdir f>ior ;      \G create the directory @i{c-addr u} and all its parents with
 end-c-library  
   
 : mkdir-p { c-addr u mode -- ior }  
     \G create the directory @i{c-addr u} and all it's 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.6


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