Diff for /gforth/mkdir.fs between versions 1.2 and 1.4

version 1.2, 2008/10/06 19:35:42 version 1.4, 2008/10/06 21:21:20
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  \ require cstr.fs
 \c #include <sys/stat.h>  \ c-library mkdir
 \c #include <sys/types.h>  \ \c #include <sys/stat.h>
 c-function mkdir mkdir a n -- n ( pathname\0 mode -- f )  \ \c #include <sys/types.h>
 \c #include <errno.h>  \ c-function mkdir mkdir a n -- n ( pathname\0 mode -- f )
 \c #define IOR(flag)    ((flag)? -512-errno : 0)  \ \c #include <errno.h>
 c-function f>ior IOR n -- n ( f -- ior )  \ \c #define IOR(flag)  ((flag)? -512-errno : 0)
   \ c-function f>ior IOR n -- n ( f -- ior )
   
 : =mkdir ( c-addr u mode -- ior )  \ : =mkdir ( c-addr u mode -- ior )
     >r 1 tilde_cstr r> mkdir f>ior ;  \     >r 1 tilde_cstr r> mkdir f>ior ;
 end-c-library  \ end-c-library
   
   : 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.2  
changed lines
  Added in v.1.4


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