]> icculus.org git repositories - btb/d2x.git/blob - arch/dos_findfile.c
add --enable-xploader, support arch/linux subdir, fix NASMFLAGS.
[btb/d2x.git] / arch / dos_findfile.c
1 /*
2 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
3 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
4 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
5 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
6 IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
7 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
8 FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
9 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
10 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.  
11 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
12 */
13
14 /*
15  * $Source: /cvs/cvsroot/d2x/arch/dos_findfile.c,v $
16  * $Revision: 1.3 $
17  * $Author: bradleyb $
18  * $Date: 2001-01-31 14:04:44 $
19  *
20  * Dos findfile functions
21  *
22  * $Log: not supported by cvs2svn $
23  * Revision 1.2  2001/01/29 13:35:08  bradleyb
24  * Fixed build system, minor fixes
25  *
26  */
27
28 #ifdef HAVE_CONFIG_H
29 #include <conf.h>
30 #endif
31
32 #include <dos.h>
33 #include <string.h>
34
35 #include "findfile.h"
36
37
38 //      Global Variables        ----------------------------------------------------------
39
40 static int                              _FileFindFlag = 0;
41 static struct find_t _FileFindStruct;
42
43
44
45 //      Functions
46
47 int     FileFindFirst(char *search_str, FILEFINDSTRUCT *ffstruct)
48 {
49         unsigned retval;
50         
51         if (_FileFindFlag) return -1;
52         
53         retval = _dos_findfirst(search_str, 0, &_FileFindStruct);
54         if (retval) return (int)retval;
55         else {
56                 ffstruct->size = _FileFindStruct.size;
57                 strcpy(ffstruct->name, _FileFindStruct.name);
58                 _FileFindFlag = 1;
59                 return (int)retval;
60         }
61 }
62
63
64 int     FileFindNext(FILEFINDSTRUCT *ffstruct)
65 {
66         unsigned retval;
67
68         if (!_FileFindFlag) return -1;
69
70         retval = _dos_findnext(&_FileFindStruct);
71         if (retval) return (int)retval;
72         else {
73                 ffstruct->size = _FileFindStruct.size;
74                 strcpy(ffstruct->name, _FileFindStruct.name);
75                 return (int)retval;
76         }       
77 }
78  
79
80 int     FileFindClose(void)
81 {
82         unsigned retval = 0;
83
84         if (!_FileFindFlag) return -1;
85         
86         if (retval) return (int)retval;
87         else {
88                 _FileFindFlag = 0;
89                 return (int)retval;
90         }
91 }
92
93 /*
94
95 //returns 0 if no error
96 int GetFileDateTime(int filehandle, FILETIMESTRUCT *ftstruct)
97 {
98         return _dos_getftime(filehandle, &ftstruct->date, &ftstruct->time);
99
100 }
101
102
103 //returns 0 if no error
104 int SetFileDateTime(int filehandle, FILETIMESTRUCT *ftstruct)
105 {
106         return _dos_setftime(filehandle, ftstruct->date, ftstruct->time);
107 }
108
109 */