From 53cf1b1c1c3f0c2b5067afccc2976b99a574a089 Mon Sep 17 00:00:00 2001 From: tim Date: Wed, 14 May 1997 15:30:41 +0000 Subject: Initial revision --- open.c | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 open.c (limited to 'open.c') diff --git a/open.c b/open.c deleted file mode 100644 index 2b6ee75..0000000 --- a/open.c +++ /dev/null @@ -1,25 +0,0 @@ -/* open.c: to insulate from the rest of rc. */ - -#include -#include "rc.h" - -/* - Opens a file with the necessary flags. Assumes the following - declaration for redirtype: - - enum redirtype { - rFrom, rCreate, rAppend, rHeredoc, rHerestring - }; -*/ - -static const int mode_masks[] = { - /* rFrom */ O_RDONLY, - /* rCreate */ O_TRUNC | O_CREAT | O_WRONLY, - /* rAppend */ O_APPEND | O_CREAT | O_WRONLY -}; - -extern int rc_open(const char *name, redirtype m) { - if ((unsigned) m >= arraysize(mode_masks)) - panic("bad mode passed to rc_open"); - return open(name, mode_masks[m], 0666); -} -- cgit v1.2.3