DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ T c

⟦fdd9c25cc⟧ TextFile

    Length: 711 (0x2c7)
    Types: TextFile
    Names: »canwrite.c«

Derivation

└─⟦87ddcff64⟧ Bits:30001253 CPHDIST85 Tape, 1985 Autumn Conference Copenhagen
    └─ ⟦this⟧ »cph85dist/stat/src/canwrite.c« 

TextFile

/* LINTLIBRARY */
#include "unixstat.h"
FUN(canwrite,get file write permission,5.0,1985)

/* returns true if it is okay to write on a file that might exist */
canwrite (filename) char *filename;
	{
	if (access (filename, 0)) return (1); /* no such file */
	return (confirm ("Overwrite %s?", filename));
	}

#ifdef MSDOS /* provide a version of the access(2) function */
/* MSDOS does not have the access function. */
/* This version fakes it by checking for readability. */
access (file, mode)
char	*file;
int 	mode;     /* this is ignored in MSDOS version */
	{
	FILE	*ioptr;
	if (ioptr = fopen (file, "r"))
		{
		VOID fclose (ioptr);
		return (0); /* all is okay */
		}
	return (1); /* no access */
	}
#endif