/*
- * $Id: hqx.c,v 1.4 2001-03-29 16:40:35 rufustfirefly Exp $
+ * $Id: hqx.c,v 1.5 2001-05-01 13:21:22 rufustfirefly Exp $
*/
#ifdef HAVE_CONFIG_H
# include <netinet/in.h>
#endif
#endif notdef
+#include <time.h>
#include <fcntl.h>
#include <string.h>
#include <syslog.h>
/* These are field sizes in bytes of various pieces of the
binhex header
*/
-#define BVERSION 1
-#define TCSIZ 8
-#define FLAGSIZ 2
-#define DATASIZ 4
-#define RESSIZ 4
-#define CRCSIZ 2
-#define HEADSIZ 21
+#define BHH_VERSION 1
+#define BHH_TCSIZ 8
+#define BHH_FLAGSIZ 2
+#define BHH_DATASIZ 4
+#define BHH_RESSIZ 4
+#define BHH_CRCSIZ 2
+#define BHH_HEADSIZ 21
u_short updcrc();
here; skip_junk leaves hqx7_first and hqx7_last set.
*/
-hqx_open( hqxfile, flags, fh, options )
+int hqx_open( hqxfile, flags, fh, options )
char *hqxfile;
int flags, options;
struct FHeader *fh;
* Otherwise, a value of -1 is returned.
*/
-hqx_close( keepflag )
+int hqx_close( keepflag )
int keepflag;
{
if ( keepflag == KEEP ) {
* return zero and no more than that.
*/
-hqx_read( fork, buffer, length )
+int hqx_read( fork, buffer, length )
int fork;
char *buffer;
int length;
* to fill the hqx_header fields.
*/
-hqx_header_read( fh )
+int hqx_header_read( fh )
struct FHeader *fh;
{
char *headerbuf, *headerptr;
#endif
if (( headerbuf =
- (char *)malloc( (unsigned int)( namelen + HEADSIZ ))) == 0 ) {
+ (char *)malloc( (unsigned int)( namelen + BHH_HEADSIZ ))) == 0 ) {
return( -1 );
}
- if ( hqx_7tobin( headerbuf, ( namelen + HEADSIZ )) == 0 ) {
+ if ( hqx_7tobin( headerbuf, ( namelen + BHH_HEADSIZ )) == 0 ) {
free( headerbuf );
fprintf( stderr, "Premature end of file :" );
return( -2 );
}
headerptr = headerbuf;
hqx.headercrc = updcrc( hqx.headercrc,
- (u_char *)headerbuf, ( namelen + HEADSIZ - CRCSIZ ));
+ (u_char *)headerbuf, ( namelen + BHH_HEADSIZ - BHH_CRCSIZ ));
#if HEXOUTPUT
- write( headerfork, headerbuf, ( namelen + HEADSIZ ));
+ write( headerfork, headerbuf, ( namelen + BHH_HEADSIZ ));
#endif
/*
headerptr += TCSIZ;
memcpy(&fh->finder_info.fdFlags, headerptr, FLAGSIZ );
fh->finder_info.fdFlags = fh->finder_info.fdFlags & mask;
- headerptr += FLAGSIZ;
- memcpy(&fh->forklen[ DATA ], headerptr, DATASIZ );
+ headerptr += BHH_FLAGSIZ;
+ memcpy(&fh->forklen[ DATA ], headerptr, BHH_DATASIZ );
hqx.forklen[ DATA ] = ntohl( fh->forklen[ DATA ] );
- headerptr += DATASIZ;
- memcpy( &fh->forklen[ RESOURCE ], headerptr, RESSIZ );
+ headerptr += BHH_DATASIZ;
+ memcpy( &fh->forklen[ RESOURCE ], headerptr, BHH_RESSIZ );
hqx.forklen[ RESOURCE ] = ntohl( fh->forklen[ RESOURCE ] );
- headerptr += RESSIZ;
- memcpy(&header_crc, headerptr, CRCSIZ );
- headerptr += CRCSIZ;
+ headerptr += BHH_RESSIZ;
+ memcpy(&header_crc, headerptr, BHH_CRCSIZ );
+ headerptr += BHH_CRCSIZ;
header_crc = ntohs( header_crc );
/*
* hqx_header_write.
*/
-hqx_header_write( fh )
+int hqx_header_write( fh )
struct FHeader *fh;
{
return( -1 );
* it sets the pointers to the hqx7 buffer up to point to the valid data.
*/
-hqx7_fill( hqx7_ptr )
+int hqx7_fill( hqx7_ptr )
u_char *hqx7_ptr;
{
int cc;
* OTHER when looking for any subsequent line.
*/
-skip_junk( line )
+int skip_junk( line )
int line;
{
int found = NOWAY;
* file is reached.
*/
-hqx_7tobin( outbuf, datalen )
+int hqx_7tobin( outbuf, datalen )
char *outbuf;
int datalen;
{
static u_char hqx8[3];
- static char hqx8i;
+ static int hqx8i;
static u_char prev_hqx8;
static u_char prev_out;
static u_char prev_hqx7;
static int eofflag;
u_char hqx7[4];
- char hqx7i = 0;
+ int hqx7i = 0;
char *out_first;
char *out_last;