-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcntnodes.src
56 lines (47 loc) · 1.07 KB
/
cntnodes.src
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# 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