This is removeFile.c in view mode; [Download] [Up]
{\rtf0\ansi{\fonttbl\f0\fmodern Courier;\f1\ftech Symbol;} \paperw11640 \paperh8400 \margl120 \margr120 \pard\tx520\tx1060\tx1600\tx2120\tx2660\tx3200\tx3720\tx4260\tx4800\tx5320\f0\b0\i0\ulnone\fs24\fc0\cf0 //ÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐ\ // \i \b FILENAME \b0 : \b\i0 removeFile.c\ \b0 // \i \b SUMMARY \b0 : \b\i0 Garbage Collection. \b0 \ // \b\i AUTHOR \b0 : \b\i0 Rohit Khare \b0 \ // \b\i COPYRIGHT \b0 : \f1\i0 Ó \f0\b 1993,94 California Institure of Technology, eText Project\ \b0 //ÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐ\ // \b\i Description \b0\i0 \ // This is supposed to be equivalent to \i rm -rf %s \i0 , but I'm having trouble.\ //ÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐ\ // \b\i HISTORY \b0\i0 \ // 10/06/94: \b Extracted from eTDoc in eText5. \i \ \b0\i0 //ÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐ\ // \b Imported Interfaces \b0 \ //\ #import " \b eTextKernel.h \b0 "\ \ //ÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐ\ // \b Garbage Collection (C code) \b0 \ //\ int \b removeFile \b0 (const char * \b file \b0 )\ \{\ struct \b stat \b0 \b st \b0 ;\ \ \b NXLogError \b0 (" \b Garbage Collecting \b0 %s\\n", \b file \b0 );\ if (!stat(file, &st)) \{\ if ((st. \b st_mode \b0 & S_IFMT) == \b S_IFDIR \b0 ) \{\ \i // Well-intentioned yet ineffective code.\ // DIR *dirp;\ // struct direct *dp;\ // char *leaf = NULL;\ // char path[MAXPATHLEN];\ //dirp = opendir(file);\ //for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) \{\ //if (strcmp(dp->d_name, ".") && strcmp(dp->d_name, "..")) \{\ // if (!leaf) \{\ // strcpy(path, file);\ // strcat(path, "/");\ // leaf = path + strlen(path);\ // \}\ // strcpy(leaf, dp->d_name);\ // if (unlink(path)) \{\ // closedir(dirp);\ // return -1;\ // \}\ //\}\ //\}\ //return rmdir(file);\ \i0 char \b cmd \b0 [MAXPATHLEN];\ \ \b sprintf \b0 ( \b cmd \b0 , " \b rm -rf \\"%s\\" \b0 ", \b file \b0 );\ return \b system \b0 ( \b cmd \b0 );\ \} else \{\ return \b unlink \b0 ( \b file \b0 );\ \}\ \}\ \ return -1;\ \}\ }
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.