| 453 | } |
| 454 | |
| 455 | dlb * |
| 456 | dlb_fopen(const char *name, const char *mode) |
| 457 | { |
| 458 | FILE *fp; |
| 459 | dlb *dp; |
| 460 | |
| 461 | if (!dlb_initialized) |
| 462 | return (dlb *) 0; |
| 463 | |
| 464 | /* only support reading; ignore possible binary flag */ |
| 465 | if (!mode || mode[0] != 'r') |
| 466 | return (dlb *) 0; |
| 467 | |
| 468 | dp = (dlb *) alloc(sizeof(dlb)); |
| 469 | if (do_dlb_fopen(dp, name, mode)) |
| 470 | dp->fp = (FILE *) 0; |
| 471 | else if ((fp = fopen_datafile(name, mode, DATAPREFIX)) != 0) |
| 472 | dp->fp = fp; |
| 473 | else { |
| 474 | /* can't find anything */ |
| 475 | free((genericptr_t) dp); |
| 476 | dp = (dlb *) 0; |
| 477 | } |
| 478 | |
| 479 | return dp; |
| 480 | } |
| 481 | |
| 482 | int |
| 483 | dlb_fclose(dlb *dp) |
no test coverage detected