home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hall of Fame
/
HallofFameCDROM.cdr
/
proglc
/
zoo141_c.lzh
/
BSD.C
< prev
next >
Wrap
C/C++ Source or Header
|
1987-02-07
|
2KB
|
71 lines
/* machine.c for 4.3BSD. */
/*
The contents of this file are hereby released to the public domain.
-- Rahul Dhesi 1986/12/31
*/
long tell();
/****************
function trunc() truncates a file.
*/
int trunc (handle)
int handle;
{
ftruncate (handle, tell(handle));
}
/****************
Function fixfname() converts the supplied filename to a syntax
legal for the host system. It is used during extraction.
*/
char *fixfname(fname)
char *fname;
{
return (fname); /* default is no-op */
}
/****************
Date and time functions are standard UNIX-style functions. "nixtime.i"
will be included by machine.c.
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
/* Function isadir() returns 1 if the supplied handle is a directory,
else it returns 0.
*/
int isadir (handle)
int handle;
{
struct stat buf; /* buffer to hold file information */
if (fstat (handle, &buf) == -1) {
return (0); /* inaccessible -- assume not dir */
} else {
if (buf.st_mode & S_IFDIR)
return (1);
else
return (0);
}
}
/* Function gettz(), returns the offset from GMT in seconds */
long gettz()
{
struct timeval tp;
struct timezone tzp;
gettimeofday (&tp, &tzp); /* specific to 4.3BSD */
/* return (tzp.tz_minuteswest * 60 + (tzp.tz_dsttime != 0 ? 60L * 60L : 0));*/
return (tzp.tz_minuteswest * 60);
}
/* Standard UNIX-compatible time routines */
#include "nixtime.i"