ReactOS  0.4.14-dev-991-g696cdc6
rrmdir.c File Reference
#include <dirent.h>
#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
Include dependency graph for rrmdir.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 17 of file rrmdir.c.

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

Referenced by main().

◆ getDirectory()

void getDirectory ( const char filename,
char directorySpec 
)

Definition at line 30 of file rrmdir.c.

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

◆ getFilename()

void getFilename ( const char filename,
char fileSpec 
)

Definition at line 47 of file rrmdir.c.

48 {
49  if (strrchr (filename, '/') != 0)
50  {
51  strcpy (fileSpec, strrchr (filename, '/') + 1);
52  }
53  else
54  {
55  strcpy (fileSpec, filename);
56  }
57 }
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
const char * filename
Definition: ioapi.h:135
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388

◆ main()

int main ( int argc  ,
char argv[] 
)

hosttype.c Copyright (C) 2002 by Brian Palmer brian.nosp@m.p@sg.nosp@m.inet..nosp@m.com

Definition at line 60 of file rrmdir.c.

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