3 * NOV 1993 Erik Bos <erik@xs4all.nl>
5 * FindFile by Bob, hacked for dos & unixpaths by Erik.
7 * Bugfix by dash@ifi.uio.no: ToUnix() was called to often
21 #if defined(__linux__) || defined(sun)
24 #if defined(__NetBSD__) || defined(__FreeBSD__)
25 #include <sys/param.h>
26 #include <sys/mount.h>
27 #include <sys/errno.h>
30 #include <sys/statfs.h>
42 #define WINE_INI_USER "~/.winerc"
45 static void ExpandTildeString(char *s
)
48 char temp
[1024], *ptr
= temp
;
62 if ( (entry
= getpwuid(getuid())) == NULL
)
67 strcpy(s
, entry
->pw_dir
);
68 s
+= strlen(entry
->pw_dir
);
75 int DOS_GetFreeSpace(int drive
, long *size
, long *available
)
80 if (!DRIVE_IsValid(drive
)) return 0;
81 root
= DRIVE_GetRoot(drive
);
84 if (statfs( root
, &info
, 0, 0) < 0) {
86 if (statfs( root
, &info
) < 0) {
88 fprintf(stderr
,"dosfs: cannot do statfs(%s)\n", root
);
92 *size
= info
.f_bsize
* info
.f_blocks
;
94 *available
= info
.f_bfree
* info
.f_bsize
;
96 *available
= info
.f_bavail
* info
.f_bsize
;
101 /**********************************************************************
104 char *WineIniFileName(void)
107 static char *filename
= NULL
;
108 static char name
[256];
113 strcpy(name
, WINE_INI_USER
);
114 ExpandTildeString(name
);
115 if ((fd
= open(name
, O_RDONLY
)) != -1) {
120 if ((fd
= open(WINE_INI_GLOBAL
, O_RDONLY
)) != -1) {
122 filename
= WINE_INI_GLOBAL
;
125 fprintf(stderr
,"wine: can't open configuration file %s or %s !\n",
126 WINE_INI_GLOBAL
, WINE_INI_USER
);