Annotation of sbbs/sbbs3/smbwrap.h, revision 1.1.1.1

1.1       root        1: /* smbwrap.h */
                      2: 
                      3: /* Synchronet SMBLIB system-call wrappers */
                      4: 
                      5: /* $Id: smbwrap.h,v 1.12 2000/11/09 03:31:16 rswindell Exp $ */
                      6: 
                      7: /****************************************************************************
                      8:  * @format.tab-size 4          (Plain Text/Source Code File Header)                    *
                      9:  * @format.use-tabs true       (see http://www.synchro.net/ptsc_hdr.html)              *
                     10:  *                                                                                                                                                     *
                     11:  * Copyright 2000 Rob Swindell - http://www.synchro.net/copyright.html         *
                     12:  *                                                                                                                                                     *
                     13:  * This program is free software; you can redistribute it and/or                       *
                     14:  * modify it under the terms of the GNU General Public License                         *
                     15:  * as published by the Free Software Foundation; either version 2                      *
                     16:  * of the License, or (at your option) any later version.                                      *
                     17:  * See the GNU General Public License for more details: gpl.txt or                     *
                     18:  * http://www.fsf.org/copyleft/gpl.html                                                                                *
                     19:  *                                                                                                                                                     *
                     20:  * Anonymous FTP access to the most recent released source is available at     *
                     21:  * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net     *
                     22:  *                                                                                                                                                     *
                     23:  * Anonymous CVS access to the development source and modification history     *
                     24:  * is available at cvs.synchro.net:/cvsroot/sbbs, example:                                     *
                     25:  * cvs -d :pserver:[email protected]:/cvsroot/sbbs login                       *
                     26:  *     (just hit return, no password is necessary)                                                     *
                     27:  * cvs -d :pserver:[email protected]:/cvsroot/sbbs checkout src                *
                     28:  *                                                                                                                                                     *
                     29:  * For Synchronet coding style and modification guidelines, see                                *
                     30:  * http://www.synchro.net/source.html                                                                          *
                     31:  *                                                                                                                                                     *
                     32:  * You are encouraged to submit any modifications (preferably in Unix diff     *
                     33:  * format) via e-mail to [email protected]                                                                      *
                     34:  *                                                                                                                                                     *
                     35:  * Note: If this box doesn't appear square, then you need to fix your tabs.    *
                     36:  ****************************************************************************/
                     37: 
                     38: #ifndef _SMBWRAP_H
                     39: #define _SMBWRAP_H
                     40: 
                     41: #include "smblib.h"    /* SMBEXPORT/SMBCALL */
                     42: 
                     43: /**********/
                     44: /* Macros */
                     45: /**********/
                     46: 
                     47: #if defined(_WIN32)
                     48: 
                     49:        #include <io.h>                         /* _sopen */
                     50:        #include <sys/stat.h>           /* S_IREAD */
                     51:        #include <fcntl.h>                      /* O_BINARY */
                     52:        #include <windows.h>            /* OF_SHARE_ */
                     53: 
                     54:        #define sopen(f,o,s)            _sopen(f,o,s,S_IREAD|S_IWRITE)
                     55:        #define close(f)                        _close(f)
                     56:                                                        
                     57:        #ifndef SH_DENYNO
                     58:        #define SH_DENYNO                       OF_SHARE_DENY_NONE
                     59:        #define SH_DENYWR                       OF_SHARE_DENY_WRITE
                     60:        #define SH_DENYRW                       OF_SHARE_EXCLUSIVE
                     61:        #endif
                     62:        #ifndef O_DENYNONE
                     63:        #define O_DENYNONE                      SH_DENYNO
                     64:        #endif
                     65: 
                     66: #elif defined(__unix__)
                     67: 
                     68:        #include <fcntl.h>
                     69: 
                     70:        #define O_BINARY        0               /* all files in binary mode on Unix */
                     71:        #define O_DENYNONE  (1<<31)     /* req'd for Baja/nopen compatibility */
                     72: 
                     73:        #define SH_DENYNO       2          // no locks
                     74:        #define SH_DENYRW       F_WRLCK    // exclusive lock
                     75:        #define SH_DENYWR   F_RDLCK    // shareable lock
                     76: 
                     77:        #define stricmp(x,y)            strcasecmp(x,y)
                     78:        #define strnicmp(x,y,z)         strncasecmp(x,y,z)
                     79:        #define chsize(fd,size)         ftruncate(fd,size)
                     80: 
                     81: #endif
                     82: 
                     83: #ifndef BOOL
                     84:        #define BOOL    int
                     85: #endif
                     86: #ifndef TRUE
                     87:        #define TRUE    1
                     88:        #define FALSE   0
                     89: #endif
                     90: 
                     91: /**************/
                     92: /* Prototypes */
                     93: /**************/
                     94: 
                     95: #ifdef __cplusplus
                     96: extern "C" {
                     97: #endif
                     98: 
                     99: #if !defined(__BORLANDC__)
                    100:        SMBEXPORT int   SMBCALL lock(int fd, long pos, int len);
                    101:        SMBEXPORT int   SMBCALL unlock(int fd, long pos, int len);
                    102: #endif
                    103: 
                    104: #if defined(__unix__)
                    105:        SMBEXPORT int   SMBCALL sopen(char *fn, int access, int share);
                    106:        SMBEXPORT long  SMBCALL filelength(int fd);
                    107:        SMBEXPORT char* SMBCALL strupr(char* str);
                    108:        SMBEXPORT char* SMBCALL strlwr(char* str);
                    109: #endif
                    110: 
                    111: SMBEXPORT BOOL SMBCALL fexist(char *filespec);
                    112: SMBEXPORT long SMBCALL flength(char *filename);
                    113: 
                    114: #ifdef __cplusplus
                    115: }
                    116: #endif
                    117: 
                    118: #endif /* Don't add anything after this line */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.