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
17 convertPath (char * pathToConvert
)
19 while (*pathToConvert
!= 0)
21 if (*pathToConvert
== '\\')
30 getDirectory (const char *filename
, char * directorySpec
)
32 int lengthOfDirectory
;
34 if (strrchr (filename
, '/') != 0)
36 lengthOfDirectory
= strrchr (filename
, '/') - filename
;
37 strncpy (directorySpec
, filename
, lengthOfDirectory
);
38 directorySpec
[lengthOfDirectory
] = '\0';
42 strcpy (directorySpec
, ".");
47 getFilename (const char *filename
, char * fileSpec
)
49 if (strrchr (filename
, '/') != 0)
51 strcpy (fileSpec
, strrchr (filename
, '/') + 1);
55 strcpy (fileSpec
, filename
);
60 main (int argc
, char* argv
[])
66 for (idx
= 1; idx
< argc
; idx
++)
68 convertPath (argv
[idx
]);
72 printf ("remove %s\n", argv
[idx
]);
76 returnCode
= rmdir (argv
[idx
]);
77 if (returnCode
!= 0 && errno
!= ENOENT
)
79 /* Continue even if there is errors */
81 printf ("Rmdir of %s failed. Rmdir returned %d.\n",