Skip to content
Snippets Groups Projects
Commit 408d8650 authored by rswindell's avatar rswindell
Browse files

Moved strlwr() definition from wrappers.c to smbwrap.c (SMB stores CRCs of lowercase strings).

Moved stlupr() too just because they seem to go well together. :-)
Added  export macros to Unix prototypes in smbwrap.h in preperation for importing from shared object.
parent 43717fd3
No related branches found
No related tags found
No related merge requests found
......@@ -156,8 +156,6 @@ extern "C" {
#define tell(fd) lseek(fd,0,SEEK_CUR)
DLLEXPORT void DLLCALL sbbs_beep(int freq, int dur);
DLLEXPORT char* DLLCALL strupr(char* str);
DLLEXPORT char* DLLCALL strlwr(char* str);
DLLEXPORT char* DLLCALL strrev(char* str);
DLLEXPORT char* DLLCALL _fullpath(char* absPath, const char* relPath
,size_t maxLength);
......
......@@ -60,6 +60,35 @@
#define STAT struct stat
#endif
/****************************************************************************/
/* Convert ASCIIZ string to upper case */
/****************************************************************************/
#ifdef __unix__
char* SMBCALL strupr(char* str)
{
char* p=str;
while(*p) {
*p=toupper(*p);
p++;
}
return(str);
}
/****************************************************************************/
/* Convert ASCIIZ string to lower case */
/****************************************************************************/
char* SMBCALL strlwr(char* str)
{
char* p=str;
while(*p) {
*p=tolower(*p);
p++;
}
return(str);
}
#endif
/****************************************************************************/
/* Returns the length of the file in 'filename' */
/****************************************************************************/
......@@ -137,7 +166,7 @@ BOOL SMBCALL fexist(char *filespec)
/****************************************************************************/
/* Returns the length of the file in 'fd' */
/****************************************************************************/
long filelength(int fd)
long SMBCALL filelength(int fd)
{
STAT st;
......@@ -148,7 +177,7 @@ long filelength(int fd)
}
/* Sets a lock on a portion of a file */
int lock(int fd, long pos, int len)
int SMBCALL lock(int fd, long pos, int len)
{
struct flock alock;
......@@ -162,7 +191,7 @@ int lock(int fd, long pos, int len)
}
/* Removes a lock from a file record */
int unlock(int fd, long pos, int len)
int SMBCALL unlock(int fd, long pos, int len)
{
struct flock alock;
......@@ -175,7 +204,7 @@ int unlock(int fd, long pos, int len)
}
/* Opens a file in specified sharing (file-locking) mode */
int sopen(char *fn, int access, int share)
int SMBCALL sopen(char *fn, int access, int share)
{
int fd;
struct flock alock;
......@@ -212,7 +241,7 @@ int sopen(char *fn, int access, int share)
#define LK_UNLCK LK_UNLOCK
#endif
int lock(int file, long offset, int size)
int SMBCALL lock(int file, long offset, int size)
{
int i;
long pos;
......@@ -226,7 +255,7 @@ int lock(int file, long offset, int size)
return(i);
}
int unlock(int file, long offset, int size)
int SMBCALL unlock(int file, long offset, int size)
{
int i;
long pos;
......
......@@ -95,13 +95,15 @@ extern "C" {
#endif
#if !defined(__BORLANDC__)
int lock(int fd, long pos, int len);
int unlock(int fd, long pos, int len);
SMBEXPORT int SMBCALL lock(int fd, long pos, int len);
SMBEXPORT int SMBCALL unlock(int fd, long pos, int len);
#endif
#if defined(__unix__)
int sopen(char *fn, int access, int share);
long filelength(int fd);
SMBEXPORT int SMBCALL sopen(char *fn, int access, int share);
SMBEXPORT long SMBCALL filelength(int fd);
SMBEXPORT char* SMBCALL strupr(char* str);
SMBEXPORT char* SMBCALL strlwr(char* str);
#endif
SMBEXPORT BOOL SMBCALL fexist(char *filespec);
......
......@@ -264,36 +264,10 @@ char* DLLCALL ultoa(ulong val, char* str, int radix)
}
#endif
/****************************************************************************/
/* Convert ASCIIZ string to upper case */
/****************************************************************************/
#ifdef __unix__
char* strupr(char* str)
{
char* p=str;
while(*p) {
*p=toupper(*p);
p++;
}
return(str);
}
/****************************************************************************/
/* Convert ASCIIZ string to lower case */
/****************************************************************************/
char* strlwr(char* str)
{
char* p=str;
while(*p) {
*p=tolower(*p);
p++;
}
return(str);
}
/****************************************************************************/
/* Reverse characters of a string */
/****************************************************************************/
#ifdef __unix__
char* strrev(char* str)
{
char* newstr;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment