1 /* $Id: rrmdir.c,v 1.1 2001/08/21 20:13:17 chorns Exp $
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROGRAMMER: Rex Jolliff (rex@lvcablemodem.com)
4 * Casper S. Hornstrup (chorns@users.sourceforge.net)
5 * PURPOSE: Platform independant remove directory command
16 convertPath (char * pathToConvert
)
18 while (*pathToConvert
!= 0)
20 if (*pathToConvert
== '\\')
29 getDirectory (const char *filename
, char * directorySpec
)
31 int lengthOfDirectory
;
33 if (strrchr (filename
, '/') != 0)
35 lengthOfDirectory
= strrchr (filename
, '/') - filename
;
36 strncpy (directorySpec
, filename
, lengthOfDirectory
);
37 directorySpec
[lengthOfDirectory
] = '\0';
41 strcpy (directorySpec
, ".");
46 getFilename (const char *filename
, char * fileSpec
)
48 if (strrchr (filename
, '/') != 0)
50 strcpy (fileSpec
, strrchr (filename
, '/') + 1);
54 strcpy (fileSpec
, filename
);
59 main (int argc
, char* argv
[])
65 for (idx
= 1; idx
< argc
; idx
++)
67 convertPath (argv
[idx
]);
71 printf ("remove %s\n", argv
[idx
]);
75 returnCode
= rmdir (argv
[idx
]);
76 if (returnCode
!= 0 && errno
!= ENOENT
)
78 /* Continue even if there is errors */
80 printf ("Rmdir of %s failed. Rmdir returned %d.\n",