ReactOS 0.4.15-dev-7942-gd23573b
rdel.c File Reference
#include <dirent.h>
#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
Include dependency graph for rdel.c:

Go to the source code of this file.

Functions

void convertPath (char *pathToConvert)
 
void getDirectory (const char *filename, char *directorySpec)
 
void getFilename (const char *filename, char *fileSpec)
 
int main (int argc, char *argv[])
 

Function Documentation

◆ convertPath()

void convertPath ( char pathToConvert)

Definition at line 15 of file rdel.c.

16{
17 while (*pathToConvert != 0)
18 {
19 if (*pathToConvert == '\\')
20 {
21 *pathToConvert = '/';
22 }
23 pathToConvert++;
24 }
25}

Referenced by main().

◆ getDirectory()

void getDirectory ( const char filename,
char directorySpec 
)

Definition at line 28 of file rdel.c.

29{
30 int lengthOfDirectory;
31
32 if (strrchr (filename, '/') != 0)
33 {
34 lengthOfDirectory = strrchr (filename, '/') - filename;
35 strncpy (directorySpec, filename, lengthOfDirectory);
36 directorySpec [lengthOfDirectory] = '\0';
37 }
38 else
39 {
40 strcpy (directorySpec, ".");
41 }
42}
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
Definition: utclib.c:427
const char * filename
Definition: ioapi.h:137
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)

◆ getFilename()

void getFilename ( const char filename,
char fileSpec 
)

Definition at line 45 of file rdel.c.

46{
47 if (strrchr (filename, '/') != 0)
48 {
49 strcpy (fileSpec, strrchr (filename, '/') + 1);
50 }
51 else
52 {
53 strcpy (fileSpec, filename);
54 }
55}

◆ main()

int main ( int argc  ,
char argv[] 
)

Definition at line 58 of file rdel.c.

59{
60 int justPrint = 0;
61 int idx;
62 int returnCode;
63
64 for (idx = 1; idx < argc; idx++)
65 {
67
68 if (justPrint)
69 {
70 printf ("delete %s\n", argv [idx]);
71 }
72 else
73 {
74 returnCode = remove (argv [idx]);
75 if (returnCode != 0 && errno != ENOENT)
76 {
77 /* Continue even if there is errors */
78#if 0
79 printf ("Unlink of %s failed. Unlink returned %d.\n",
80 argv [idx],
81 returnCode);
82 return returnCode;
83#endif
84 }
85 }
86 }
87
88 return 0;
89}
static int argc
Definition: ServiceArgs.c:12
#define ENOENT
Definition: acclib.h:79
unsigned int idx
Definition: utils.c:41
#define printf
Definition: freeldr.h:97
#define argv
Definition: mplay32.c:18
int remove
Definition: msacm.c:1366
void convertPath(char *pathToConvert)
Definition: rdel.c:15
#define errno
Definition: errno.h:18