Changed all integer types to intN_t types

This commit is contained in:
Ianos Gnatiuc 2005-10-21 17:47:34 +00:00
parent 6a9a1b0834
commit ec38c82df5
5 changed files with 933 additions and 936 deletions

File diff suppressed because it is too large Load Diff

View File

@ -4,80 +4,78 @@
/* $Id$ */
/****************************************************************************
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Rob Swindell's conversion of 1988 LZH (LHarc) encoding functions *
* Based on Japanese version 29-NOV-1988 *
* LZSS coded by Haruhiko Okumura *
* Adaptive Huffman Coding coded by Haruyasu Yoshizaki *
* *
* Anonymous FTP access to the most recent released source is available at *
* ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
* *
* Anonymous CVS access to the development source and modification history *
* is available at cvs.synchro.net:/cvsroot/sbbs, example: *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login *
* (just hit return, no password is necessary) *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src *
* *
* For Synchronet coding style and modification guidelines, see *
* http://www.synchro.net/source.html *
* *
* You are encouraged to submit any modifications (preferably in Unix diff *
* format) via e-mail to mods@synchro.net *
* *
* Note: If this box doesn't appear square, then you need to fix your tabs. *
/****************************************************************************
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Rob Swindell's conversion of 1988 LZH (LHarc) encoding functions *
* Based on Japanese version 29-NOV-1988 *
* LZSS coded by Haruhiko Okumura *
* Adaptive Huffman Coding coded by Haruyasu Yoshizaki *
* *
* Anonymous FTP access to the most recent released source is available at *
* ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
* *
* Anonymous CVS access to the development source and modification history *
* is available at cvs.synchro.net:/cvsroot/sbbs, example: *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login *
* (just hit return, no password is necessary) *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src *
* *
* For Synchronet coding style and modification guidelines, see *
* http://www.synchro.net/source.html *
* *
* You are encouraged to submit any modifications (preferably in Unix diff *
* format) via e-mail to mods@synchro.net *
* *
* Note: If this box doesn't appear square, then you need to fix your tabs. *
****************************************************************************/
#include <gdefs.h>
#ifdef LZHEXPORT
#undef LZHEXPORT
#undef LZHEXPORT
#endif
#ifdef _WIN32
#ifndef __FLAT__
#define __FLAT__
#endif
#ifdef __BORLANDC__
#define LZHCALL __stdcall
#else
#define LZHCALL
#endif
#ifdef LZHDLL /* LZH functions in DLL */
#ifdef LZH_EXPORTS
#define LZHEXPORT __declspec( dllexport )
#else
#define LZHEXPORT __declspec( dllimport )
#endif
#else /* self-contained executable */
#define LZHEXPORT
#endif
#ifndef __FLAT__
#define __FLAT__
#endif
#ifdef __BORLANDC__
#define LZHCALL __stdcall
#else
#define LZHCALL
#endif
#ifdef LZHDLL /* LZH functions in DLL */
#ifdef LZH_EXPORTS
#define LZHEXPORT __declspec( dllexport )
#else
#define LZHEXPORT __declspec( dllimport )
#endif
#else /* self-contained executable */
#define LZHEXPORT
#endif
#elif defined(__unix__) || defined(__GNUC__)
#ifndef __FLAT__
#define __FLAT__
#endif
#define LZHCALL
#define LZHEXPORT
#else /* !_WIN32 */
#define LZHCALL
#define LZHEXPORT
#endif
#ifndef uchar
typedef unsigned char uchar;
#ifndef __FLAT__
#define __FLAT__
#endif
#define LZHCALL
#define LZHEXPORT
#else /* !_WIN32 */
#define LZHCALL
#define LZHEXPORT
#endif
#ifdef __cplusplus
extern "C" {
#endif
LZHEXPORT long LZHCALL lzh_encode(uchar *inbuf, long inlen, uchar *outbuf);
LZHEXPORT long LZHCALL lzh_decode(uchar *inbuf, long inlen, uchar *outbuf);
LZHEXPORT int32_t LZHCALL lzh_encode(uint8_t *inbuf, int32_t inlen, uint8_t *outbuf);
LZHEXPORT int32_t LZHCALL lzh_decode(uint8_t *inbuf, int32_t inlen, uint8_t *outbuf);
#ifdef __cplusplus
}
#endif
#ifdef __WATCOMC__ /* Use MSC standard (prepended underscore) */
#pragma aux lzh_encode "_*"
#ifdef __WATCOMC__ /* Use MSC standard (prepended underscore) */
#pragma aux lzh_encode "_*"
#pragma aux lzh_decode "_*"
#endif

View File

