Metropoli BBS
VIEWER: xopen.c MODE: TEXT (ASCII)
/************************************************************************/
/*                                                                      */
/*  Create all subdirectories of a given pathname                       */
/*                                                                      */
/*  Bug reports should be sent to                                       */
/*                                                                      */
/*  harald@os2point.ping.de                                             */
/*  harald@haport.sesam.com                                             */
/*  Fido: 2:2448/434                                                    */
/*                                                                      */
/************************************************************************/

#define INCL_DOSPROCESS
#include <os2.h>

#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <share.h>

#include <lprintf.h>
#include <chanlib.h>


FILE *xopen(const char *name, const char *mode)
{
    FILE *fp;
    int s = *mode == 'r' ? SH_DENYWR : SH_DENYRW;
    int i;

    for(i = 0; i < 20;) {
        if((fp = _fsopen(name, mode, s)) != NULL || errno != EACCES)
            break;
        DosSleep(++i * 100);
    }

    return(fp);
}
[ RETURN TO DIRECTORY ]