Skip to content
Snippets Groups Projects
Commit d5513e87 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Remove old/deprecated Baja mods (replaced with JS or just obsoleted)

e.g. stubs for JS command shells, examples of how to do file I/O, socket I/O
and such in Baja (which you really shouldn't).

Added type.js to replace type.src/bin
parent 8e5820e4
No related branches found
No related tags found
No related merge requests found
......@@ -11,27 +11,16 @@ ifndef BAJAPATH
endif
all : \
cntnodes.bin \
default.bin \
dir.bin \
file_io.bin \
ftp.bin \
getimlst.bin \
html.bin \
lbshell.bin \
major.bin \
matrix.bin \
noyesbar.bin \
pcboard.bin \
qnet-ftp.bin \
ra_emu.bin \
renegade.bin \
sdos.bin \
simple.bin \
type.bin \
wildcat.bin \
wwiv.bin \
yesnobar.bin
wwiv.bin
%.bin : %.src $(BAJAPATH)
@$(BAJAPATH) /q $<
# cntnodes.src
# Counts number of nodes in use and number of nodes waiting for call
# Sets global variables NODES_INUSE and NODES_WFC
# $Id: cntnodes.src,v 1.3 2000/10/26 11:36:52 rswindell Exp $
# @format.tab-size 8, @format.use-tabs true
!include sbbsdefs.inc
int status
global_int nodes_inuse nodes_wfc
set nodes_inuse 0
set nodes_wfc 0
# Rewind NODE.DAB (_NODEFILE is a system variable)
fset_pos _nodefile 0
:read
feof _nodefile
if_true # End of file
goto end
end_if
# Lock record
flock _nodefile NODE_RECORD_LEN
if_false # Failed
goto end
end_if
# Read status
fread _nodefile status 1
if_false # Failed
funlock _nodefile NODE_RECORD_LEN
goto end
end_if
# Unlock record
fseek _nodefile -1 CUR
funlock _nodefile NODE_RECORD_LEN
# Skip record
fseek _nodefile NODE_RECORD_LEN CUR
switch status
case NODE_WFC
add nodes_wfc 1
end_case
case NODE_LOGON
case NODE_NEWUSER
case NODE_INUSE
case NODE_QUIET
add nodes_inuse 1
end_case
end_switch
goto read
:end
printf "Nodes in use=%ld Waiting for Caller=%ld\r\n" nodes_inuse nodes_wfc
# default.src
# Default Command Shell for Synchronet Version 2.00a+
# $Id: default.src,v 1.29 2020/05/26 19:25:26 rswindell Exp $
# @format.tab-size 8, @format.use-tabs true
###############################################################################
# This shell is an imitation of the Version 1c command set/structure #
# #
# It also serves as an example of a complex command shell using the Baja #
# command shell language #
# #
###############################################################################
# Tips:
#
# Tabstops should be set to 8 to view/edit this file
# If your editor does not support control characters,
# use \1 for Ctrl-A codes
# All lines starting with # are considered comments and are ignored
# Left margins (indents) are not relevant and used only for clarity
# Almost everything is not case sensitive with the exception of @-codes
################################# Begins Here #################################
!include sbbsdefs.inc
str last_str_cmd
# Set return point for main menu commands (via end_cmd)
cmd_home
# Display TEXT\MENU\MAIN.* if not in expert mode
compare_user_misc UM_EXPERT
if_false
cls
menu main
end_if
# Update node status
node_action node_main
async
inc_main_cmds
compare_ars RIP
if_true
getlines
end_if
# Display main Prompt
print "\1-\1c\r\n\xfe \1b\1hMain \1n\1c\xfe \1h"
compare_ars exempt T
if_true
print "@TUSED@"
else
print "@TLEFT@"
end_if
print " \1n\1c[\1h@GN@\1n\1c] @GRP@\1\\ [\1h@SN@\1n\1c] @SUB@: \1n"
# Get key (with / extended commands allowed)
compare_user_misc UM_COLDKEYS
if_false
getkeye
else
getstrupr 60
endif
# Do nothing for control keys and space
cmdkey ^@
end_cmd
cmdkey ^M
end_cmd
cmdkey ^S
end_cmd
cmdkey "
end_cmd
# Write command to log file
logkey_comma
# Hitting number changes current sub-board
cmdkey digit
compare_user_misc UM_COLDKEYS
if_false
ungetkey
end_if
msg_get_sub_num
end_cmd
# Hitting /number changes current group
cmdkey edigit
compare_user_misc UM_COLDKEYS
if_false
ungetkey
else
shift_str 1
end_if
msg_get_grp_num
end_cmd
# Show the key hit
compare_user_misc UM_COLDKEYS
if_false
printkey
endif
# Next sub-board
cmdkey ^^
msg_subboard_up
end_cmd
cmdkey >
msg_subboard_up
end_cmd
cmdkey }
msg_subboard_up
end_cmd
cmdkey )
msg_subboard_up
end_cmd
cmdkey +
msg_subboard_up
end_cmd
cmdkey =
msg_subboard_up
end_cmd
# Previous sub-board
cmdkey ^J
msg_subboard_down
end_cmd
cmdkey <
msg_subboard_down
end_cmd
cmdkey {
msg_subboard_down
end_cmd
cmdkey (
msg_subboard_down
end_cmd
cmdkey -
msg_subboard_down
end_cmd
# Next group
cmdkey ^F
msg_group_up
end_cmd
cmdkey ]
msg_group_up
end_cmd
# Previous group
cmdkey ^]
msg_group_down
end_cmd
cmdkey [
msg_group_down
end_cmd
# String commands start with a semicolon
cmdkey ;
compare_user_misc UM_COLDKEYS
if_true
shift_str 1
else
getstr 40
end_if
compare_str !
if_equal
copy str last_str_cmd
end_if
exec_bin "str_cmds %s"
compare_str ""
if_not_equal
copy last_str_cmd str
end_if
end_cmd
cmdkey T
chkfile "%zmenu/tmessage.*"
if_true
menu tmessage
end_if
call file_transfers
end_cmd
compare_user_misc UM_COLDKEYS
if_false
crlf
end_if
pause_reset
# Menu
cmdkey ?
compare_user_misc UM_expert
if_true
menu main
end_if
end_cmd
# Sysop Menu
compare_ars SYSOP or EXEMPT Q or I or N
if_true
cmdkey !
menu sysmain
end_cmd
end_if
# Commands
cmdkey A
auto_message
end_cmd
cmdkey /A
compare_ars ANSI and not GUEST
if_false
print "\r\nSorry, only regular users with ANSI terminals can do that.\r\n"
else
print "Selecting your avatar..."
exec_bin avatar_chooser
# an alternative approach (uses the configured xtrn/door):
# exec_xtrn avatchoo
end_if
end_cmd
cmdkey B
print "\r\n\1c\1hBrowse/New Message Scan\r\n"
msg_browse_scan
end_cmd
cmdkey C
chat_section
end_cmd
cmdkey D
user_defaults
exec_bin "termsetup"
end_cmd
cmdkey E
exec_bin email_sec
end_cmd
cmdkey F
print "\r\n\1c\1hFind Text in Messages\r\n"
msg_find_text
end_cmd
cmdkey /F
msg_find_text_all
end_cmd
cmdkey G
text_file_section
end_cmd
cmdkey I
call main_info
end_cmd
cmdkey J
msg_select_area
end_cmd
cmdkey L
msg_list
end_cmd
cmdkey /L
nodelist_all
end_cmd
cmdkey W
nodelist_users
end_cmd
cmdkey M
minute_bank
end_cmd
cmdkey N
print "\r\n\1c\1hNew Message Scan\r\n"
msg_new_scan
end_cmd
cmdkey /N
msg_new_scan_all
end_cmd
cmdkey O
file_download_batch
if_true
end_cmd
end_if
logoff
end_cmd
cmdkey /O
file_download_batch
if_true
end_cmd
end_if
logoff_fast
end_cmd
cmdkey P
msg_post
end_cmd
cmdkey /P
exec_bin postpoll
end_cmd
cmdkey Q
msg_qwk
end_cmd
cmdkey R
msg_read
end_cmd
cmdkey S
print "\r\n\1c\1hScan for Messages Posted to You\r\n"
msg_your_scan
end_cmd
cmdkey /S
msg_your_scan_all
end_cmd
cmdkey U
print "\r\n\1c\1hList Users\r\n"
mnemonics "\r\n~Logons Today, ~Yesterday, ~Sub-board, or ~All: "
getcmd LSAY\r
cmdkey L
userlist_logons
end_cmd
cmdkey Y
exec_bin "logonlist -y"
end_cmd
cmdkey S
userlist_sub
end_cmd
cmdkey A
userlist_all
end_cmd
# fall-through for CR, Ctrl-C, etc
end_cmd
cmdkey /U
userlist_all
end_cmd
cmdkey V
exec_bin scanpolls
end_cmd
cmdkey /V
exec_bin scanpolls all
end_cmd
cmdkey X
xtrn_section
end_cmd
cmdkey Z
print "\r\n\1c\1hContinuous New Message Scan\r\n"
msg_cont_scan
end_cmd
cmdkey /Z
msg_cont_scan_all
end_cmd
cmdkey *
msg_show_subboards
end_cmd
cmdkey /*
msg_show_groups
end_cmd
cmdkey &
exec_bin "msgscancfg"
end_cmd
cmdkey #
print "\r\n\1c\1hType the actual number, not the symbol.\r\n"
end_cmd
cmdkey /#
print "\r\n\1c\1hType the actual number, not the symbol.\r\n"
end_cmd
# fall through
print "\r\n\1c\1hUnrecognized command."
compare_user_misc UM_expert
if_true
print " Hit '\1i?\1n\1c\1h' for a menu."
end_if
crlf
end_cmd
# shouldn't hit next line
print "Problem in command shell."
pause
hangup
return
############################ Main Info Section ###############################
:main_info
cmd_home
compare_user_misc UM_expert
if_false
menu maininfo
end_if
async
print "\r\n\1y\1hInfo: \1n"
getcmd ?QISVY\r
logkey
cmdkey ?
compare_user_misc UM_expert
if_true
menu maininfo
end_if
end_cmd
cmdkey I
info_system
end_cmd
cmdkey S
info_subboard
end_cmd
cmdkey Y
info_user
end_cmd
cmdkey V
info_version
end_cmd
cmdkey Q
cmd_pop
return
end_cmd
cmd_pop
return
########################### File Transfer Section #############################
:file_transfers
compare_ars file_cmds=0
if_true
compare_user_misc UM_ask_nscan
if_true
crlf
crlf
yes_no "Search all libraries for new files"
if_true
file_new_scan_all
end_if
end_if
end_if
cmd_home
compare_user_misc UM_expert
if_false
cls
menu transfer
end_if
# Update node status
node_action node_xfer
async
inc_file_cmds
# Display main Prompt
print "\1-\1c\r\n\xfe \1b\1hFile \1n\1c\xfe \1h"
compare_ars exempt T
if_true
print "@TUSED@"
else
print "@TLEFT@"
end_if
print " \1n\1c(\1h@LN@\1n\1c) @LIB@\1\\ (\1h@DN@\1n\1c) @DIR@: \1n"
# Get key (with / extended commands allowed)
compare_user_misc UM_COLDKEYS
if_false
getkeye
else
getstrupr 60
endif
compare_ars RIP
if_true
getlines
end_if
# Do nothing for control keys and space
cmdkey ^@
end_cmd
cmdkey ^M
end_cmd
cmdkey ^S
end_cmd
cmdkey "
end_cmd
# Write command to log file
logkey_comma
# Hitting number changes current sub-board
cmdkey digit
compare_user_misc UM_COLDKEYS
if_false
ungetkey
end_if
file_get_dir_num
end_cmd
# Hitting /number changes current group
cmdkey edigit
compare_user_misc UM_COLDKEYS
if_false
ungetkey
else
shift_str 1
end_if
file_get_lib_num
end_cmd
# Show the key hit
compare_user_misc UM_COLDKEYS
if_false
printkey
endif
# Next directory
cmdkey ^^
file_directory_up
end_cmd
cmdkey >
file_directory_up
end_cmd
cmdkey }
file_directory_up
end_cmd
cmdkey )
file_directory_up
end_cmd
cmdkey +
file_directory_up
end_cmd
cmdkey =
file_directory_up
end_cmd
# Previous directory
cmdkey ^J
file_directory_down
end_cmd
cmdkey <
file_directory_down
end_cmd
cmdkey {
file_directory_down
end_cmd
cmdkey (
file_directory_down
end_cmd
cmdkey -
file_directory_down
end_cmd
# Next library
cmdkey ^F
file_library_up
end_cmd
cmdkey ]
file_library_up
end_cmd
# Previous library
cmdkey ^]
file_library_down
end_cmd
cmdkey [
file_library_down
end_cmd
# String commands start with a semicolon
cmdkey ;
compare_user_misc UM_COLDKEYS
if_true
shift_str 1
else
getstr 40
end_if
compare_str !
if_equal
copy str last_str_cmd
end_if
exec_bin "str_cmds %s"
compare_str ""
if_not_equal
copy last_str_cmd str
end_if
end_cmd
cmdkey Q
cmd_pop
return
end_cmd
compare_user_misc UM_COLDKEYS
if_false
crlf
end_if
pause_reset
# Menu
cmdkey ?
compare_user_misc UM_expert
if_true
menu transfer
end_if
end_cmd
# Sysop Menu
compare_ars SYSOP
if_true
cmdkey !
menu sysxfer
end_cmd
end_if
# Commands
cmdkey B
file_batch_section
end_cmd
cmdkey C
chat_section
end_cmd
cmdkey D
print "\r\n\1c\1hDownload File(s)\r\n"
file_download_batch
if_true
end_cmd
end_if
getfilespec
if_true
file_download
end_if
end_cmd
cmdkey /D
print "\r\n\1c\1hDownload File(s) from User(s)\r\n"
file_download_user
end_cmd
cmdkey E
print "\r\n\1c\1hList Extended File Information\r\n"
getfilespec
if_true
file_list_extended
end_if
end_cmd
cmdkey F
print "\r\n\1c\1hFind Text in File Descriptions (no wildcards)\r\n"
file_find_text
end_cmd
cmdkey /F
file_find_text_all
end_cmd
cmdkey I
call file_info
end_cmd
cmdkey J
file_select_area
end_cmd
cmdkey L
setstr *
file_list
end_cmd
cmdkey /L
nodelist_all
end_cmd
cmdkey W
nodelist_users
end_cmd
cmdkey N
print "\r\n\1c\1hNew File Scan\r\n"
file_new_scan
end_cmd
cmdkey /N
file_new_scan_all
end_cmd
cmdkey O
file_download_batch
if_true
end_cmd
end_if
logoff
end_cmd
cmdkey /O
file_download_batch
if_true
end_cmd
end_if
logoff_fast
end_cmd
cmdkey R
print "\r\n\1c\1hRemove/Edit File(s)\r\n"
getfilespec
if_true
file_remove
end_if
end_cmd
cmdkey S
print "\r\n\1c\1hSearch for Filename(s)\r\n"
file_find_name
end_cmd
cmdkey /S
file_find_name_all
end_cmd
cmdkey T
file_temp_section
end_cmd
cmdkey U
print "\r\n\1c\1hUpload File\r\n"
chkfile "%zmenu/upload.*"
if_true
menu upload
end_if
file_upload
end_cmd
cmdkey /U
print "\r\n\1c\1hUpload File to User\r\n"
file_upload_user
end_cmd
cmdkey V
print "\r\n\1c\1hView File(s)\r\n"
getfilespec
if_true
file_view
end_if
end_cmd
cmdkey Z
print "\r\n\1c\1hUpload File to Sysop\r\n"
file_upload_sysop
end_cmd
cmdkey *
file_show_directories
end_cmd
cmdkey /*
file_show_libraries
end_cmd
cmdkey &
exec_bin "filescancfg"
end_cmd
cmdkey #
print "\r\n\1c\1hType the actual number, not the symbol.\r\n"
end_cmd
cmdkey /#
print "\r\n\1c\1hType the actual number, not the symbol.\r\n"
end_cmd
# fall through
print "\r\n\1c\1hUnrecognized command."
compare_user_misc UM_expert
if_true
print " Hit '\1i?\1n\1c\1h' for a menu."
end_if
crlf
end_cmd
# shouldn't hit next line
print "Problem in command shell."
pause
hangup
############################ File Info Section ###############################
:file_info
cmd_home
compare_user_misc UM_expert
if_false
menu xferinfo
end_if
async
print "\r\n\1y\1hInfo: \1n"
getcmd ?TYDUQ\r
logkey
cmdkey ?
compare_user_misc UM_expert
if_true
menu xferinfo
end_if
end_cmd
cmdkey T
info_xfer_policy
end_cmd
cmdkey Y
info_user
end_cmd
cmdkey D
info_directory
end_cmd
cmdkey U
userlist_dir
end_cmd
cmdkey Q
cmd_pop
return
end_cmd
cmd_pop
return
#end of DEFAULT.SRC
# dir.src
# Test of Directory System Functions
# $Id: dir.src,v 1.3 2000/10/26 11:36:52 rswindell Exp $
# @format.tab-size 8, @format.use-tabs true
!include sbbsdefs.inc
!include dir_attr.inc
int dir fattr flen ftime bytes files i
str path name attr time date
print "Directory of: "
getstrupr path 60
open_dir dir path
if_false
printf "Unable to open %s\r\n" path
return
end_if
printf "Directory of %s\r\n\r\n" path
:next
copy i _sys_status
and i SS_ABORT
compare i 0
if_not_equal # Ctrl-C hit
print "Aborted.\n"
goto end
end_if
read_dir dir name
if_false
goto end
end_if
# Increment file counter
add files 1
sprintf str "%s\\%s" path name
get_file_attrib fattr str
get_file_length flen str
# Add to total byte counter
compare flen 0
if_greater
add bytes flen
end_if
get_file_time ftime str
ftime_str time "%H:%M:%S" ftime
ftime_str date "%m/%d/%y" ftime
set attr ""
copy i fattr
and i FA_RDONLY
compare i 0
if_not_equal
strcat attr "r"
else
strcat attr "-"
end_if
copy i fattr
and i FA_HIDDEN
compare i 0
if_not_equal
strcat attr "h"
else
strcat attr "-"
end_if
copy i fattr
and i FA_SYSTEM
compare i 0
if_not_equal
strcat attr "s"
else
strcat attr "-"
end_if
copy i fattr
and i FA_LABEL
compare i 0
if_not_equal
strcat attr "l"
else
strcat attr "-"
end_if
copy i fattr
and i FA_DIREC
compare i 0
if_not_equal
strcat attr "d"
else
strcat attr "-"
end_if
copy i fattr
and i FA_ARCH
compare i 0
if_not_equal
strcat attr "a"
else
strcat attr "-"
end_if
printf "%s %10ld %s %s %s\r\n" attr flen date time name
goto next
:end
close_dir dir
printf "\r\n%lu total bytes in %lu files\r\n" bytes files
# file_io.src
# Module for performing various i/o operations on a single file
# $Id: file_io.src,v 1.3 2000/10/26 11:36:52 rswindell Exp $
# @format.tab-size 8, @format.use-tabs true
!include file_io.inc
# Variables
int file
int len
int pos
int time
int int
str buf
str name
# Get filename to open
print "\r\nFilename: "
getstr
copy name str
fopen file O_RDWR|O_CREAT|O_DENYNONE str
if_false
printf "Failed to open %s\r\n" name
return
end_if
cmd_home
fget_length file len
fget_pos file pos
crlf
printf "Filename=%s\r\n" name
fget_time file time
time_str str time
printf "Buf=%s\r\nInt=%ld Pos=%ld Len=%ld Time=%s\r\n" buf int pos len str
feof file
if_true
print "At EOF\r\n"
end_if
crlf
print "[R] Read buf [W] Write buf\r\n"
print "[G] Get int [P] Put int\r\n"
print "[S] Seek [B] Rewind\r\n"
print "[L] Lock [U] Unlock\r\n"
print "[F] Fprintf [C] Change len\r\n"
print "[D] Change date [Z] End of file\r\n"
print "[E] ETX Char\r\n"
crlf
print "Which or [Q]uit: "
getkey
printkey
crlf
cmdkey Q
print "Close: "
fclose file
call success
cmdpop
return
end_cmd
cmdkey S
print "Seek to: "
getstr
copy pos str
fset_pos file pos
call success
end_cmd
cmdkey B
print "Rewinding...\r\n"
fset_pos file 0
call success
end_cmd
cmdkey Z
print "Seeking to End of File...\r\n"
fset_pos file 0 SEEK_END
call success
end_cmd
cmdkey R
print "Length to read: "
getstr
copy len str
fread file buf len
call success
end_cmd
cmdkey G
print "Length to read: "
getstr
copy len str
fread file int len
call success
end_cmd
cmdkey P
print "Length to write: "
getstr
copy len str
print "Int: "
getstr
copy int str
fwrite file int len
call success
end_cmd
cmdkey W
print "Length to write: "
getstr
copy len str
print "String: "
getstr
fwrite file str len
call success
end_cmd
cmdkey F
print "String: "
getstr
fprintf file "%s" str
call success
end_cmd
cmdkey L
print "Length to lock: "
getstr
copy len str
flock file len
call success
end_cmd
cmdkey U
print "Length to unlock: "
getstr
copy len str
funlock file len
call success
end_cmd
cmdkey C
print "New length of file: "
getstr
copy len str
fset_length file len
call success
end_cmd
cmdkey E
yes_no "Use ETX (3) instead of NULL (0) for terminating text"
if_true
fset_etx 3
else
fset_etx 0
end_if
end_cmd
cmdkey D
print "New file date (MM/DD/YY): "
getstr
date_int time str
fset_time file time
call success
end_cmd
end_cmd
# Print "Successful" or "Unsuccessful" based on the current logic state
:success
if_true
print "Successful\r\n"
else
print "Unsuccessful\r\n"
end_if
return
!include userdefs.inc
compare_user_misc UM_HTML
if_true
exec "?html_shell"
else
exec "?classic_shell"
end_if
exec "?lbshell"
exec "?menushell"
# noyesbar.src
# Sep 28 1995 - Digital Man
# $Id: noyesbar.src,v 1.13 2020/05/11 01:46:07 rswindell Exp $
# @format.tab-size 8, @format.use-tabs true
!include sbbsdefs.inc # _question
str tmp
copy tmp str
setstr "N"
compare_strn 2 _question "\r\n"
if_true
crlf
shift_str _question 2
end_if
compare_strn 2 _question "\1?"
if_true
print "\1?"
shift_str _question 2
end_if
print "\x01n\x01b\x01h[\x01c@CHECKMARK@\x01b] \x01y@QUESTION->@? @CLEAR_HOT@"
:top
compare_str "N"
if_equal
print "\x01h\x014\x01w\x01e[\x01~No]\x01n\x01b\x01h \x01~Yes "
else
print "\x01n\x01b\x01h \x01~No \x014\x01w\x01e[\x01~Yes]"
end_if
int aborted
copy aborted _sys_status
and aborted SS_ABORT
compare aborted SS_ABORT
if_not_equal
getkey
print "\b\b\b\b\b\b\b\b\b\1n\1h\1>"
int aborted
copy aborted _sys_status
and aborted SS_ABORT
compare aborted SS_ABORT
if_equal
return
end_if
end_if
if_equal
return
end_if
compare_key ^M
if_true
ungetstr
copy str tmp
return
end_if
compare_keys "YN"
if_true
ungetkey
copy str tmp
return
end_if
compare_key ^@
if_true
copy str tmp
return
end_if
# Toggle
compare_str "Y"
if_true
setstr "N"
else
setstr "Y"
end_if
goto top
# qnet-ftp.src
# $Id: qnet-ftp.src,v 1.11 2009/11/02 06:26:03 rswindell Exp $
# @format.tab-size 8, @format.use-tabs true
###############################################################################
# Baja module for performing FTP-based QWKnet call-outs #
# Requires Synchronet v3.00d and Baja v2.30 #
# Developed 2001 by Rob Swindell #
###############################################################################
# Usage: *QNET-FTP HUBID ADDRESSS PASSWORD port
# Example: *QNET-FTP VERT vert.synchro.net YOURPASS 21
# You may use the qnet-ftp.bin module INSTEAD of your normal ftp/script
# QWKnet call-out routine (exec/vert.bat). You can do this by changing
#
# SCFG->Networks->QWK->Hubs->VERT->Call-out Command Line to:
#
# *QNET-FTP VERT vert.synchro.net YOURPASS port
#
# if you leave the port value blank, this script will default to port 21
#
# The asterisk is important! YOURPASS is your QWKnet password here on Vertrauen.
#
# No modification or recompilation of this module should be necessary.
#
# Updated on Feb 7th, 2007 to support non standard ftp ports
# -- Lloyd Hannesson dasme@dasme.org
!include sbbsdefs.inc
!include file_io.inc
# Must be FIRST function call (or module will immediately terminate)
set _online ON_LOCAL
# Variables
int i argc argv sock port flen
str tmp rep qwk hubid addr user password portstr
str cmdline
set _ftp_mode FTP_PASV
# Process command line arguments
set hubid ""
set addr ""
set password ""
set portstr ""
set port 0
# Display command line
copy cmdline str
lprintf "QNET-FTP: %s" cmdline
set argc 0
:process_args
compare_str ""
if_true
goto end_args
end_if
sprintf tmp "%.1s" str
shift_str 1
compare tmp " "
if_true
add argc 1
goto process_args
end_if
switch argc
case 0
strcat hubid tmp
end_case
case 1
strcat addr tmp
end_case
case 2
strcat password tmp
end_case
case 3
strcat portstr tmp
end_case
default
goto usage
end_switch
goto process_args
:usage
lprintf "QNET-FTP: !INCORRECT USAGE: %s" cmdline
return
:end_args
compare hubid ""
if_true
goto usage
end_if
compare addr ""
if_true
goto usage
end_if
compare password ""
if_true
goto usage
end_if
copy port portstr
compare port 0
if_true
# if no Port is passed on the command line, default to 21
set port 21
end_if
sprintf rep "%%j%s.rep" hubid
sprintf qwk "%%j%s.qwk" hubid
chkfile qwk
if_true
lprintf "QNET-FTP: %s already exists!" qwk
set i 0
:check_qwk
sprintf qwk "%%j%s.qw%ld" hubid i
chkfile qwk
if_true
lprintf "QNET-FTP: %s already exists!" qwk
add i 1
compare i 10
if_equal
goto exit
end_if
goto check_qwk
end_if
end_if
socket_open sock
if_false
lprintf "QNET-FTP: !socket_open failure socket_error=%d" _socket_error
goto exit
end_if
lprintf "QNET-FTP: Connecting to %s:%u ... " addr port
socket_connect sock addr port
crlf
if_false
lprintf "QNET-FTP: !socket_connect failed socket_error=%d" _socket_error
goto exit
end_if
lprintf "QNET-FTP: Connected to %s" addr
set user "%q"
lprintf "QNET-FTP: Logging in as '%s' (PW: '%s')" user password
ftp_login sock user password
if_false
lprintf "QNET-FTP: !ftp_login failed socket_error=%d" _socket_error
goto exit
end_if
lprintf "QNET-FTP: Logged in successfully"
chkfile rep
if_true
###################
# Send REP packet #
###################
lprintf "QNET-FTP: Sending REP packet: %s" rep
sprintf str "%s.rep" hubid
ftp_put sock rep str
if_false
lprintf "QNET-FTP: !ftp_put failed socket_error=%d\r\n" _socket_error
else
lprintf "QNET-FTP: REP packet sent successfully"
remove_file rep
end_if
end_if
#######################
# Download QWK packet #
#######################
sprintf str "%s.qwk" hubid
lprintf "QNET-FTP: Downloading QWK Packet: %s" str
ftp_get sock str qwk
if_true
get_file_length flen qwk
compare flen 0
if_equal
lprintf "QNET-FTP: Downloaded 0-byte %s" qwk
remove_file qwk
else
lprintf "QNET-FTP: Downloaded %s successfully" str
end_if
else
lprintf "QNET-FTP: %s NOT downloaded socket_error=%d (no new messages?)" str _socket_error
remove_file qwk
end_if
ftp_logout sock
#################
# Exit routine #
#################
:exit
lprintf "QNET-FTP: Done."
# End of QNET-FTP.SRC
!include sbbsdefs.inc
int sock len
str buf
socket_open sock
if_false
print "open failure\r\n"
return
end_if
setstr "cvs.synchro.net"
socket_connect sock str 23
if_false
print "connect failure\r\n"
return
end_if
or _console CON_RAW_IN
loop
inchar
if_true
compare_key ^]
if_equal
break
end_if
copy_char buf
socket_write sock buf
if_false
print "\r\nError writing to socket\r\n"
break
end_if
continue
end_if
socket_check sock
if_false
print "\r\nSocket disconnected\r\n"
break
end_if
socket_nread sock len
if_false
print "\r\nError getting read length\r\n"
break
end_if
compare len 0
if_equal
continue
end_if
# printf "reading %d" len
socket_read sock buf len
if_true
pause_reset
print buf
end_if
end_loop
socket_close sock
xor _console CON_RAW_IN
\ No newline at end of file
// Display the contents of a viewable (e.g. plain text) file
"use strict";
console.printfile(argv[0]);
# type.src
# $Id: type.src,v 1.3 2000/10/26 11:37:38 rswindell Exp $
# @format.tab-size 8, @format.use-tabs true
printfile_str
# yesnobar.src
# Sep 28 1995 - Digital Man
# $Id: yesnobar.src,v 1.14 2020/05/11 01:46:07 rswindell Exp $
# @format.tab-size 8, @format.use-tabs true
!include sbbsdefs.inc # _question
str tmp
copy tmp str
setstr "Y"
compare_strn 2 _question "\r\n"
if_true
crlf
shift_str _question 2
end_if
compare_strn 2 _question "\1?"
if_true
print "\1?"
shift_str _question 2
end_if
print "\x01n\x01b\x01h[\x01c@CHECKMARK@\x01b] \x01y@QUESTION->@? @CLEAR_HOT@"
:top
compare_str "Y"
if_equal
print "\x01h\x014\x01w\x01e[\x01~Yes]\x01n\x01b\x01h \x01~No "
else
print "\x01n\x01b\x01h \x01~Yes \x014\x01w\x01e[\x01~No]"
end_if
int aborted
copy aborted _sys_status
and aborted SS_ABORT
compare aborted SS_ABORT
if_not_equal
getkey
print "\b\b\b\b\b\b\b\b\b\1n\1h\1>"
int aborted
copy aborted _sys_status
and aborted SS_ABORT
compare aborted SS_ABORT
if_equal
return
end_if
end_if
if_equal
return
end_if
compare_key ^M
if_true
ungetstr
copy str tmp
return
end_if
compare_keys "YN"
if_true
ungetkey
copy str tmp
return
end_if
compare_key ^@
if_true
copy str tmp
return
end_if
# Toggle
compare_str "Y"
if_true
setstr "N"
else
setstr "Y"
end_if
goto top
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