home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 2 BBS
/
02-BBS.zip
/
SUD.ZIP
/
SUD.LST
< prev
next >
Wrap
File List
|
1991-07-04
|
21KB
|
463 lines
PAGE 1
07-04-91
16:34:47
Line# Source Line Microsoft FORTRAN Optimizing Compiler Version 5.00
1 C *** M/L Routine to DELETE users from the Simplex 1.04 userbase
2 C *** who haven't called in xxx days. Sort Alphabetically.
3 C *** Copyright Fred R. Niemczenia 1991. All rights reserved.
4 C *** Coded in MS-FORTRAN ver. 5.0, just to remind SysOps from
5 C *** whence all this marvelous language variety began!
6 C *** FORTRAN assumes all integers as signed. To avoid an overflow
7 C *** store in a large intermediate integer and MAP into variable
8 C *** space.
9
10 C *** Define the SIMPLEX User block...
11 STRUCTURE /s_block/
12 CHARACTER *41 s_name
13 CHARACTER *16 s_password
14 CHARACTER *31 s_city
15 CHARACTER *15 s_home
16 CHARACTER *15 s_data
17 CHARACTER *1 s_priv ! 0 - 255
18 INTEGER *2 s_keys ! User flags ver. 1.04
19 CHARACTER *1 s_screenlen
20 INTEGER *2 s_credit
21 INTEGER *2 s_flags
22 INTEGER *2 s_fdate
23 INTEGER *2 s_ldate
24 INTEGER *2 s_ltime
25 INTEGER *2 s_calls
26 INTEGER *2 s_time
27 INTEGER *2 s_upload
28 INTEGER *4 s_upbyte
29 INTEGER *2 s_dnload
30 INTEGER *4 s_dnbyte
31 CHARACTER *4 s_resrved ! Was 6, now 4 bytes.
32 END STRUCTURE
33 RECORD /s_block/ s
34 C *** 152 bytes defined in s_block
35
36 CHARACTER*32 infile
37 INTEGER *2 ihr, imin, isec, i100, iyr, imon, iday
38 INTEGER *2 lyr, lmon, lday
39 INTEGER *4 ldays, today, pdays, diff
40 LOGICAL test
41
42 C *** Begin playing to beat the Intel stupid segmented 64k
43 C *** boundary alignment. F2128 - huge array cannot be aligned
44 C *** to segment boundary. Arrrrrrgh! Element .LE. 64 bytes.
45 C *** There goes structuring for .GT. 128 bytes... I busted up
46 C *** the 152 byte record for this. Now if it had been 256 bytes...
47 CHARACTER name[HUGE]*41(1000), pad1[HUGE]*55(1000),
48 & pad2[HUGE]*56(1000)
49
50 PRINT *,' S_U_D version 1.01, (c) Fred Niemczenia'
51 PRINT *,' SIMPLEX Userbase Deleter since last day called!!!'
52 PRINT *,' You may use this utility without charge.'
53 PRINT *
54 PRINT *, ' Do NOT append \USERLIST.BBS, I will do this for you.'
55 PRINT *, ' I expect something as: C:\SIMPLEX {ENTER}.'
56 WRITE (*,'(A\)') ' Enter SIMPLEX User PATHspec: '
57 READ (*,'(A)') infile
58 PRINT *
PAGE 2
07-04-91
16:34:47
Line# Source Line Microsoft FORTRAN Optimizing Compiler Version 5.00
59 PRINT *, ' Enter the number of days you wish to use for'
60 PRINT *, ' the purge. I expect something as: 96 {ENTER}.'
61 WRITE (*,'(A\)') ' Days: '
62 READ (*,*) pdays
63 PRINT *
64
65 C *** So what is the date and time right now?
66 CALL GETTIM (ihr, imin, isec, i100)
67 CALL GETDAT (iyr, imon, iday)
68 CALL days ( iyr, imon, iday, today)
69
70 C *** Process infile filespec. Check if the user is running it in
71 C *** the SIMPLEX directory. `infile' is initially the pathspec.
72 length= LEN_TRIM (infile)
73 IF ( length .LT. 1) THEN
74 infile= infile(1:length) // 'USERLIST.BBS'
75 ELSE
76 infile= infile(1:length) // '\USERLIST.BBS'
77 END IF
78 PRINT *, ' Processing SIMPLEX: ', infile
79 PRINT 9001, imon, iday, iyr
80 PRINT *
81
82 C *** Test if infile exists. It is now a `filespec'.
83 INQUIRE (FILE= infile, EXIST= test)
84 IF ( .NOT. test ) THEN
85 PRINT *, ' I couldn''t find: ', infile
86 PRINT *, ' Run me again and get it right this time!'
87 GOTO 9999
88 END IF
89 length= LEN_TRIM (infile)
90 infile= infile(1:length)
91
92 C *** Open the user file and open the scratch file. The scratch file
93 C *** will NOT contain users that have been deleted.
94 OPEN (UNIT=10, FILE= infile, FORM= 'BINARY', RECL = 152,
95 & ACCESS= 'DIRECT', STATUS= 'UNKNOWN')
96 OPEN (UNIT=11, FORM= 'BINARY', ACCESS= 'SEQUENTIAL', STATUS=
97 & 'SCRATCH')
98
99 C *** Implied processing LOOP begins
100 idelete= 0
101 icount= 0
102 1000 icount= icount + 1
103
104 READ (10, END=4000, REC= icount)
105 & s.s_name, s.s_password, s.s_city,
106 & s.s_home, s.s_data, s.s_priv, s.s_keys, s.s_screenlen,
107 & s.s_credit, s.s_flags, s.s_fdate, s.s_ldate, s.s_ltime,
108 & s.s_calls, s.s_time, s.s_upload, s.s_upbyte, s.s_dnload,
109 & s.s_dnbyte, s.s_resrved
110
111 C *** Read last call date. This is bit mapped stuff per OTOS.
112 C *** Laforet uses DOS date/time stamp. YYYY YYYM MMMD DDDD
113 C ***
114 C *** User file conversion option BIT Map
115 C *** FORTRAN flags bits by number 1111 11-- ---- ----
116 C *** from 0 to 15 for a 2 byte integer 5432 1098 7654 3210
PAGE 3
07-04-91
16:34:47
Line# Source Line Microsoft FORTRAN Optimizing Compiler Version 5.00
117 C ***
118 C *** Classic C n000 0n00 00n0 000n
119 C *** 0x000n convention 8421 8421 8421 8421
120
121 lday= 0
122 DO 2000, i= 0, 4 ! Do the day
123 IF ( BTEST ( s.s_ldate, i ) )
124 & lday= IBSET ( lday, i )
125 2000 CONTINUE
126
127 lmon= 0
128 DO 2001, i= 0, 3 ! Do the month
129 IF ( BTEST ( s.s_ldate, i+5 ) )
130 & lmon= IBSET ( lmon, i )
131 2001 CONTINUE
132
133 lyr= 0
134 DO 2002, i= 0, 6 ! Do the year
135 IF ( BTEST ( s.s_ldate, i+9 ) )
136 & lyr= IBSET ( lyr, i )
137 2002 CONTINUE
138 lyr= lyr + 1980 ! 1980 is 0 in DOS
139
140 CALL days ( lyr, lmon, lday, ldays)
141 diff= today - ldays
142
143 IF ( diff .LT. pdays .OR. icount .EQ. 1) THEN
144 WRITE (11)
145 & s.s_name, s.s_password, s.s_city,
146 & s.s_home, s.s_data, s.s_priv, s.s_keys, s.s_screenlen,
147 & s.s_credit, s.s_flags, s.s_fdate, s.s_ldate, s.s_ltime,
148 & s.s_calls, s.s_time, s.s_upload, s.s_upbyte, s.s_dnload,
149 & s.s_dnbyte, s.s_resrved
150 PRINT 9002, icount, s.s_name, diff
151 ELSE
152 PRINT 9003, icount, s.s_name, diff
153 idelete= idelete + 1
154 END IF
155 GOTO 1000
156
157 4000 icount= icount - 1
158 PRINT 9004, icount, idelete
159 C *** No sense processing deleted users. Modify count.
160 iprocess= icount - idelete
161
162 CLOSE (UNIT=10)
163 C *** Set scratch file to 1st record.
164 REWIND (UNIT=11)
165
166 C *** Bubble sort portion of SUD called in `sort'.
167 IF ( iprocess .GT. 1000 ) THEN
168 PRINT *, 'More than 1000 records, sort abandoned!'
169 PRINT *
170 GOTO 9999
171 END IF
172
173 IF ( idelete .LE. 0 ) THEN
174 PRINT *, 'There was nothing to do!'
PAGE 4
07-04-91
16:34:47
Line# Source Line Microsoft FORTRAN Optimizing Compiler Version 5.00
175 PRINT *
176 GOTO 9999
177 END IF
178
179 PRINT *, 'Reloading SCRATCH FILE from disk!'
180 PRINT *, 'Beginning sort of', iprocess, ' users in RAM!'
181 PRINT *, 'Be patient - Simple bubble sort in progress!'
182 PRINT *
183
184 DO 5000, j=1, iprocess
185 READ (11) name(j), pad1(j), pad2(j)
186 5000 CONTINUE
187 CLOSE (UNIT=11)
188
189 CALL sort ( name, pad1, pad2, iprocess )
190
191 PRINT *, 'Writing sorted USERLIST to DISK!'
192
193 OPEN (UNIT=11, FILE= infile, FORM= 'BINARY',
194 & ACCESS= 'SEQUENTIAL', STATUS= 'UNKNOWN')
195
196 DO 6000, j=1, iprocess
197 WRITE (11) name(j), pad1(j), pad2(j)
198 6000 CONTINUE
199
200 C *** We done!
201 CLOSE (UNIT=11)
202 PRINT *, 'I''m done!'
203 9999 CONTINUE
204
205 9001 FORMAT (1X,'Base date: ',2(I2,'-'),I4,)
206 9002 FORMAT (' ',I5,1X,A20,I6,' Saved.')
207 9003 FORMAT (' ',I5,1X,A20,I6,' Deleted.')
208 9004 FORMAT (' ','Processed ',I4,' users; Deleted ',I4,' users.'//
209 & ' ','Wrote SCRATCH FILE in current directory.'/)
210 END
main Local Symbols
Name Class Type Size Offset
NAME. . . . . . . . . . . local CHAR*41 41000 0000
PAD1. . . . . . . . . . . local CHAR*55 55000 0000
PAD2. . . . . . . . . . . local CHAR*56 56000 0000
TEST. . . . . . . . . . . local LOGICAL*4 4 0002
PDAYS . . . . . . . . . . local INTEGER*4 4 0006
TODAY . . . . . . . . . . local INTEGER*4 4 000a
LENGTH. . . . . . . . . . local INTEGER*4 4 000e
I . . . . . . . . . . . . local INTEGER*4 4 0012
J . . . . . . . . . . . . local INTEGER*4 4 0016
ICOUNT. . . . . . . . . . local INTEGER*4 4 001a
S . . . . . . . . . . . . local CHAR*154 154 001e
DIFF. . . . . . . . . . . local INTEGER*4 4 00b8
I100. . . . . . . . . . . local INTEGER*2 2 00bc
IHR . . . . . . . . . . . local INTEGER*2 2 00be
ISEC. . . . . . . . . . . local INTEGER*2 2 00c0
IDAY. . . . . . . . . . . local INTEGER*2 2 00c2
PAGE 5
07-04-91
16:34:47
Microsoft FORTRAN Optimizing Compiler Version 5.00
main Local Symbols
Name Class Type Size Offset
IPROCESS. . . . . . . . . local INTEGER*4 4 00c4
LDAY. . . . . . . . . . . local INTEGER*2 2 00c8
IMIN. . . . . . . . . . . local INTEGER*2 2 00ca
IMON. . . . . . . . . . . local INTEGER*2 2 00cc
IYR . . . . . . . . . . . local INTEGER*2 2 00ce
LMON. . . . . . . . . . . local INTEGER*2 2 00d0
LYR . . . . . . . . . . . local INTEGER*2 2 00d2
INFILE. . . . . . . . . . local CHAR*32 32 00d4
IDELETE . . . . . . . . . local INTEGER*4 4 00f4
LDAYS . . . . . . . . . . local INTEGER*4 4 00f8
211
212 $Page
PAGE 6
07-04-91
16:34:47
Line# Source Line Microsoft FORTRAN Optimizing Compiler Version 5.00
213 C *** Subroutine to calc number of days since 0-0-0. Array daymon
214 C *** holds the number of days to the first of any month.
215 SUBROUTINE days ( iyr, imon, iday, ndays )
216 INTEGER *2 iyr, imon, iday, daymon
217 INTEGER *4 ndays
218 DIMENSION daymon(12)
219 DATA daymon /0,31,59,90,120,151,181,212,243,273,304,334/
220 ndays= daymon(imon)
221 ndays= ndays + iyr*365 + iyr/4 + iday + 1
222 ndays= ndays - iyr/100 + iyr/400
223 C *** Is this a leap year or leap century. Leap years are SKIPPED
224 C *** on a leap century. Exit if leap year.
225 IF ( iyr/400*400 .EQ. iyr ) GOTO 100
226 IF ( iyr/100*100 .EQ. iyr ) RETURN
227 100 CONTINUE
228 IF ( imon .GT. 2) RETURN
229 C *** Not a leap year. Take off the extra day!
230 ndays= ndays - 1
231 RETURN
232 END
DAYS Local Symbols
Name Class Type Size Offset
NDAYS . . . . . . . . . . param 0006
IDAY. . . . . . . . . . . param 000a
IMON. . . . . . . . . . . param 000e
IYR . . . . . . . . . . . param 0012
DAYMON. . . . . . . . . . local INTEGER*2 24 0504
233
234 $Page
PAGE 7
07-04-91
16:34:47
Line# Source Line Microsoft FORTRAN Optimizing Compiler Version 5.00
235 C *** Subroutine SORT performs a bubble sort on a one-dimensional
236 C *** character real array of arbitrary length. It sorts
237 C *** the array in ascending order. This routine courtesy of
238 C *** MS-FORTRAN 3.13 via Tandy Corp. MS disavows all knowledge
239 C *** of this release. Have they been watching Mission Impossible?
240 C *** See M/L comments for boundary alignment modifications.
241 SUBROUTINE sort ( name, pad1, pad2, end )
242 CHARACTER temp1*41, temp2*55, temp3*56, tempL1*41, tempL2*41
243 INTEGER end, a1, a2, spa1, spa2
244
245 CHARACTER name[HUGE]*41(1000), pad1[HUGE]*55(1000),
246 & pad2[HUGE]*56(1000)
247
248 C *** Why sort a 2 record database if the SysOp is first?
249 IF (end .LE. 2) RETURN
250
251 DO 201 a1= 2, end-1
252 DO 301 a2= a1 + 1, end
253 spa1= INDEX ( name(a1), ' ' )
254 spa2= INDEX ( name(a2), ' ' )
255
256 IF ( spa1 .NE. 0 ) THEN
257 tempL1 = name(a1) (spa1:)
258 ELSE
259 tempL1 = name(a1)
260 END IF
261
262 IF ( spa2 .NE. 0 ) THEN
263 tempL2 = name(a2) (spa2:)
264 ELSE
265 tempL2 = name(a2)
266 END IF
267
268 C *** Convert to upper case.
269 len= LEN_TRIM ( tempL1 )
270 CALL convert ( tempL1, len )
271 len= LEN_TRIM ( tempL2 )
272 CALL convert ( tempL2, len )
273
274 IF (tempL1 .LE. tempL2) GOTO 401
275 temp1 = name(a1)
276 temp2 = pad1(a1)
277 temp3 = pad2(a1)
278 name(a1) = name(a2)
279 pad1(a1) = pad1(a2)
280 pad2(a1) = pad2(a2)
281 name(a2) = temp1
282 pad1(a2) = temp2
283 pad2(a2) = temp3
284 401 CONTINUE
285 301 CONTINUE
286 201 CONTINUE
287
288 RETURN
289 END
PAGE 8
07-04-91
16:34:47
Microsoft FORTRAN Optimizing Compiler Version 5.00
SORT Local Symbols
Name Class Type Size Offset
END . . . . . . . . . . . param 0006
PAD2. . . . . . . . . . . param 000a
PAD1. . . . . . . . . . . param 000e
NAME. . . . . . . . . . . param 0012
SPA1. . . . . . . . . . . local INTEGER*4 4 00fc
SPA2. . . . . . . . . . . local INTEGER*4 4 0100
LEN . . . . . . . . . . . local INTEGER*4 4 0104
TEMP1 . . . . . . . . . . local CHAR*41 41 0108
TEMP2 . . . . . . . . . . local CHAR*55 55 0132
TEMP3 . . . . . . . . . . local CHAR*56 56 016a
A1. . . . . . . . . . . . local INTEGER*4 4 01a2
A2. . . . . . . . . . . . local INTEGER*4 4 01a6
TEMPL1. . . . . . . . . . local CHAR*41 41 01aa
TEMPL2. . . . . . . . . . local CHAR*41 41 01d4
290
291 $PAGE
PAGE 9
07-04-91
16:34:47
Line# Source Line Microsoft FORTRAN Optimizing Compiler Version 5.00
292 C *** Subroutine to convert lower case to upper case.
293 C *** Some compilers treat INTEGER and CHARACTER comparison
294 C *** as an error. MS Fortran ver 5.0 considers this as a
295 C *** recoverable error. 95 implies shutting bit 6 (32 decimal)
296 C *** off. The difference between lower case and upper case is
297 C *** is 32 in the ASCII collating sequence! 01011111
298 SUBROUTINE convert (test,iend)
299 INTEGER*1 test
300 DIMENSION test(41)
301 IF ( iend .GT. 40 ) iend= 40
***** sud.for(301) : error F3606: CONVERT : formal argument TEST : type mismatc
h
302 C *** IGNORE ERROR MESSAGE!
303 DO 100, i= 1, iend
304 IF ( test(i) .LT. 97 ) GOTO 100
305 IF ( test(i) .GT. 122 ) GOTO 100
306 test(i)= IAND (test(i),95)
307 100 CONTINUE
308 RETURN
309 END
CONVERT Local Symbols
Name Class Type Size Offset
IEND. . . . . . . . . . . param 0006
TEST. . . . . . . . . . . param 000a
I . . . . . . . . . . . . local INTEGER*4 4 01fe
Global Symbols
Name Class Type Size Offset
CONVERT . . . . . . . . . FSUBRT *** *** 0c80
DAYS. . . . . . . . . . . FSUBRT *** *** 069b
GETDAT. . . . . . . . . . extern *** *** ***
GETTIM. . . . . . . . . . extern *** *** ***
SORT. . . . . . . . . . . FSUBRT *** *** 078a
main. . . . . . . . . . . FSUBRT *** *** 0000
Code size = 0d21 (3361)
Data size = 051e (1310)
Bss size = 0202 (514)
No errors detected