This is file_writable.c in view mode; [Download] [Up]
#import <sys/stat.h> /* stat */
#import <stdio.h> /* fgets */
#import <sys/param.h> /* MAXPATHLEN */
#import <string.h>
#import <stdlib.h> /* exit */
int main(int argc, char *argv[])
{
char *buf;
struct stat sbuf;
if (argc < 2)
exit(1);
/*
* examine the file name comeing in from standard in
* non writable files
*/
buf = argv[1];
if ( (stat(buf,&sbuf)== -1) || ((sbuf.st_mode & S_IWRITE)!= S_IWRITE ))
{
exit(1);
}
exit(0);
}These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.