@ -386,93 +386,93 @@ enum {
typedef struct _PACK { // Time with time-zone
uint32_t time; // Local time (unix format)
short zone; // Time zone
uint32_t time; // Local time (unix format)
int16_t zone; // Time zone
} when_t;
typedef struct _PACK { // Index record
ushort to; // 16-bit CRC of recipient name (lower case)
ushort from; // 16-bit CRC of sender name (lower case)
ushort subj; // 16-bit CRC of subject (lower case, w/o RE:)
ushort attr; // attributes (read, permanent, etc.)
uint32_t offset; // offset into header file
uint32_t number; // number of message (1 based)
uint32_t time; // time/date message was imported/posted
uint16_t to; // 16-bit CRC of recipient name (lower case)
uint16_t from; // 16-bit CRC of sender name (lower case)
uint16_t subj; // 16-bit CRC of subject (lower case, w/o RE:)
uint16_t attr; // attributes (read, permanent, etc.)
uint32_t offset; // offset into header file
uint32_t number; // number of message (1 based)
uint32_t time; // time/date message was imported/posted
} idxrec_t;
typedef struct _PACK { // Message base header (fixed portion)
uchar id[LEN_HEADER_ID]; // SMB<^Z>
ushort version; // version number (initially 100h for 1.00)
ushort length; // length including this struct
uint8_t id[LEN_HEADER_ID]; // SMB<^Z>
uint16_t version; // version number (initially 100h for 1.00)
uint16_t length; // length including this struct
} smbhdr_t;
typedef struct _PACK { // Message base status header
uint32_t last_msg; // last message number
uint32_t total_msgs; // total messages
uint32_t header_offset; // byte offset to first header record
uint32_t max_crcs; // Maximum number of CRCs to keep in history
uint32_t max_msgs; // Maximum number of message to keep in sub
ushort max_age; // Maximum age of message to keep in sub (in days)
ushort attr; // Attributes for this message base (SMB_HYPER,etc)
uint32_t last_msg; // last message number
uint32_t total_msgs; // total messages
uint32_t header_offset;// byte offset to first header record
uint32_t max_crcs; // Maximum number of CRCs to keep in history
uint32_t max_msgs; // Maximum number of message to keep in sub
uint16_t max_age; // Maximum age of message to keep in sub (in days)
uint16_t attr; // Attributes for this message base (SMB_HYPER,etc)
} smbstatus_t;
typedef struct _PACK { // Message header
uchar id[LEN_HEADER_ID]; // SHD<^Z>
ushort type; // Message type (normally 0)
ushort version; // Version of type (initially 100h for 1.00)
ushort length; // Total length of fixed record + all fields
ushort attr; // Attributes (bit field) (duped in SID)
uint32_t auxattr; // Auxillary attributes (bit field)
uint32_t netattr; // Network attributes
when_t when_written; // Time message was written (unix format)
when_t when_imported; // Time message was imported
uint32_t number; // Message number
uint32_t thread_orig; // Original message number in thread
uint32_t thread_next; // Next message in thread
uint32_t thread_first; // First reply to this message
ushort delivery_attempts; // Delivery attempt counter
uchar reserved[14]; // Reserved for future use
uint32_t offset; // Offset for buffer into data file (0 or mod 256)
ushort total_dfields; // Total number of data fields
uint8_t id[LEN_HEADER_ID]; // SHD<^Z>
uint16_t type; // Message type (normally 0)
uint16_t version; // Version of type (initially 100h for 1.00)
uint16_t length; // Total length of fixed record + all fields
uint16_t attr; // Attributes (bit field) (duped in SID)
uint32_t auxattr; // Auxillary attributes (bit field)
uint32_t netattr; // Network attributes
when_t when_written; // Time message was written (unix format)
when_t when_imported; // Time message was imported
uint32_t number; // Message number
uint32_t thread_orig; // Original message number in thread
uint32_t thread_next; // Next message in thread
uint32_t thread_first; // First reply to this message
uint16_t delivery_attempts; // Delivery attempt counter
uint8_t reserved[14]; // Reserved for future use
uint32_t offset; // Offset for buffer into data file (0 or mod 256)
uint16_t total_dfields; // Total number of data fields
} msghdr_t;
typedef struct _PACK { // Data field
ushort type; // Type of data field
uint32_t offset; // Offset into buffer
uint32_t length; // Length of data field
uint16_t type; // Type of data field
uint32_t offset; // Offset into buffer
uint32_t length; // Length of data field
} dfield_t;
typedef struct _PACK { // Header field
ushort type;
ushort length; // Length of buffer
uint16_t type;
uint16_t length; // Length of buffer
} hfield_t;
typedef struct _PACK { // FidoNet address (zone:net/node.point)
ushort zone;
ushort net;
ushort node;
ushort point;
uint16_t zone;
uint16_t net;
uint16_t node;
uint16_t point;
} fidoaddr_t;
typedef struct _PACK { // Network (type and address)
ushort type;
void *addr;
uint16_t type;
void *addr;
} net_t;
@ -504,13 +504,13 @@ typedef struct { // Message
*ftn_msgid, // FTN MSGID
*ftn_reply, // FTN REPLY
*subj; // Subject
ushort to_agent, // Type of agent message is to
uint16_t to_agent, // Type of agent message is to
from_agent, // Type of agent message is from
replyto_agent; // Type of agent replies should be sent to
net_t to_net, // Destination network type and address
from_net, // Origin network address
replyto_net; // Network type and address for replies
ushort total_hfields; // Total number of header fields
uint16_t total_hfields; // Total number of header fields
hfield_t *hfield; // Header fields (fixed length portion)
void **hfield_dat; // Header fields (variable length portion)
dfield_t *dfield; // Data fields (fixed length portion)
@ -528,17 +528,17 @@ typedef struct { // Message base
FILE *sid_fp; // File pointer for index (.sid) file
FILE *sda_fp; // File pointer for data allocation (.sda) file
FILE *sha_fp; // File pointer for header allocation (.sha) file
uint32_t retry_time; // Maximum number of seconds to retry opens/locks
uint32_t retry_delay; // Time-slice yield (milliseconds) while retrying
uint32_t retry_time; // Maximum number of seconds to retry opens/locks
uint32_t retry_delay;// Time-slice yield (milliseconds) while retrying
smbstatus_t status; // Status header record
int locked; // SMB header is locked
char shd_buf[SHD_BLOCK_LEN]; // File I/O buffer for header file
char last_error[128]; // Last error message
char shd_buf[SHD_BLOCK_LEN]; // File I/O buffer for header file
char last_error[128]; // Last error message
/* Private member variables (not initialized by or used by smblib) */
uint subnum; // Sub-board number
long msgs; // Number of messages loaded (for user)
long curmsg; // Current message number (for user)
uint32_t subnum; // Sub-board number
uint32_t msgs; // Number of messages loaded (for user)
uint32_t curmsg; // Current message number (for user)
} smb_t;

View File

@ -659,11 +659,11 @@ uint32_t SMBCALL smb_getmsgdatlen(smbmsg_t* msg)
/****************************************************************************/
int SMBCALL smb_getmsghdr(smb_t* smb, smbmsg_t* msg)
{
hfield_t *vp;
void **vpp;
ushort i;
uint32_t l,offset;
idxrec_t idx;
hfield_t *vp;
void **vpp;
uint16_t i;
uint32_t l, offset;
idxrec_t idx;
if(smb->shd_fp==NULL) {
sprintf(smb->last_error,"msgbase not open");
@ -763,7 +763,7 @@ int SMBCALL smb_getmsghdr(smb_t* smb, smbmsg_t* msg)
break;
case SENDERAGENT:
if(!msg->forwarded)
msg->from_agent=*(ushort *)msg->hfield_dat[i];
msg->from_agent=*(uint16_t *)msg->hfield_dat[i];
break;
case SENDEREXT:
if(!msg->forwarded)
@ -771,7 +771,7 @@ int SMBCALL smb_getmsghdr(smb_t* smb, smbmsg_t* msg)
break;
case SENDERNETTYPE:
if(!msg->forwarded)
msg->from_net.type=*(ushort *)msg->hfield_dat[i];
msg->from_net.type=*(uint16_t *)msg->hfield_dat[i];
break;
case SENDERNETADDR:
if(!msg->forwarded)
@ -784,10 +784,10 @@ int SMBCALL smb_getmsghdr(smb_t* smb, smbmsg_t* msg)
msg->replyto_ext=(char *)msg->hfield_dat[i];
break;
case REPLYTOAGENT:
msg->replyto_agent=*(ushort *)msg->hfield_dat[i];
msg->replyto_agent=*(uint16_t *)msg->hfield_dat[i];
break;
case REPLYTONETTYPE:
msg->replyto_net.type=*(ushort *)msg->hfield_dat[i];
msg->replyto_net.type=*(uint16_t *)msg->hfield_dat[i];
break;
case REPLYTONETADDR:
msg->replyto_net.addr=(char *)msg->hfield_dat[i];
@ -799,10 +799,10 @@ int SMBCALL smb_getmsghdr(smb_t* smb, smbmsg_t* msg)
msg->to_ext=(char *)msg->hfield_dat[i];
break;
case RECIPIENTAGENT:
msg->to_agent=*(ushort *)msg->hfield_dat[i];
msg->to_agent=*(uint16_t *)msg->hfield_dat[i];
break;
case RECIPIENTNETTYPE:
msg->to_net.type=*(ushort *)msg->hfield_dat[i];
msg->to_net.type=*(uint16_t *)msg->hfield_dat[i];
break;
case RECIPIENTNETADDR:
msg->to_net.addr=(char *)msg->hfield_dat[i];
@ -855,7 +855,7 @@ int SMBCALL smb_getmsghdr(smb_t* smb, smbmsg_t* msg)
/****************************************************************************/
void SMBCALL smb_freemsgmem(smbmsg_t* msg)
{
ushort i;
uint16_t i;
if(msg->dfield) {
FREE(msg->dfield);
@ -925,7 +925,7 @@ int SMBCALL smb_unlockmsghdr(smb_t* smb, smbmsg_t* msg)
/****************************************************************************/
/* Adds a header field to the 'msg' structure (in memory only) */
/****************************************************************************/
int SMBCALL smb_hfield(smbmsg_t* msg, ushort type, size_t length, void* data)
int SMBCALL smb_hfield(smbmsg_t* msg, uint16_t type, size_t length, void* data)
{
hfield_t* vp;
void* *vpp;
@ -956,7 +956,7 @@ int SMBCALL smb_hfield(smbmsg_t* msg, ushort type, size_t length, void* data)
/****************************************************************************/
/* Searches for a specific header field (by type) and returns it */
/****************************************************************************/
void* SMBCALL smb_get_hfield(smbmsg_t* msg, ushort type, hfield_t* hfield)
void* SMBCALL smb_get_hfield(smbmsg_t* msg, uint16_t type, hfield_t* hfield)
{
int i;
@ -975,7 +975,7 @@ void* SMBCALL smb_get_hfield(smbmsg_t* msg, ushort type, hfield_t* hfield)
/* Automatically figures out the offset into the data buffer from existing */
/* dfield lengths */
/****************************************************************************/
int SMBCALL smb_dfield(smbmsg_t* msg, ushort type, uint32_t length)
int SMBCALL smb_dfield(smbmsg_t* msg, uint16_t type, uint32_t length)
{
dfield_t* vp;
int i,j;
@ -1175,8 +1175,8 @@ int SMBCALL smb_putmsgidx(smb_t* smb, smbmsg_t* msg)
/****************************************************************************/
int SMBCALL smb_putmsghdr(smb_t* smb, smbmsg_t* msg)
{
ushort i;
uint32_t l;
uint16_t i;
uint32_t l;
if(smb->shd_fp==NULL) {
sprintf(smb->last_error,"msgbase not open");
@ -1321,10 +1321,10 @@ uint32_t SMBCALL smb_hdrblocks(uint32_t length)
/* smb_close_da() should be called after */
/* Returns negative on error */
/****************************************************************************/
int32_t SMBCALL smb_allocdat(smb_t* smb, uint32_t length, ushort headers)
int32_t SMBCALL smb_allocdat(smb_t* smb, uint32_t length, uint16_t headers)
{
ushort i,j;
uint32_t l,blocks,offset=0L;
uint16_t i, j;
uint32_t l, blocks, offset = 0;
if(smb->sda_fp==NULL) {
sprintf(smb->last_error,"msgbase not open");
@ -1360,7 +1360,7 @@ int32_t SMBCALL smb_allocdat(smb_t* smb, uint32_t length, ushort headers)
/* Allocates space for data, but doesn't search for unused blocks */
/* Returns negative on error */
/****************************************************************************/
int32_t SMBCALL smb_fallocdat(smb_t* smb, uint32_t length, ushort headers)
int32_t SMBCALL smb_fallocdat(smb_t* smb, uint32_t length, uint16_t headers)
{
uint32_t l,blocks,offset;
@ -1388,13 +1388,12 @@ int32_t SMBCALL smb_fallocdat(smb_t* smb, uint32_t length, ushort headers)
/* De-allocates space for data */
/* Returns non-zero on error */
/****************************************************************************/
int SMBCALL smb_freemsgdat(smb_t* smb, uint32_t offset, uint32_t length
, ushort headers)
int SMBCALL smb_freemsgdat(smb_t* smb, uint32_t offset, uint32_t length, uint16_t headers)
{
int da_opened=0;
int retval=0;
ushort i;
uint32_t l,blocks;
int da_opened = 0;
int retval = 0;
uint16_t i;
uint32_t l, blocks;
if(smb->status.attr&SMB_HYPERALLOC) /* do nothing */
return(0);
@ -1446,10 +1445,10 @@ int SMBCALL smb_freemsgdat(smb_t* smb, uint32_t offset, uint32_t length
/* Adds to data allocation records for blocks starting at 'offset' */
/* Returns non-zero on error */
/****************************************************************************/
int SMBCALL smb_incdat(smb_t* smb, uint32_t offset, uint32_t length, ushort headers)
int SMBCALL smb_incdat(smb_t* smb, uint32_t offset, uint32_t length, uint16_t headers)
{
ushort i;
uint32_t l,blocks;
uint16_t i;
uint32_t l, blocks;
if(smb->sda_fp==NULL) {
sprintf(smb->last_error,"msgbase not open");
@ -1480,7 +1479,7 @@ int SMBCALL smb_incdat(smb_t* smb, uint32_t offset, uint32_t length, ushort head
/****************************************************************************/
int SMBCALL smb_freemsghdr(smb_t* smb, uint32_t offset, uint32_t length)
{
uchar c=0;
uint8_t c = 0;
uint32_t l,blocks;
if(smb->sha_fp==NULL) {
@ -1504,8 +1503,8 @@ int SMBCALL smb_freemsghdr(smb_t* smb, uint32_t offset, uint32_t length)
/****************************************************************************/
int SMBCALL smb_freemsg(smb_t* smb, smbmsg_t* msg)
{
int i;
ushort x;
int i;
uint16_t x;
if(smb->status.attr&SMB_HYPERALLOC) /* Nothing to do */
return(0);
@ -1530,9 +1529,9 @@ int SMBCALL smb_freemsg(smb_t* smb, smbmsg_t* msg)
/****************************************************************************/
int32_t SMBCALL smb_allochdr(smb_t* smb, uint32_t length)
{
uchar c;
ushort i;
uint32_t l,blocks,offset=0;
uint8_t c;
uint16_t i;
uint32_t l, blocks, offset = 0;
if(smb->sha_fp==NULL) {
sprintf(smb->last_error,"msgbase not open");
@ -1571,7 +1570,7 @@ int32_t SMBCALL smb_allochdr(smb_t* smb, uint32_t length)
/****************************************************************************/
int32_t SMBCALL smb_fallochdr(smb_t* smb, uint32_t length)
{
uchar c=1;
uint8_t c = 1;
uint32_t l,blocks,offset;
if(smb->sha_fp==NULL) {

View File

@ -5,34 +5,34 @@
/* $Id$ */
/****************************************************************************
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2000 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* See the GNU Lesser General Public License for more details: lgpl.txt or *
* http://www.fsf.org/copyleft/lesser.html *
* *
* Anonymous FTP access to the most recent released source is available at *
* ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
* *
* Anonymous CVS access to the development source and modification history *
* is available at cvs.synchro.net:/cvsroot/sbbs, example: *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login *
* (just hit return, no password is necessary) *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src *
* *
* For Synchronet coding style and modification guidelines, see *
* http://www.synchro.net/source.html *
* *
* You are encouraged to submit any modifications (preferably in Unix diff *
* format) via e-mail to mods@synchro.net *
* *
* Note: If this box doesn't appear square, then you need to fix your tabs. *
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2000 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* See the GNU Lesser General Public License for more details: lgpl.txt or *
* http://www.fsf.org/copyleft/lesser.html *
* *
* Anonymous FTP access to the most recent released source is available at *
* ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
* *
* Anonymous CVS access to the development source and modification history *
* is available at cvs.synchro.net:/cvsroot/sbbs, example: *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login *
* (just hit return, no password is necessary) *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src *
* *
* For Synchronet coding style and modification guidelines, see *
* http://www.synchro.net/source.html *
* *
* You are encouraged to submit any modifications (preferably in Unix diff *
* format) via e-mail to mods@synchro.net *
* *
* Note: If this box doesn't appear square, then you need to fix your tabs. *
****************************************************************************/
#ifndef _SMBLIB_H
@ -41,183 +41,183 @@
#include "lzh.h"
#ifdef SMBEXPORT
#undef SMBEXPORT
#undef SMBEXPORT
#endif
#ifndef __FLAT__
#define __FLAT__ /* only supporting 32-bit targets now */
#define __FLAT__ /* only supporting 32-bit targets now */
#endif
#ifdef _WIN32
#ifdef __BORLANDC__
#define SMBCALL __stdcall
#else
#define SMBCALL
#endif
#if defined(SMB_IMPORTS) || defined(SMB_EXPORTS)
#if defined(SMB_IMPORTS)
#define SMBEXPORT __declspec( dllimport )
#else
#define SMBEXPORT __declspec( dllexport )
#endif
#else /* self-contained executable */
#define SMBEXPORT
#endif
#ifdef __BORLANDC__
#define SMBCALL __stdcall
#else
#define SMBCALL
#endif
#if defined(SMB_IMPORTS) || defined(SMB_EXPORTS)
#if defined(SMB_IMPORTS)
#define SMBEXPORT __declspec( dllimport )
#else
#define SMBEXPORT __declspec( dllexport )
#endif
#else /* self-contained executable */
#define SMBEXPORT
#endif
#elif defined __unix__
#define SMBCALL
#define SMBEXPORT
#define SMBCALL
#define SMBEXPORT
#else
#define SMBCALL
#define SMBEXPORT
#define SMBCALL
#define SMBEXPORT
#endif
#include "smbdefs.h"
#define SMB_STACK_LEN 4 /* Max msg bases in smb_stack() */
#define SMB_STACK_LEN 4 /* Max msg bases in smb_stack() */
#define SMB_STACK_POP 0 /* Pop a msg base off of smb_stack()*/
#define SMB_STACK_PUSH 1 /* Push a msg base onto smb_stack() */
#define SMB_STACK_XCHNG 2 /* Exchange msg base w/last pushed */
#define SMB_STACK_XCHNG 2 /* Exchange msg base w/last pushed */
#define GETMSGTXT_TAILS (1<<0) /* Get message tail(s) */
#define GETMSGTXT_NO_BODY (1<<1) /* Do not retrieve message body */
#define GETMSGTXT_TAILS (1<<0) /* Get message tail(s) */
#define GETMSGTXT_NO_BODY (1<<1) /* Do not retrieve message body */
#define SMB_IS_OPEN(smb) ((smb)->shd_fp!=NULL)
#define SMB_IS_OPEN(smb) ((smb)->shd_fp!=NULL)
#ifdef __cplusplus
extern "C" {
#endif
SMBEXPORT int SMBCALL smb_ver(void);
SMBEXPORT char* SMBCALL smb_lib_ver(void);
SMBEXPORT int SMBCALL smb_open(smb_t* smb);
SMBEXPORT void SMBCALL smb_close(smb_t* smb);
SMBEXPORT int SMBCALL smb_open_da(smb_t* smb);
SMBEXPORT void SMBCALL smb_close_da(smb_t* smb);
SMBEXPORT int SMBCALL smb_open_ha(smb_t* smb);
SMBEXPORT void SMBCALL smb_close_ha(smb_t* smb);
SMBEXPORT int SMBCALL smb_create(smb_t* smb);
SMBEXPORT int SMBCALL smb_stack(smb_t* smb, int op);
SMBEXPORT int SMBCALL smb_trunchdr(smb_t* smb);
SMBEXPORT int SMBCALL smb_locksmbhdr(smb_t* smb);
SMBEXPORT int SMBCALL smb_getstatus(smb_t* smb);
SMBEXPORT int SMBCALL smb_putstatus(smb_t* smb);
SMBEXPORT int SMBCALL smb_unlocksmbhdr(smb_t* smb);
SMBEXPORT int SMBCALL smb_getmsgidx(smb_t* smb, smbmsg_t* msg);
SMBEXPORT int SMBCALL smb_getfirstidx(smb_t* smb, idxrec_t *idx);
SMBEXPORT int SMBCALL smb_getlastidx(smb_t* smb, idxrec_t *idx);
SMBEXPORT uint SMBCALL smb_getmsghdrlen(smbmsg_t* msg);
SMBEXPORT uint32_t SMBCALL smb_getmsgdatlen(smbmsg_t* msg);
SMBEXPORT int SMBCALL smb_lockmsghdr(smb_t* smb, smbmsg_t* msg);
SMBEXPORT int SMBCALL smb_getmsghdr(smb_t* smb, smbmsg_t* msg);
SMBEXPORT int SMBCALL smb_unlockmsghdr(smb_t* smb, smbmsg_t* msg);
SMBEXPORT int SMBCALL smb_addcrc(smb_t* smb, uint32_t crc);
SMBEXPORT int SMBCALL smb_hfield(smbmsg_t* msg, ushort type, size_t length, void* data);
SMBEXPORT int SMBCALL smb_dfield(smbmsg_t* msg, ushort type, uint32_t length);
SMBEXPORT void* SMBCALL smb_get_hfield(smbmsg_t* msg, ushort type, hfield_t* hfield);
SMBEXPORT int SMBCALL smb_addmsghdr(smb_t* smb, smbmsg_t* msg,int storage);
SMBEXPORT int SMBCALL smb_putmsg(smb_t* smb, smbmsg_t* msg);
SMBEXPORT int SMBCALL smb_putmsgidx(smb_t* smb, smbmsg_t* msg);
SMBEXPORT int SMBCALL smb_putmsghdr(smb_t* smb, smbmsg_t* msg);
SMBEXPORT void SMBCALL smb_freemsgmem(smbmsg_t* msg);
SMBEXPORT uint32_t SMBCALL smb_hdrblocks(uint32_t length);
SMBEXPORT uint32_t SMBCALL smb_datblocks(uint32_t length);
SMBEXPORT int32_t SMBCALL smb_allochdr(smb_t* smb, uint32_t length);
SMBEXPORT int32_t SMBCALL smb_fallochdr(smb_t* smb, uint32_t length);
SMBEXPORT int32_t SMBCALL smb_hallochdr(smb_t* smb);
SMBEXPORT int32_t SMBCALL smb_allocdat(smb_t* smb, uint32_t length, ushort headers);
SMBEXPORT int32_t SMBCALL smb_fallocdat(smb_t* smb, uint32_t length, ushort headers);
SMBEXPORT int32_t SMBCALL smb_hallocdat(smb_t* smb);
SMBEXPORT int SMBCALL smb_incdat(smb_t* smb, uint32_t offset, uint32_t length, ushort headers);
SMBEXPORT int SMBCALL smb_freemsg(smb_t* smb, smbmsg_t* msg);
SMBEXPORT int SMBCALL smb_freemsgdat(smb_t* smb, uint32_t offset, uint32_t length, ushort headers);
SMBEXPORT int SMBCALL smb_freemsghdr(smb_t* smb, uint32_t offset, uint32_t length);
SMBEXPORT void SMBCALL smb_freemsgtxt(char* buf);
SMBEXPORT int SMBCALL smb_copymsgmem(smbmsg_t* destmsg, smbmsg_t* srcmsg);
SMBEXPORT int SMBCALL smb_ver(void);
SMBEXPORT char* SMBCALL smb_lib_ver(void);
SMBEXPORT int SMBCALL smb_open(smb_t* smb);
SMBEXPORT void SMBCALL smb_close(smb_t* smb);
SMBEXPORT int SMBCALL smb_open_da(smb_t* smb);
SMBEXPORT void SMBCALL smb_close_da(smb_t* smb);
SMBEXPORT int SMBCALL smb_open_ha(smb_t* smb);
SMBEXPORT void SMBCALL smb_close_ha(smb_t* smb);
SMBEXPORT int SMBCALL smb_create(smb_t* smb);
SMBEXPORT int SMBCALL smb_stack(smb_t* smb, int op);
SMBEXPORT int SMBCALL smb_trunchdr(smb_t* smb);
SMBEXPORT int SMBCALL smb_locksmbhdr(smb_t* smb);
SMBEXPORT int SMBCALL smb_getstatus(smb_t* smb);
SMBEXPORT int SMBCALL smb_putstatus(smb_t* smb);
SMBEXPORT int SMBCALL smb_unlocksmbhdr(smb_t* smb);
SMBEXPORT int SMBCALL smb_getmsgidx(smb_t* smb, smbmsg_t* msg);
SMBEXPORT int SMBCALL smb_getfirstidx(smb_t* smb, idxrec_t *idx);
SMBEXPORT int SMBCALL smb_getlastidx(smb_t* smb, idxrec_t *idx);
SMBEXPORT uint32_t SMBCALL smb_getmsghdrlen(smbmsg_t* msg);
SMBEXPORT uint32_t SMBCALL smb_getmsgdatlen(smbmsg_t* msg);
SMBEXPORT int SMBCALL smb_lockmsghdr(smb_t* smb, smbmsg_t* msg);
SMBEXPORT int SMBCALL smb_getmsghdr(smb_t* smb, smbmsg_t* msg);
SMBEXPORT int SMBCALL smb_unlockmsghdr(smb_t* smb, smbmsg_t* msg);
SMBEXPORT int SMBCALL smb_addcrc(smb_t* smb, uint32_t crc);
SMBEXPORT int SMBCALL smb_hfield(smbmsg_t* msg, uint16_t type, size_t length, void* data);
SMBEXPORT int SMBCALL smb_dfield(smbmsg_t* msg, uint16_t type, uint32_t length);
SMBEXPORT void* SMBCALL smb_get_hfield(smbmsg_t* msg, uint16_t type, hfield_t* hfield);
SMBEXPORT int SMBCALL smb_addmsghdr(smb_t* smb, smbmsg_t* msg,int storage);
SMBEXPORT int SMBCALL smb_putmsg(smb_t* smb, smbmsg_t* msg);
SMBEXPORT int SMBCALL smb_putmsgidx(smb_t* smb, smbmsg_t* msg);
SMBEXPORT int SMBCALL smb_putmsghdr(smb_t* smb, smbmsg_t* msg);
SMBEXPORT void SMBCALL smb_freemsgmem(smbmsg_t* msg);
SMBEXPORT uint32_t SMBCALL smb_hdrblocks(uint32_t length);
SMBEXPORT uint32_t SMBCALL smb_datblocks(uint32_t length);
SMBEXPORT int32_t SMBCALL smb_allochdr(smb_t* smb, uint32_t length);
SMBEXPORT int32_t SMBCALL smb_fallochdr(smb_t* smb, uint32_t length);
SMBEXPORT int32_t SMBCALL smb_hallochdr(smb_t* smb);
SMBEXPORT int32_t SMBCALL smb_allocdat(smb_t* smb, uint32_t length, uint16_t headers);
SMBEXPORT int32_t SMBCALL smb_fallocdat(smb_t* smb, uint32_t length, uint16_t headers);
SMBEXPORT int32_t SMBCALL smb_hallocdat(smb_t* smb);
SMBEXPORT int SMBCALL smb_incdat(smb_t* smb, uint32_t offset, uint32_t length, uint16_t headers);
SMBEXPORT int SMBCALL smb_freemsg(smb_t* smb, smbmsg_t* msg);
SMBEXPORT int SMBCALL smb_freemsgdat(smb_t* smb, uint32_t offset, uint32_t length, uint16_t headers);
SMBEXPORT int SMBCALL smb_freemsghdr(smb_t* smb, uint32_t offset, uint32_t length);
SMBEXPORT void SMBCALL smb_freemsgtxt(char* buf);
SMBEXPORT int SMBCALL smb_copymsgmem(smbmsg_t* destmsg, smbmsg_t* srcmsg);
SMBEXPORT char* SMBCALL smb_getmsgtxt(smb_t* smb, smbmsg_t* msg, uint32_t mode);
SMBEXPORT int SMBCALL smb_tzutc(short timezone);
SMBEXPORT int SMBCALL smb_tzutc(int16_t timezone);
/* FILE pointer I/O functions */
SMBEXPORT int SMBCALL smb_feof(FILE* fp);
SMBEXPORT int SMBCALL smb_ferror(FILE* fp);
SMBEXPORT int SMBCALL smb_fflush(FILE* fp);
SMBEXPORT int SMBCALL smb_fgetc(FILE* fp);
SMBEXPORT int SMBCALL smb_fputc(int ch, FILE* fp);
SMBEXPORT int SMBCALL smb_fseek(FILE* fp, int32_t offset, int whence);
SMBEXPORT int32_t SMBCALL smb_ftell(FILE* fp);
SMBEXPORT int32_t SMBCALL smb_fread(void HUGE16* buf, int32_t bytes, FILE* fp);
SMBEXPORT int32_t SMBCALL smb_fwrite(void HUGE16* buf, int32_t bytes, FILE* fp);
SMBEXPORT int32_t SMBCALL smb_fgetlength(FILE* fp);
SMBEXPORT int SMBCALL smb_fsetlength(FILE* fp, int32_t length);
SMBEXPORT void SMBCALL smb_rewind(FILE* fp);
SMBEXPORT void SMBCALL smb_clearerr(FILE* fp);
SMBEXPORT int SMBCALL smb_feof(FILE* fp);
SMBEXPORT int SMBCALL smb_ferror(FILE* fp);
SMBEXPORT int SMBCALL smb_fflush(FILE* fp);
SMBEXPORT int SMBCALL smb_fgetc(FILE* fp);
SMBEXPORT int SMBCALL smb_fputc(int ch, FILE* fp);
SMBEXPORT int SMBCALL smb_fseek(FILE* fp, int32_t offset, int whence);
SMBEXPORT int32_t SMBCALL smb_ftell(FILE* fp);
SMBEXPORT int32_t SMBCALL smb_fread(void HUGE16* buf, int32_t bytes, FILE* fp);
SMBEXPORT int32_t SMBCALL smb_fwrite(void HUGE16* buf, int32_t bytes, FILE* fp);
SMBEXPORT int32_t SMBCALL smb_fgetlength(FILE* fp);
SMBEXPORT int SMBCALL smb_fsetlength(FILE* fp, int32_t length);
SMBEXPORT void SMBCALL smb_rewind(FILE* fp);
SMBEXPORT void SMBCALL smb_clearerr(FILE* fp);
#ifdef __cplusplus
}
#endif
#ifdef __WATCOMC__ /* Use MSC standard (prepended underscore) */
#pragma aux smb_ver "_*"
#pragma aux smb_lib_ver "_*"
#pragma aux smb_open "_*"
#pragma aux smb_close "_*"
#pragma aux smb_open_da "_*"
#pragma aux smb_close_da "_*"
#pragma aux smb_open_ha "_*"
#pragma aux smb_close_ha "_*"
#pragma aux smb_create "_*"
#pragma aux smb_stack "_*"
#pragma aux smb_trunchdr "_*"
#pragma aux smb_locksmbhdr "_*"
#pragma aux smb_getstatus "_*"
#pragma aux smb_putstatus "_*"
#pragma aux smb_unlocksmbhdr "_*"
#pragma aux smb_getmsgidx "_*"
#pragma aux smb_getfirstidx "_*"
#pragma aux smb_getlastidx "_*"
#pragma aux smb_getmsghdrlen "_*"
#pragma aux smb_getmsgdatlen "_*"
#pragma aux smb_lockmsghdr "_*"
#pragma aux smb_getmsghdr "_*"
#pragma aux smb_unlockmsghdr "_*"
#pragma aux smb_addcrc "_*"
#pragma aux smb_hfield "_*"
#pragma aux smb_dfield "_*"
#pragma aux smb_addmsghdr "_*"
#pragma aux smb_putmsg "_*"
#pragma aux smb_putmsgidx "_*"
#pragma aux smb_putmsghdr "_*"
#pragma aux smb_freemsgmem "_*"
#pragma aux smb_hdrblocks "_*"
#pragma aux smb_datblocks "_*"
#pragma aux smb_allochdr "_*"
#pragma aux smb_fallochdr "_*"
#pragma aux smb_hallochdr "_*"
#pragma aux smb_allocdat "_*"
#pragma aux smb_fallocdat "_*"
#pragma aux smb_hallocdat "_*"
#pragma aux smb_incdat "_*"
#pragma aux smb_freemsg "_*"
#pragma aux smb_freemsgdat "_*"
#pragma aux smb_freemsghdr "_*"
#pragma aux smb_getmsgtxt "_*"
#pragma aux smb_freemsgtxt "_*"
#pragma aux smb_feof "_*"
#pragma aux smb_ferror "_*"
#pragma aux smb_fflush "_*"
#pragma aux smb_fgetc "_*"
#pragma aux smb_fputc "_*"
#pragma aux smb_fseek "_*"
#pragma aux smb_ftell "_*"
#pragma aux smb_fread "_*"
#pragma aux smb_fwrite "_*"
#pragma aux smb_fgetlength "_*"
#pragma aux smb_fsetlength "_*"
#pragma aux smb_rewind "_*"
#pragma aux smb_clearerr "_*"
#pragma aux lzh_encode "_*"
#pragma aux lzh_decode "_*"
#endif /* Watcom */
#ifdef __WATCOMC__ /* Use MSC standard (prepended underscore) */
#pragma aux smb_ver "_*"
#pragma aux smb_lib_ver "_*"
#pragma aux smb_open "_*"
#pragma aux smb_close "_*"
#pragma aux smb_open_da "_*"
#pragma aux smb_close_da "_*"
#pragma aux smb_open_ha "_*"
#pragma aux smb_close_ha "_*"
#pragma aux smb_create "_*"
#pragma aux smb_stack "_*"
#pragma aux smb_trunchdr "_*"
#pragma aux smb_locksmbhdr "_*"
#pragma aux smb_getstatus "_*"
#pragma aux smb_putstatus "_*"
#pragma aux smb_unlocksmbhdr "_*"
#pragma aux smb_getmsgidx "_*"
#pragma aux smb_getfirstidx "_*"
#pragma aux smb_getlastidx "_*"
#pragma aux smb_getmsghdrlen "_*"
#pragma aux smb_getmsgdatlen "_*"
#pragma aux smb_lockmsghdr "_*"
#pragma aux smb_getmsghdr "_*"
#pragma aux smb_unlockmsghdr "_*"
#pragma aux smb_addcrc "_*"
#pragma aux smb_hfield "_*"
#pragma aux smb_dfield "_*"
#pragma aux smb_addmsghdr "_*"
#pragma aux smb_putmsg "_*"
#pragma aux smb_putmsgidx "_*"
#pragma aux smb_putmsghdr "_*"
#pragma aux smb_freemsgmem "_*"
#pragma aux smb_hdrblocks "_*"
#pragma aux smb_datblocks "_*"
#pragma aux smb_allochdr "_*"
#pragma aux smb_fallochdr "_*"
#pragma aux smb_hallochdr "_*"
#pragma aux smb_allocdat "_*"
#pragma aux smb_fallocdat "_*"
#pragma aux smb_hallocdat "_*"
#pragma aux smb_incdat "_*"
#pragma aux smb_freemsg "_*"
#pragma aux smb_freemsgdat "_*"
#pragma aux smb_freemsghdr "_*"
#pragma aux smb_getmsgtxt "_*"
#pragma aux smb_freemsgtxt "_*"
#pragma aux smb_feof "_*"
#pragma aux smb_ferror "_*"
#pragma aux smb_fflush "_*"
#pragma aux smb_fgetc "_*"
#pragma aux smb_fputc "_*"
#pragma aux smb_fseek "_*"
#pragma aux smb_ftell "_*"
#pragma aux smb_fread "_*"
#pragma aux smb_fwrite "_*"
#pragma aux smb_fgetlength "_*"
#pragma aux smb_fsetlength "_*"
#pragma aux smb_rewind "_*"
#pragma aux smb_clearerr "_*"
#pragma aux lzh_encode "_*"
#pragma aux lzh_decode "_*"
#endif /* Watcom */
#endif /* Don't add anything after this #endif statement */