home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 9 Archive
/
09-Archive.zip
/
OS2ARC_S.ZIP
/
ARCDOS.C
< prev
next >
Wrap
C/C++ Source or Header
|
1987-10-16
|
2KB
|
85 lines
/* ARC - Archive utility - ARCDOS
$define(tag,$$segment(@1,$$index(@1,=)+1))#
$define(version,Version $tag(
TED_VERSION DB =1.43), created on $tag(
TED_DATE DB =11/09/85) at $tag(
TED_TIME DB =22:24:44))#
$undefine(tag)#
$version
(C) COPYRIGHT 1985 by System Enhancement Associates; ALL RIGHTS RESERVED
By: Thom Henderson
Description:
This file contains certain DOS level routines that assist
in doing fancy things with an archive, primarily reading and
setting the date and time last modified.
These are, by nature, system dependant functions. But they are
also, by nature, very expendable.
Language:
Computer Innovations Optimizing C86
*/
#include <stdio.h>
#include "arc.h"
/*
* Define OS/2 procedures we are using here
*/
extern far pascal DOSQFILEINFO(int, int, unsigned char far *, int);
extern far pascal DOSSETFILEINFO(int, int, unsigned char far *, int);
typedef struct FileInfo {
unsigned int cdate;
unsigned int ctime;
unsigned int adate;
unsigned int atime;
unsigned int wdate;
unsigned int wtime;
unsigned long filesize;
unsigned long filealloc;
unsigned int attribute;
} FILEINFO;
FILEINFO finfo;
getstamp(f,date,time) /* get a file's date/time stamp */
FILE *f; /* file to get stamp from */
unsigned int *date, *time; /* storage for the stamp */
{
int res;
if (res = DOSQFILEINFO(fileno(f),1,(unsigned char far *)
&finfo,sizeof(FILEINFO)))
printf("Get timestamp fail (%d)\n",res);
*date = finfo.wdate; /* save date/time */
*time = finfo.wtime;
}
setstamp(f,date,time) /* set a file's date/time stamp */
FILE *f; /* file to set stamp on */
unsigned int date, time; /* desired date, time */
{
int res;
fflush(f); /* force any pending output */
finfo.cdate = finfo.ctime = finfo.adate = finfo.atime = 0;
finfo.wdate = date;
finfo.wtime = time;
if (res = DOSSETFILEINFO(fileno(f),1,(unsigned char far *) &finfo,12))
printf("Set timestamp fail (%d)\n",res);
}
static int filehand(stream) /* find handle on a file */
FILE *stream; /* file to grab onto */
{
return fileno(stream); /* return DOS 2.0 file handle *//*mpl*/
}