Category : Communication (modem) tools and utilities
Archive   : PCQUOTE.ZIP
Filename : UTIL.INC

 
Output of file : UTIL.INC contained in archive : PCQUOTE.ZIP
;----------------------------------------------------------------
; UTIL.INC -- Written by Scott R. Houck -- 18 Sep 94
;
; This include file contains various utility routines and useful
; definitions. It can be freely included in script source code
; without incurring unnecessary overhead since only the functions
; and procedures that are used will be placed in the compiled
; script.
;----------------------------------------------------------------

; For endless loops
#define LOOP while 1
#define ENDLOOP endwhile
#define EXITLOOP exitwhile

; String constants
#define SZSPACE " "
#define SZWHITESPACE " `t`f`r`n"

; Constants for the SEEK command
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2

; For DLGEVENT
#define NO_EVENT 0

;----------------------------------------------------------------
; PROC strtriml
;
; ARGS:
; BY REFERENCE: szString -- the input string
;
; DESCRIPTION:
; This procedure trims leading whitespace from a string.
; The 'l' in 'strtriml' is mnemonic for 'left'.
;----------------------------------------------------------------
proc strtriml
param string szString
integer nPos

strspn szString SZWHITESPACE nPos
strdelete szString 0 nPos
endproc

;----------------------------------------------------------------
; PROC strtrimr
;
; ARGS:
; BY REFERENCE: szString -- the input string
;
; DESCRIPTION:
; This procedure trims trailing whitespace from a string.
; The 'r' in 'strtrimr' is mnemonic for 'right'.
;----------------------------------------------------------------
proc strtrimr
param string szString
integer nLen, nChr, nIndex

strlen szString nLen
for nIndex = nLen-1 downto 0
strgetc szString nIndex nChr
if not strchr SZWHITESPACE nChr
exitfor
endif
endfor
substr szString szString 0 nIndex+1
endproc

;----------------------------------------------------------------
; PROC strtrimr
;
; ARGS:
; BY REFERENCE: szString -- the input string
;
; DESCRIPTION:
; This procedure trims both leading and trailing whitespace
; from a string.
;----------------------------------------------------------------
proc strtrim
param string szString

strtriml(&szString)
strtrimr(&szString)
endproc


  3 Responses to “Category : Communication (modem) tools and utilities
Archive   : PCQUOTE.ZIP
Filename : UTIL.INC

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/