/* * libopen.c: the openfifo() function * * Copyright (c) 2000 David Parsons. All rights reserved. * * This software is released under a berkeley-style copyright; the * details can be found in the file COPYRIGHT. */ #include #include #include #include #include FILE * openfifo(char *fifo) { struct stat st; int fd; if ( (fd = open(fifo, O_WRONLY)) == -1) return 0; if (fstat(fd, &st) == 0 && S_ISFIFO(st.st_mode)) return fdopen(fd, "w"); return 0; }