2 * COPYRIGHT: See COPYING in the top level directory
3 * PROGRAMMER: Rex Jolliff (rex@lvcablemodem.com)
4 * PURPOSE: Platform independent delete command
16 #include <sys/types.h>
20 convertPath (char * pathToConvert
)
22 while (*pathToConvert
!= 0)
24 if (*pathToConvert
== '\\')
34 getDirectory (const char *filename
, char * directorySpec
)
36 int lengthOfDirectory
;
38 if (strrchr (filename
, '/') != 0)
40 lengthOfDirectory
= strrchr (filename
, '/') - filename
;
41 strncpy (directorySpec
, filename
, lengthOfDirectory
);
42 directorySpec
[lengthOfDirectory
] = '\0';
46 strcpy (directorySpec
, ".");
52 getFilename (const char *filename
, char * fileSpec
)
54 if (strrchr (filename
, '/') != 0)
56 strcpy (fileSpec
, strrchr (filename
, '/') + 1);
60 strcpy (fileSpec
, filename
);
65 main (int argc
, char* argv
[])
71 for (idx
= 1; idx
< argc
; idx
++)
73 convertPath (argv
[idx
]);
77 printf ("delete %s\n", argv
[idx
]);
82 _chmod (argv
[idx
], _S_IREAD
| _S_IWRITE
);
84 chmod (argv
[idx
], 0666);
86 returnCode
= remove (argv
[idx
]);
87 if (returnCode
!= 0 && errno
!= ENOENT
)
89 /* Continue even if there is errors */
91 printf ("Unlink of %s failed. Unlink returned %d.\n",