1 |
adcroft |
1.1 |
#include <stdio.h> |
2 |
|
|
#include <errno.h> |
3 |
|
|
#include <string.h> |
4 |
|
|
#include "GLOBALS.h" |
5 |
|
|
|
6 |
|
|
int makeOutputDirectories(dName) |
7 |
|
|
/* Create a directory for output if it soed not already exist */ |
8 |
|
|
char *dName; |
9 |
|
|
{ |
10 |
|
|
int rc; |
11 |
|
|
char dNamBuf[MAXPATHNAM]; |
12 |
|
|
|
13 |
|
|
if ( strlen(dName) > MAXPATHNAM - strlen(VARSUF)-2 ){ |
14 |
|
|
return(-1); |
15 |
|
|
} |
16 |
|
|
rc = mkdir(dName, 0755); |
17 |
|
|
if ( rc != 0 ){ if ( errno != EEXIST ) return(-1); } |
18 |
|
|
rootDir = strdup(dName); |
19 |
|
|
sprintf(dNamBuf,"%s/%s",dName,VARSUF); |
20 |
|
|
rc = mkdir(dNamBuf, 0755); |
21 |
|
|
if ( rc != 0 ){ if ( errno != EEXIST ) return(-1); } |
22 |
|
|
varDir = strdup(dNamBuf); |
23 |
|
|
sprintf(dNamBuf,"%s/%s",dName,SRCSUF); |
24 |
|
|
rc = mkdir(dNamBuf, 0755); |
25 |
|
|
if ( rc != 0 ){ if ( errno != EEXIST ) return(-1); } |
26 |
|
|
srcDir = strdup(dNamBuf); |
27 |
|
|
|
28 |
|
|
return(0); |
29 |
|
|
} |