ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

rrmdir.c
Go to the documentation of this file.
00001 /*  $Id: rrmdir.c 29690 2007-10-19 23:21:45Z dreimer $
00002  * COPYRIGHT:             See COPYING in the top level directory
00003  * PROGRAMMER:            Rex Jolliff (rex@lvcablemodem.com)
00004  *                        Casper S. Hornstrup (chorns@users.sourceforge.net)
00005  * PURPOSE:               Platform independant remove directory command
00006  */
00007 
00008 #include <dirent.h>
00009 #include <errno.h>
00010 #include <limits.h>
00011 #include <stdio.h>
00012 #include <string.h>
00013 #include <stdlib.h>
00014 #include <unistd.h>
00015 
00016 void
00017 convertPath (char * pathToConvert)
00018 {
00019   while (*pathToConvert != 0)
00020   {
00021     if (*pathToConvert == '\\')
00022     {
00023       *pathToConvert = '/';
00024     }
00025     pathToConvert++;
00026   }
00027 }
00028 
00029 void
00030 getDirectory (const char *filename, char * directorySpec)
00031 {
00032   int  lengthOfDirectory;
00033 
00034   if (strrchr (filename, '/') != 0)
00035   {
00036     lengthOfDirectory = strrchr (filename, '/') - filename;
00037     strncpy (directorySpec, filename, lengthOfDirectory);
00038     directorySpec [lengthOfDirectory] = '\0';
00039   }
00040   else
00041   {
00042     strcpy (directorySpec, ".");
00043   }
00044 }
00045 
00046 void
00047 getFilename (const char *filename, char * fileSpec)
00048 {
00049   if (strrchr (filename, '/') != 0)
00050   {
00051     strcpy (fileSpec, strrchr (filename, '/') + 1);
00052   }
00053   else
00054   {
00055     strcpy (fileSpec, filename);
00056   }
00057 }
00058 
00059 int
00060 main (int argc, char* argv[])
00061 {
00062   int  justPrint = 0;
00063   int  idx;
00064   int  returnCode;
00065 
00066   for (idx = 1; idx < argc; idx++)
00067   {
00068     convertPath (argv [idx]);
00069 
00070     if (justPrint)
00071     {
00072       printf ("remove %s\n", argv [idx]);
00073     }
00074     else
00075     {
00076       returnCode = rmdir (argv [idx]);
00077       if (returnCode != 0 && errno != ENOENT)
00078       {
00079       /* Continue even if there is errors */
00080 #if 0
00081         printf ("Rmdir of %s failed.  Rmdir returned %d.\n",
00082                 argv [idx],
00083                 returnCode);
00084         return  returnCode;
00085 #endif
00086       }
00087     }
00088   }
00089 
00090   return  0;
00091 }
00092 
00093 

Generated on Sat May 26 2012 04:18:08 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.