# HG changeset patch # User Mychaela Falconia # Date 1510878369 0 # Node ID d332fbf5c14530b2f431f9d7337b8d11029c0089 # Parent 81da9717babeaa0506c6472940295b04770dea72 etmsync: host_mkdir() function factored out of fc-fsio diff -r 81da9717babe -r d332fbf5c145 rvinterf/etmsync/Makefile --- a/rvinterf/etmsync/Makefile Fri Nov 17 00:03:21 2017 +0000 +++ b/rvinterf/etmsync/Makefile Fri Nov 17 00:26:09 2017 +0000 @@ -9,8 +9,9 @@ FSIO_OBJS= cl_des.o connect.o dispatch.o fdcmd.o fileio.o fsbasics.o \ fscmdtab.o fserr.o fsiomain.o fsmisc.o fspath.o fsread.o \ - fsupload.o fswrite.o help.o interf.o launchrvif.o memcmd.o \ - memops.o pirimei.o pirmagnetite.o rfcap.o stddirs.o symlink.o + fsupload.o fswrite.o help.o hostmkdir.o interf.o launchrvif.o \ + memcmd.o memops.o pirimei.o pirmagnetite.o rfcap.o stddirs.o \ + symlink.o MEMDUMP_OBJS= connect.o interf.o launchrvif.o memdump.o memops.o diff -r 81da9717babe -r d332fbf5c145 rvinterf/etmsync/fsread.c --- a/rvinterf/etmsync/fsread.c Fri Nov 17 00:03:21 2017 +0000 +++ b/rvinterf/etmsync/fsread.c Fri Nov 17 00:26:09 2017 +0000 @@ -203,32 +203,6 @@ return fd_close(tfd); } -host_mkdir(pathname) - char *pathname; -{ - int rc; - struct stat st; - - rc = stat(pathname, &st); - if (rc < 0) { - rc = mkdir(pathname, 0777); - if (rc < 0) { - perror(pathname); - return(ERROR_UNIX); - } - return(0); - } else { - if (S_ISDIR(st.st_mode)) - return(0); - else { - fprintf(stderr, - "error: %s already exists and is not a directory\n", - pathname); - return(ERROR_UNIX); - } - } -} - cpout_dir(ffspath_dir, hostpath_dir) char *ffspath_dir, *hostpath_dir; { diff -r 81da9717babe -r d332fbf5c145 rvinterf/etmsync/hostmkdir.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rvinterf/etmsync/hostmkdir.c Fri Nov 17 00:26:09 2017 +0000 @@ -0,0 +1,36 @@ +/* + * host_mkdir() function has been factored out into this module. + */ + +#include +#include +#include +#include +#include +#include "exitcodes.h" + +host_mkdir(pathname) + char *pathname; +{ + int rc; + struct stat st; + + rc = stat(pathname, &st); + if (rc < 0) { + rc = mkdir(pathname, 0777); + if (rc < 0) { + perror(pathname); + return(ERROR_UNIX); + } + return(0); + } else { + if (S_ISDIR(st.st_mode)) + return(0); + else { + fprintf(stderr, + "error: %s already exists and is not a directory\n", + pathname); + return(ERROR_UNIX); + } + } +}