• Main Page
  • Modules
  • Classes
  • Files
  • File List

D:/Projekt/ECF_trunk/examples/FunctionMin/dirOK-linux.c

00001 
00002 #include <unistd.h>
00003 #include <string.h>
00004 #include <stdio.h>
00005 #include <stdlib.h>
00006 #include "benchmarkshelper.h"
00007 
00008 /* Checks if sDir exists, 
00009    creates it if not
00010    checks if is writable thereafter
00011    Fatal ERROR if anything fails
00012 */
00013 void dirOK(char *sDir)
00014 {
00015     char sLoc[256], fileNameLoc[1024];
00016     if (strlen(sDir) > 1024)
00017         ERROR("pathName too long %s\n",sDir); 
00018     sprintf(sLoc, "test -d %s", sDir); 
00019     if ( system(sLoc) )  /* does  NOT exist */
00020     {
00021         sprintf(sLoc, "mkdir %s", sDir);
00022         system(sLoc);
00023     }
00024     /* could we make the dir ? */
00025     sprintf(sLoc, "test -d %s", sDir);
00026     if ( system(sLoc) )  /* does  NOT exist */
00027         ERROR("Failed to create dir %s", sDir);
00028     /* is dir writable */
00029     createFullFileName(fileNameLoc, sDir, (char*)"toto");
00030     sprintf(sLoc, "touch %s", fileNameLoc);
00031     if ( system(sLoc) )  /* failed */
00032         ERROR("Problem writing in dir %s", sDir);
00033     else
00034         unlink(fileNameLoc);
00035     return;
00036 }

Generated on Tue Nov 4 2014 13:04:32 for ECF by  doxygen 1.7.1