home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
unix
/
volume26
/
mytinfo
/
part01
/
mkdir.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-12-26
|
570b
|
38 lines
/*
* mkdir.c
*
* By Ross Ridge
* Public Domain
* 92/06/04 11:38:33
*/
#ifdef USE_MYMKDIR
#define MKDIR_COMMAND "/bin/mkdir"
#ifdef USE_SCCS_IDS
static char const SCCSid[] = "@(#) mytinfo mkdir.c 3.2 92/06/04 public domain, By Ross Ridge";
#endif
static int
mkdir(name, perms)
char *name;
int perms; {
static const char cmd[] = MKDIR_COMMAND;
char *s;
s = malloc(strlen(name) + sizeof(cmd) + 1);
if (s == NULL) {
return -1;
}
sprintf(s, "%s %s", cmd, name);
if (system(s)) {
free(s);
return -1;
}
free(s);
return chmod(name, perms);
}
#endif