Changeset 15 for trunk/src/helpers/dosh.c
- Timestamp:
- Dec 11, 2000, 8:54:20 AM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/dosh.c
r14 r15 178 178 179 179 return (s_brc); 180 }181 182 /*183 *@@ doshQueryAvailPhysMem:184 * returns the amount of physical memory which185 * is presently available (before the swapper186 * would have to be expanded).187 *188 * This number is calculated by getting the189 * total available memory (QSV_TOTRESMEM)190 * and subtracting the free space on the191 * drive with the swap file from it.192 *193 * As a result, you also need to specify194 * the logical drive on which the swapper195 * resides (3 = C, 4 = D, and so on).196 *197 *@@added V0.9.7 (2000-12-01) [umoeller]198 */199 200 APIRET doshQueryAvailPhysMem(PULONG pulMem,201 ULONG ulLogicalSwapDrive)202 {203 APIRET arc = DosQuerySysInfo(QSV_TOTAVAILMEM,204 QSV_TOTAVAILMEM,205 pulMem,206 sizeof(*pulMem));207 if (arc == NO_ERROR)208 {209 double dFree = 0;210 arc = doshQueryDiskFree(ulLogicalSwapDrive,211 &dFree);212 *pulMem -= (ULONG)dFree;213 }214 215 return (arc);216 180 } 217 181 … … 895 859 * 896 860 *@@added V0.9.6 (2000-10-16) [umoeller] 861 *@@changed V0.9.7 (2000-12-10) [umoeller]: fixed "F:filename.ext" case 897 862 */ 898 863 899 864 PSZ doshGetExtension(const char *pcszFilename) 900 865 { 901 PSZ p szExtension = 0;866 PSZ pReturn = NULL; 902 867 903 868 if (pcszFilename) 904 869 { 905 870 // find filename 906 PSZ p2 = strrchr(pcszFilename + 2, '\\'), 907 // works on "C:\blah" or "\\unc\blah" 908 p3 = NULL; 909 910 if (!p2) 911 // no backslash found: then this is not qualified... 912 // use start of filename 913 p2 = (PSZ)pcszFilename; 871 const char *p2 = strrchr(pcszFilename + 2, '\\'), 872 // works on "C:\blah" or "\\unc\blah" 873 *pStartOfName = NULL, 874 *pExtension = NULL; 875 876 if (p2) 877 pStartOfName = p2 + 1; 878 else 879 { 880 // no backslash found: 881 // maybe only a drive letter was specified: 882 if (*(pcszFilename + 1) == ':') 883 // yes: 884 pStartOfName = pcszFilename + 2; 885 else 886 // then this is not qualified at all... 887 // use start of filename 888 pStartOfName = (PSZ)pcszFilename; 889 } 914 890 915 891 // find last dot in filename 916 p 3 = strrchr(p2 + 1, '.');917 if (p 3)918 p szExtension = p3+ 1;919 } 920 921 return (p szExtension);892 pExtension = strrchr(pStartOfName, '.'); 893 if (pExtension) 894 pReturn = (PSZ)pExtension + 1; 895 } 896 897 return (pReturn); 922 898 } 923 899
Note:
See TracChangeset
for help on using the changeset viewer.