home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 3 / 3990 < prev    next >
Internet Message Format  |  1991-09-08  |  15KB

  1. Path: wupost!zaphod.mps.ohio-state.edu!qt.cs.utexas.edu!cs.utexas.edu!uunet!europa.asd.contel.com!darwin.sura.net!noc.sura.net!haven.umd.edu!mimsy!nrlvx1.nrl.navy.mil!koffley
  2. From: koffley@nrlvx1.nrl.navy.mil
  3. Newsgroups: alt.sources
  4. Subject: VMS UAF PROFILE part 16 of 18
  5. Message-ID: <1991Sep5.074757.560@nrlvx1.nrl.navy.mil>
  6. Date: 5 Sep 91 11:47:57 GMT
  7. Organization: NRL SPACE SYSTEMS DIVISION
  8. Lines: 494
  9.  
  10. -+-+-+-+-+-+-+-+ START OF PART 16 -+-+-+-+-+-+-+-+
  11. X        if ((terminator.eq.smg$k_trm_ctrlz) .or.
  12. X`091   (terminator .eq. SMG$K_TRM_CR)) then
  13. X`09   option = 4
  14. X`09   return
  15. X`09endif
  16. X`09if (.not. status) call LIB$SIGNAL(%val(status))
  17. X`09length = left_justify (string)
  18. X`09if (length .eq. 0) goto 1
  19. X
  20. X`09if (string(1:1) .eq. '1') then
  21. X`09   option = 1
  22. X`09elseif (string(1:1) .eq. '2') then
  23. X`09   option = 2
  24. X`09elseif (string(1:1) .eq. '3') then
  25. X`09   option = 3
  26. X`09elseif (string(1:1) .eq. 'X') then
  27. X`09   option = 4
  28. Xc`09elseif (string(1:1) .eq. 'X') then
  29. Xc`09   option = 5
  30. X`09else
  31. X`09   goto 1
  32. X`09endif
  33. X
  34. X
  35. X
  36. X`09return
  37. X`09end
  38. X
  39. Xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  40. Vcccc
  41. Xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  42. Vcccc
  43. Xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  44. Vcccc
  45. X
  46. X
  47. X`09subroutine OPEN_AND_READ (target_name, qheader, found)
  48. X
  49. X`09include              '($FORIOSDEF)'
  50. X`09include              '($SSDEF)'
  51. X`09include              '($LIBDEF)'
  52. X`09include              'dua2:`5Bkoffley.com`5Duserlog_struc.inc'
  53. X
  54. X`09common / num_elements /   ordinal
  55. X
  56. X`09common / SMG_data /  paste_ID, kybd_ID, num_rows, num_cols, display_ID,
  57. X`091                    mm_id
  58. X
  59. X`09integer*4           qheader (2), status, base_addr, LIB$GET_VM, ordinal,
  60. X`091                   target_Length, paste_ID, kybd_ID, num_rows,`20
  61. X`092                   num_cols, display_ID, mm_id
  62. X
  63. X`09logical             found
  64. X
  65. X`09record      / link_list /  a
  66. X
  67. X
  68. X`09character*20         servers (184)
  69. X`09common    / server_info /  servers, bitmap_base_addr
  70. X
  71. X`09character*20         target_name
  72. X`09character*150        txt, blank
  73. X
  74. X`09integer*4            length, len_trim, ioerror, io_OK, rms_sts, rms_stv,
  75. X`091                    option / 5 /, two / 2 /, bitmap_base_addr,
  76. X`092                    bit_num
  77. X
  78. X`09external             len_trim
  79. X
  80. X
  81. X
  82. Xc
  83. Xc ---`09See if queue is empty. If not, then empty it.
  84. Xc
  85. X`09if ((qheader(1) .ne. 0) .and. (qheader(2) .ne. 0)) then
  86. X`09   status = SS$_NORMAL
  87. X`09   do while (status .ne. LIB$_QUEWASEMP)
  88. X`09      call REMQH (qheader, status)
  89. X`09   enddo
  90. Xd`09   write (66,'(1x,2(z8,3x))') qheader(1), qheader(2)
  91. X`09endif
  92. X
  93. X`09qheader (1) = 0
  94. X`09qheader (2) = 0
  95. X
  96. X
  97. X
  98. X`09found = .false.
  99. X`09ordinal = 0
  100. X
  101. X
  102. X1`09format (a150)
  103. X
  104. X
  105. X
  106. X`09call repeat (blank, ' ')
  107. X`09target_length = len_trim (target_name)
  108. X
  109. X`09open (unit = 11, file = 'sys$manager:userlog.txt', status = 'old',
  110. X`091     readonly)
  111. X
  112. X`09call STR$UPCASE (target_name, target_name)
  113. X
  114. X`09do i = 1,10000000
  115. X`09   txt = blank
  116. X`09   read (11,1,iostat=ioerror,end=1000,err=1100) txt
  117. X`09   length = len_trim (txt)
  118. X`09   username   = txt (1:20)
  119. X`09   server     = txt (21:40)
  120. X`09   length = left_justify (server)
  121. X`09   time_stamp = txt (41:64)
  122. X`09   mode       = txt (65:78)
  123. X`09   master_PID = txt (79:87)
  124. X`09   pid        = txt (88:96)
  125. X`09   login_time = txt (97:120)
  126. X`09   uic        = txt (121:140)
  127. X`09   terminal   = txt (140:149)
  128. X`09   if (len_trim(server) .eq. 0) server = 'Unavailable'
  129. X`09   if (len_trim(time_stamp) .eq. 0)  time_stamp = 'Unavailable'
  130. X`09   if (len_trim(mode) .eq. 0)  mode = 'Unavail'
  131. X`09   if (len_trim(master_pid) .eq. 0)  master_PID= 'Unavail'
  132. X`09   if (len_trim(pid) .eq. 0)  pid = 'Unavail'
  133. X`09   if (len_trim(login_time) .eq. 0)  login_time = 'Unavailable'
  134. X`09   if (len_trim(uic) .eq. 0)  UIC = 'Unavailable'
  135. X`09   if (len_trim(terminal) .eq. 0)  terminal = 'Unavail'
  136. X`09  `20
  137. Xd`09   if (index(username,target_name(1:target_length)) .ne. 0) then
  138. Xd`09      write (66,*) username, server, time_stamp, mode, master_pid, pid,
  139. Xd`091                 login_time, uic, terminal
  140. Xd`09   endif
  141. X
  142. X`09   if (index(username,target_name(1:target_length)) .ne. 0) then
  143. X`09      found = .true.
  144. X`09      ordinal = ordinal + 1
  145. X`09      call INSQH (qheader, username, server, time_stamp, mode,
  146. X`091                 master_pid, pid, login_time, uic, terminal)
  147. X`09      call INSERT_INTO_HASHTABLE (server, length)
  148. X`09   endif
  149. X
  150. X`09enddo
  151. X
  152. X`09goto 1000
  153. X
  154. X1100`09if (ioerror .ne. io_OK) then
  155. X`09   call ERRSNS (,rms_sts,rms_stv,)
  156. X`09   call LIB$SIGNAL (%val(rms_sts),%val(rms_stv))
  157. X`09else
  158. X`09   write (6,*) 'unknown I/O error reading USERLOG.TXT'
  159. X`09   call LIB$WAIT (3.0)
  160. X`09   call AST
  161. X`09endif
  162. X
  163. X1000`09close (unit=11)
  164. X
  165. X
  166. Xd`09bit_num = 0
  167. X
  168. Xd`09do while (bit_num .ge. 0)
  169. Xd`09   write (6,2)
  170. X2`09format (1x,'Enter bit to test (1-184) ===> ',$)
  171. Xd`09   read (5,*) bit_num
  172. Xd`09   if (bit_num .gt. 0) then
  173. Xd`09      call test_bit (%val(bitmap_base_addr), bit_num, status)
  174. Xd`09      if (status .eq. ss$_wasset) write (6,*) 'bit was already set.'
  175. Xd`09      if (status .eq. ss$_wasclr) write (6,*) 'bit was clear.'
  176. Xd`09   endif
  177. Xd`09enddo
  178. X
  179. X`09bit_num = 0
  180. X`09status = 0
  181. X`09num_Bytes = 24 `09
  182. X`09num_Longwords = nint(8. * float(num_bytes) / 32.)
  183. X
  184. X`09call find_set_bits (%val(bitmap_base_addr), bit_num, num_Longwords,`20
  185. X`091                   status)
  186. X
  187. Xd`09istat = LIB$FREE_VM (num_bytes, bitmap_base_addr)
  188. Xd`09if (.not. istat) then
  189. Xd`09   call LIB$SIGNAL (%val(istat))
  190. Xd`09endif
  191. X
  192. X
  193. X
  194. X
  195. X`09return
  196. X`09end
  197. X
  198. Xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  199. Vcccc
  200. Xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  201. Vcccc
  202. Xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  203. Vcccc
  204. X
  205. X
  206. X`09subroutine READ_USERNAME (target_name)
  207. X
  208. X
  209. X`09common / SMG_data /  paste_ID, kybd_ID, num_rows, num_cols, display_ID,
  210. X`091                    mm_id
  211. X
  212. X`09include        '($SYSSRVNAM)'
  213. X`09include        '($SMGDEF)'
  214. X`09include        '($IODEF)'
  215. X`09include        '($TRMDEF)'
  216. X
  217. X
  218. X`09real*4          val
  219. X
  220. X`09integer*4       i, status, mm_kybd_ID, mm_id, mod, term,
  221. X`091               option, left_justify, length, len_trim, scroll_ID, entry_
  222. VID
  223. X
  224. X`09character*20    target_name
  225. X`09integer*2       terminator
  226. X`09character*1     term_string
  227. X
  228. X`09external        len_trim, left_justify
  229. X
  230. X
  231. X`09mod = TRM$M_TM_CVTLOW .or. TRM$M_TM_PURGE
  232. X
  233. X1`09call SMG$ERASE_CHARS (display_ID, 23, 2, 16)
  234. X`09call SMG$SET_CURSOR_ABS (display_ID, 2, 16)
  235. X`09call repeat (target_name, ' ')
  236. X`09call SMG$READ_STRING (kybd_ID, target_name, , 20, mod , , ,`20
  237. X`091                     num_char_read ,`20
  238. X`092                     terminator, display_ID, , , , term_string)
  239. X`09length = left_justify (target_name)
  240. X`09if (length .eq. 0) goto 1
  241. X
  242. X
  243. X
  244. X
  245. X`09return
  246. X`09end
  247. X
  248. Xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  249. Vcccc
  250. Xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  251. Vcccc
  252. Xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  253. Vcccc
  254. X
  255. X`09subroutine DISPLAY_PORTS_ONLY (qheader)
  256. X
  257. X
  258. X
  259. X
  260. X`09implicit       none
  261. X
  262. X`09include              '($SSDEF)'
  263. X`09include              '($SMGDEF)'
  264. X`09include              '($TRMDEF)'
  265. X`09include              '($SYSSRVNAM)'
  266. X`09include              '($LIBDEF)'
  267. X`09include              'dua2:`5Bkoffley.com`5Duserlog_struc.inc'
  268. X
  269. X`09common / num_elements /   num_q_elements
  270. X
  271. X`09common / SMG_data /  paste_ID, kybd_ID, num_rows, num_cols, display_ID,
  272. X`091                    mm_id
  273. X
  274. X`09integer*2           terminator
  275. X
  276. X`09integer*4           qheader (2), status, paste_ID, kybd_ID, num_rows,`20
  277. X`091                   num_cols, display_ID, mm_id, rows, cols, mask,
  278. X`092                   modifiers, zero / 0 /, max_chars, scroll_ID,
  279. X`093                   SMG$READ_STRING, num_q_elements, current_line,
  280. X`094                   num_scroll_lines, address, i, num
  281. X
  282. X`09logical             found
  283. X
  284. X`09record      / link_list /  qentry
  285. X
  286. X
  287. X`09character*80         out_str
  288. X`09character*5          in_string
  289. X
  290. X`09integer*4            length, len_trim, two / 2 /, one / 1 /, irow
  291. X
  292. X`09external             len_trim, SMG$READ_STRING
  293. X
  294. X
  295. X
  296. X
  297. X
  298. X
  299. X
  300. X`09if ((qheader(1) .eq. 0) .and. (qheader(2) .eq. 0)) then
  301. X`09   write (6,*) 'Queue was empty'
  302. X`09   return
  303. X`09endif
  304. X
  305. Xd`09write (66,*) 'num q elements = ',num_q_elements
  306. X`09max_chars = 6
  307. X`09num_scroll_Lines = 5
  308. Xc
  309. Xc ---`09Set up the scrolling region
  310. Xc
  311. X`09rows = num_q_elements + num_scroll_lines - 1
  312. X`09cols = 80
  313. X`09call SMG$CREATE_VIRTUAL_DISPLAY (rows, cols, scroll_ID, SMG$M_BORDER)
  314. X`09call SMG$LABEL_BORDER (scroll_ID, ' Ports Used ')
  315. X`09call SMG$CREATE_VIEWPORT (scroll_ID, 1, 1, num_scroll_lines, 78)
  316. X`09mask = 0
  317. X`09mask = SMG$M_SCROLL_SMOOTH + SMG$M_CURSOR_OFF
  318. X`09call SMG$SET_CURSOR_MODE (paste_ID, mask)
  319. X`09call SMG$HOME_CURSOR (scroll_ID, SMG$C_UPPER_LEFT)
  320. X`09modifiers = 0
  321. X`09modifiers = TRM$M_TM_ESCAPE .or. TRM$M_TM_NOECHO .or.`09
  322. X`091           TRM$M_TM_PURGE
  323. X
  324. X`09irow = 1
  325. X
  326. X`09call GET_Q_ELEMENT (%val(qheader(1)), qentry)
  327. X
  328. X
  329. X`09call REPEAT (out_str, ' ')
  330. X`09out_str = qentry.username(1:12)//' '//qentry.login_time//' '//
  331. X`091         qentry.server//' '//qentry.terminal
  332. X`09call SMG$PUT_CHARS (scroll_ID, out_str, irow, 3, zero, ,,0)
  333. X`09irow = irow + 1
  334. Xc
  335. Xc ---`09See if queue contained only a single element
  336. Xc
  337. X`09if ((qheader(1) .eq. qheader(2)) .or.
  338. X`091   (qentry.forward_link .eq. qentry.back_link)) then
  339. Xd`09   write (66,*) 'END       OF           QUEUE'
  340. X`09   irow = irow - 1
  341. X`09   goto 700
  342. X`09endif
  343. X
  344. X
  345. X`09do while (qentry.back_link .ne. qheader(2))
  346. X`09   if (qentry.back_link .eq. qheader(2)) then
  347. X`09      address = qentry.back_link
  348. X`09      call GET_Q_ELEMENT (%val(address), qentry)
  349. X`09      call REPEAT (out_str, ' ')
  350. X`09      out_str = qentry.username(1:12)//' '//qentry.login_time//' '//
  351. X`091               qentry.server//' '//qentry.terminal
  352. X
  353. X`09      call SMG$PUT_CHARS (scroll_ID, out_str, irow, 3, zero, ,,0)
  354. X`09      goto 700
  355. Xd`09      write (66,*) 'END       OF           QUEUE'
  356. X`09   else
  357. X`09      address = qentry.back_link
  358. X`09      call GET_Q_ELEMENT (%val(address), qentry)
  359. X`09      call REPEAT (out_str, ' ')
  360. X`09      out_str = qentry.username(1:12)//' '//qentry.login_time//' '//
  361. X`091               qentry.server//' '//qentry.terminal
  362. X
  363. X`09      call SMG$PUT_CHARS (scroll_ID, out_str, irow, 3, zero, ,,0)
  364. X`09      irow = irow + 1
  365. X`09   endif
  366. X`09enddo
  367. X
  368. X`09if (qentry.back_link .eq. qheader(2)) then
  369. X`09   address = qentry.back_link
  370. X`09   call GET_Q_ELEMENT (%val(address), qentry)
  371. X`09   call REPEAT (out_str, ' ')
  372. X`09   out_str = qentry.username(1:12)//' '//qentry.login_time//' '//
  373. X`091            qentry.server//' '//qentry.terminal
  374. X`09   call SMG$PUT_CHARS (scroll_ID, out_str, irow, 3, zero, ,,0)
  375. Xd`09   write (66,*) 'END       OF           QUEUE'
  376. X`09endif
  377. X
  378. X
  379. X
  380. X
  381. X700`09continue
  382. X`09call SMG$PASTE_VIRTUAL_DISPLAY (scroll_ID, paste_ID, 13, 2)
  383. X`09status = SMG$READ_STRING (kybd_ID, in_string, , max_chars, modifiers,,,,
  384. X`091                         terminator)
  385. X
  386. X`09irow = num_scroll_lines
  387. X`09current_Line     = 1
  388. X
  389. X`09do while ((status) .and. (terminator .ne. SMG$K_TRM_CR) .and.
  390. X`091                        (terminator .ne. SMG$K_TRM_ENTER) .and.
  391. X`092                        (terminator .ne. SMG$K_TRM_CTRLZ))
  392. X`09   if (.not. status) call LIB$SIGNAL (%val(status))
  393. X
  394. X`09   if ((terminator .eq. SMG$K_TRM_KP8) .or.
  395. X`091      (terminator .eq. SMG$K_TRM_UP)  .or.
  396. X`092      (terminator .eq. SMG$K_TRM_NEXT_SCREEN)) then
  397. X`09      num = current_line + num_scroll_lines
  398. X`09      if (num .gt. num_q_elements) then
  399. X`09         num = num_q_elements - current_line
  400. X`09         current_line = num_q_elements
  401. X`09      else
  402. X`09         current_line = num
  403. X`09         num = num_scroll_lines
  404. X`09      endif
  405. X
  406. X`09      do i = 1, num
  407. X`09         call SMG$SCROLL_VIEWPORT (scroll_ID, SMG$M_UP, 1)
  408. X`09      enddo
  409. X`09   elseif ((terminator .eq. SMG$K_TRM_KP2) .or.
  410. X`091          (terminator .eq. SMG$K_TRM_DOWN)  .or.
  411. X`092          (terminator .eq. SMG$K_TRM_PREV_SCREEN)) then
  412. X`09      num = current_line - num_scroll_lines
  413. X`09      if (num .lt. 1) then
  414. X`09         num = current_line - 1
  415. X`09         current_line = 1
  416. X`09      else
  417. X`09         current_line = num
  418. X`09         num = num_scroll_lines
  419. X`09      endif
  420. X
  421. X`09      do i = 1, num
  422. X`09         call SMG$SCROLL_VIEWPORT (scroll_ID, SMG$M_DOWN, 1)
  423. X`09      enddo
  424. X
  425. X           elseif (terminator.eq.smg$k_trm_ctrlw) then
  426. X              call smg$repaint_screen ( paste_ID )
  427. X
  428. X           elseif ((terminator.eq.smg$k_trm_ctrlz) .or.
  429. X`091          (terminator .eq. SMG$K_TRM_CR)) then
  430. X`09     goto 1000
  431. X
  432. X`09   endif
  433. X
  434. X`09   status = SMG$READ_STRING (kybd_ID, in_string,, max_chars,
  435. X`091                            modifiers,,,, terminator)
  436. X`09enddo
  437. X
  438. X1000`09mask = 0
  439. X
  440. X
  441. X`09mask = SMG$M_SCROLL_JUMP + SMG$M_CURSOR_ON
  442. X`09call SMG$DELETE_VIRTUAL_DISPLAY (scroll_ID)
  443. X`09call SMG$SET_CURSOR_MODE (paste_ID, mask)
  444. X`09call SMG$UNPASTE_VIRTUAL_DISPLAY (scroll_id, paste_id)
  445. X
  446. X
  447. X
  448. X
  449. X`09return
  450. X`09end
  451. X
  452. X
  453. X
  454. Xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  455. Vcccc
  456. Xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  457. Vcccc
  458. Xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  459. Vcccc
  460. X
  461. X
  462. X
  463. X`09subroutine INSERT_INTO_HASHTABLE (server, length)
  464. X
  465. X`09include            '($LIBDEF)'
  466. X`09include            '($SSDEF)'
  467. X
  468. X
  469. X`09character*20         servers (184)
  470. X`09common    / server_info /  servers, bitmap_base_addr
  471. X
  472. X
  473. X`09integer*4        left_justify, length, hash_num, bitmap_base_addr,
  474. X`091                bit_num, status
  475. X`09character*(*)    server
  476. X
  477. X`09real*4           x, rands
  478. X`09integer*4        randi, lower / 1 /, upper / 181 / ,
  479. X`091                start_seed   / 1055744 /
  480. X
  481. X`09call GET_HASH_NUM (%ref(kilo), %ref(Length), %loc(server))
  482. Xd`09write (66,*) 'server ',server(1:length) ,' hashes to ',kilo
  483. X`09bit_num = 0
  484. X`09icount = 0
  485. X
  486. X1`09   bit_num = kilo
  487. X`09   if (bit_num .gt. 0) then
  488. X`09      call set_bit (%val(bitmap_base_addr), bit_num, status)
  489. X`09      if (status .eq. ss$_wasset) then
  490. X`09         if (servers(bit_num)(1:length) .eq. server(1:length)) then
  491. Xd`09            write (66,*) 'Duplicate detected: ',server(1:length),' --- '
  492. V,servers(bit_num)(1:length)
  493. X`09         else
  494. Xd`09            write (66,*) 'COLLISION : ',server(1:length),' --- ',servers
  495. V(bit_num)(1:length)
  496. X`09            icount = icount + 1
  497. +-+-+-+-+-+-+-+-  END  OF PART 16 +-+-+-+-+-+-+-+-
  498. -- 
  499. \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  500. < Joe Koffley                        KOFFLEY@NRLVAX.NRL.NAVY.MIL             >
  501. < Naval Research Laboratory          KOFFLEY@CCF.NRL.NAVY.MIL                >
  502. < Space Systems Division             AT&T  :  202-767-0894                   >
  503. \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  504.