/ Open file routine: the purpose of this routine is to make a list */ of all open file so they can be closed in SQLINIT on error jump. */ /
| 809 | /* of all open file so they can be closed in SQLINIT on error jump. */ |
| 810 | /***********************************************************************/ |
| 811 | FILE *PlugOpenFile(PGLOBAL g, LPCSTR fname, LPCSTR ftype) |
| 812 | { |
| 813 | FILE *fop; |
| 814 | PFBLOCK fp; |
| 815 | PDBUSER dbuserp = (PDBUSER)g->Activityp->Aptr; |
| 816 | |
| 817 | if (trace(1)) { |
| 818 | htrc("PlugOpenFile: fname=%s ftype=%s\n", fname, ftype); |
| 819 | htrc("dbuserp=%p\n", dbuserp); |
| 820 | } // endif trace |
| 821 | |
| 822 | if ((fop= global_fopen(g, MSGID_OPEN_MODE_STRERROR, fname, ftype)) != NULL) { |
| 823 | if (trace(1)) |
| 824 | htrc(" fop=%p\n", fop); |
| 825 | |
| 826 | fp = (PFBLOCK)PlugSubAlloc(g, NULL, sizeof(FBLOCK)); |
| 827 | |
| 828 | if (trace(1)) |
| 829 | htrc(" fp=%p\n", fp); |
| 830 | |
| 831 | // fname may be in volatile memory such as stack |
| 832 | fp->Fname = PlugDup(g, fname); |
| 833 | fp->Count = 1; |
| 834 | fp->Type = TYPE_FB_FILE; |
| 835 | fp->File = fop; |
| 836 | fp->Mode = MODE_ANY; // ??? |
| 837 | fp->Next = dbuserp->Openlist; |
| 838 | dbuserp->Openlist = fp; |
| 839 | } /* endif fop */ |
| 840 | |
| 841 | if (trace(1)) |
| 842 | htrc(" returning fop=%p\n", fop); |
| 843 | |
| 844 | return (fop); |
| 845 | } // end of PlugOpenFile |
| 846 | |
| 847 | /***********************************************************************/ |
| 848 | /* Close file routine: the purpose of this routine is to avoid */ |
no test coverage detected