1 /* $Id: rdel.c,v 1.1 2001/07/15 21:18:48 rex Exp $
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROGRAMMER: Rex Jolliff (rex@lvcablemodem.com)
4 * PURPOSE: Platform independant delete 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 ("delete %s\n", argv
[idx
]);
75 returnCode
= remove (argv
[idx
]);
76 if (returnCode
!= 0 && errno
!= ENOENT
)
78 printf ("Unlink of %s failed. Unlink returned %d.\n",