This is pathutil.c in view mode; [Download] [Up]
/* this is a bogus .c file to cover for the disapearence of the text lib */
#import <c.h> /* TRUE/FALSE */
#import <strings.h>
#import <sys/param.h> /* MAXPATHLEN */
#import <sys/types.h>
#import <sys/stat.h>
extern char *basename(s)
char *s;
{ char *ptr;
ptr = rindex(s,'/');
if (!ptr) ptr = s;
else ptr++; /* walk past the slash */
return ptr;
}
extern char *parentname(s)
char *s;
{
char *ptr;
static char buf[MAXPATHLEN+1];
strcpy(buf,s);
ptr = rindex(buf,'/');
if (ptr) {
if (ptr == buf)
ptr[1]='\0';
else *ptr = '\0';
} else buf[0] = '\0';
return buf;
}
extern int isDirectory(s)
char *s;
{
struct stat buf;
int flag;
if (stat(s,&buf) == 0){
if ((buf.st_mode & S_IFDIR) == S_IFDIR)
flag = TRUE;
else flag = FALSE;
} else flag = FALSE;
return flag;
}
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.