home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 6 File
/
06-File.zip
/
FILES202.ZIP
/
UTILITY.C
< prev
Wrap
C/C++ Source or Header
|
1989-02-23
|
1KB
|
68 lines
/* utility.c
**
** Copyright (c) 1988-89, Christopher Laforet
** All Rights Reserved
**
** (v1.xx) for Turbo-C
** (v2.xx) for OS/2 - CML 2-89
**
*/
#define LINT_ARGS
#include <stdio.h>
#include <ctype.h>
#include <os2.h>
#include "files.h"
unsigned char *months[] =
{
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec",
};
void convert_date(date,date_string)
FDATE *date;
unsigned char *date_string;
{
sprintf(date_string,"%2u-%3.3s-%4.4u",date->day,months[date->month - 1],1980 + date->year);
}
void convert_time(time,time_string)
FTIME *time;
unsigned char *time_string;
{
sprintf(time_string,"%2u:%02u",time->hours,time->minutes);
}
unsigned long get_disk_space(path)
unsigned char *path;
{
FSALLOCATE diskinfo;
unsigned short drive = 0; /* default drive */
unsigned long rtn;
if (path[1] == ':') /* drive specifier? */
{
drive = (toupper(path[0]) - 'A') + 1;
}
DosQFSInfo(drive,1,(PBYTE)&diskinfo,sizeof(FSALLOCATE));
rtn = diskinfo.cUnitAvail * diskinfo.cSectorUnit * diskinfo.cbSector;
return(rtn);
}