version 1.3, 2008/10/06 20:40:32
|
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-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 ) |