|
| iMatix home page | << | < | > | >> |
SMTVersion 2.81 |
#include "smtlib.h" int lazy_open (char *path, int flags)
Calls the standard open() function without blocking. Returns a file handle when the call succeeds, else returns -1 and sets errno to the cause of the error. The file is always opened in binary mode, and you must process control characters yourself. If the call would block, returns -1, sets errno to EAGAIN, and calls recycle module() to re-execute the current dialog module automatically. You can override this behavious by calling recycle module (FALSE) after the return. Sets the global variable "io_completed" to TRUE if the i/o access completed, with or without an error.
handle_input = lazy_open (filename, O_RDONLY);
handle_output = lazy_open (filename, O_WRONLY | O_CREAT | O_TRUNC);
handle_append = lazy_open (filename, O_WRONLY | O_CREAT | O_APPEND);
if (io_completed && handle < 0)
have error on file
{
int rc;
#if (defined (SMT_TRACE))
trace ("lazy_open: path=%s", path);
#endif
rc = open (path, flags | O_NONBLOCK | O_BINARY, S_IREAD | S_IWRITE);
set_io_completed (rc);
return (rc);
}
| | << | < | > | >> |
|