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

  1. Path: wupost!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 12 of 18
  5. Message-ID: <1991Sep5.074608.556@nrlvx1.nrl.navy.mil>
  6. Date: 5 Sep 91 11:46:08 GMT
  7. Organization: NRL SPACE SYSTEMS DIVISION
  8. Lines: 474
  9.  
  10. -+-+-+-+-+-+-+-+ START OF PART 12 -+-+-+-+-+-+-+-+
  11. X        if (.not. user_exists) then
  12. X           call smg$put_chars ( main,
  13. X     .      'Account has been added', 21, 1 )
  14. X        elseif (user_exists) then
  15. X           call smg$put_chars ( main,
  16. X     .      'Account has been modified', 21, 1 )
  17. X        endif
  18. XC
  19. XC Check to see if the toplevel directory already exists. If it does,
  20. XC return to the main program.
  21. XC
  22. X        if (.not.user_exists) then
  23. X           inquire (file=main_dev(1:offset-1)//':`5B0,0`5D'//
  24. X     .     defdir(index(defdir,'`5B')+1:index(defdir,'`5D')-1)//
  25. X     .     '.DIR;1',exist=directory_exists)
  26. X           if (.not.directory_exists) then
  27. XC
  28. XC Create the toplevel directory using LIB$CREATE_DIR. It might be a
  29. XC good idea to enable BYPASS and/or EXQUOTA privilege to ensure that
  30. XC the directory is created, so we can do that now. If you do not want
  31. XC to use this feature, delete the following lines of code.
  32. XC
  33. XC Make a call to $SETPRV to set some needed privileges in case this
  34. XC program is being run from an account which does not have all
  35. XC privileges enabled.
  36. XC
  37. X              sts = sys$setprv ( %val(enbflg), priv_mask ,, )
  38. X              if (.not.sts) call lib$signal ( %val(sts) )
  39. XC
  40. XC Get the directory spec string to pass to LIB$CREATE_DIR
  41. XC
  42. X              dir_spec = defdev(1:defdev_len)//':'//
  43. X     .         defdir(1:defdir_len)
  44. X              spec_len = index(dir_spec,' ')-1
  45. XC
  46. XC Make the call to LIB$CREATE_DIR to create the user directory
  47. XC
  48. X              call lib$create_dir ( dir_spec(1:spec_len), uic_value )
  49. X           endif
  50. XC
  51. XC If you do not want to copy a sample login.com to the user directory,
  52. XC remove the following line.
  53. XC
  54. X           call copy ( dir_spec(1:spec_len) )
  55. X        else
  56. X           return
  57. X        endif
  58. X
  59. X        end
  60. X
  61. XC************************************************************************
  62. X
  63. X        Subroutine COPY ( dir_spec )
  64. XC
  65. XC The purpose of this subroutine is to copy a sample login.com file
  66. XC to the directory of the new user. If you do not want to use this
  67. XC option, remove the entire subroutine. If you do want to use this
  68. XC routine, modify the character string 'infile' to specify the location
  69. XC and name of the sample login file. This copy routine uses the
  70. XC CONVERT utility.
  71. XC
  72. X        Integer*4 conv$pass_files, conv$pass_options, conv$convert
  73. X        Integer*4 option /0/
  74. X        Integer*4 stsblk(5) /4,0,0,0,0/
  75. X        Character*40 infile                             ! Modify this
  76. X     .    /'SYS$SYSROOT:`5BSYSMGR.COM`5DSAMPLE_LOGIN.COM'/  ! character stri
  77. Vng
  78. X        Character*80 outfile
  79. X        Character*(*) dir_spec
  80. X
  81. X        outfile = dir_spec//'LOGIN.COM'
  82. X
  83. X        call conv$pass_files ( infile, outfile )
  84. X        call conv$pass_options ( option )
  85. X        call conv$convert ( stsblk )
  86. X
  87. X        end
  88. X
  89. XC************************************************************************
  90. X
  91. X        Subroutine SENDMAIL
  92. XC
  93. XC This subroutine will send a brief welcome message to the new user. If
  94. XC you have no interest in doing this, you should delete this routine.
  95. XC
  96. XC If the file SYS$LOGIN:NEWUSER.TXT exists, it will be sent to the user.
  97. XC If the file doesn't exist, a short default message file will be created
  98. XC and that will be sent. You may wish to create a NEWUSER.TXT to place in
  99. XC your home directory. This file could contain general user information
  100. XC and site policy, etc.
  101. XC
  102. XC - JMH
  103. XC
  104. X        Include 'uaf.cmn'
  105. X        Include 'maildef.inc'
  106. X        Include '($syidef)'
  107. X        Character*10 subject
  108. X`09Character*20 node
  109. X`09Integer*4 lib$getsyi
  110. X`09Integer node_len, send_ctx
  111. X`09Logical file_exists
  112. X
  113. X        structure /itemlist/
  114. X           integer*2 len
  115. X           integer*2 item_code
  116. X           integer*4 address
  117. X           integer*4 retlen
  118. X        end structure
  119. X
  120. X        record /itemlist/ msg_info(2), null, body(2), address(2),`20
  121. X     .   create(2)
  122. XC
  123. XC get the nodename`20
  124. XC
  125. X`09call lib$getsyi ( syi$_nodename ,, node, node_len )
  126. X`09if (node .eq. ' ') node = 'the system'
  127. X
  128. X`09subject = 'Welcome' ! change this line to suit your purpose
  129. XC
  130. XC look for a file called NEWUSER.TXT in your home directory. If it
  131. XC doesn't exist, a file will be created.
  132. XC
  133. X`09inquire (file='SYS$LOGIN:NEWUSER.TXT', exist=file_exists)
  134. X`09if (.not. file_exists) then
  135. X           open (unit=1, status='new', file='SYS$LOGIN:NEWUSER.TXT')
  136. X`09   write (1,'(a)') 'Greetings,'
  137. X`09   write (1,'(a)') ' '
  138. X           write (1,'(a)')`20
  139. X     .      'You now have an account on ' // node(1:node_len) //
  140. X     .      '. If you have any'
  141. X           write (1,'(a)')`20
  142. X     .      'questions, please contact me at the above email address.'
  143. X           write (1,'(a)') ' '
  144. X           write (1,'(a)') 'Thank you and welcome aboard!'
  145. X           close (1)
  146. X        endif
  147. X
  148. X        call mail_setup ( address, mail$_send_username,`20
  149. X     .   username(1:username_len), )
  150. X        call mail_setup ( msg_info, mail$_send_subject, subject, )
  151. X        call mail_setup ( body, mail$_send_filename,`20
  152. X     .   'SYS$LOGIN:NEWUSER.TXT', )
  153. X
  154. X        call mail$send_begin ( send_ctx, null, null )
  155. X        call mail$send_add_attribute ( send_ctx, msg_info, null )
  156. X        call mail$send_add_bodypart ( send_ctx, body, null )
  157. X        call mail$send_add_address ( send_ctx, address, null )
  158. X        call mail$send_message ( send_ctx, null, null )
  159. X        call mail$send_end ( send_ctx, null, null )
  160. X
  161. X`09end
  162. X
  163. XC************************************************************************
  164. X
  165. X        Subroutine MAIL_SETUP ( item, code, string, ret_len )
  166. XC
  167. XC This subroutine is called in order to set up the itemlists needed by
  168. XC the main program
  169. XC
  170. X        character*(*) string
  171. X        integer ret_len
  172. X        integer code
  173. X
  174. X        structure /itemlist/
  175. X           integer*2 len
  176. X           integer*2 item_code
  177. X           integer*4 address
  178. X           integer*4 retlen
  179. X        end structure
  180. X
  181. X        record /itemlist/ item
  182. X
  183. X        item.len = len(string)
  184. X        item.item_code = code
  185. X        item.address = %loc(string)
  186. X        item.retlen = %loc(ret_len)
  187. X
  188. X        end
  189. X
  190. Xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  191. Vcccc
  192. Xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  193. Vcccc
  194. Xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  195. Vcccc
  196. X
  197. X
  198. X`09subroutine repeat (char_variable, fill_char)
  199. X
  200. X
  201. X`09character*(*)      char_variable
  202. X`09character*1        fill_char
  203. X
  204. X`09do i = 1, len(char_variable)
  205. X`09   char_variable(i:i) = fill_char
  206. X`09enddo
  207. X
  208. X`09return
  209. X`09end
  210. X
  211. X
  212. Xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  213. Vcccc
  214. Xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  215. Vcccc
  216. Xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  217. Vcccc
  218. X
  219. X
  220. X`09subroutine show_rights
  221. X
  222. X        Include        'uaf.cmn'
  223. X`09include        '($SSDEF)'
  224. X`09include        '($LIBDEF)'
  225. X`09include        '($UAIDEF)'
  226. X        Integer*4 line, col, i, j, SYS$FIND_HELD , SYS$IDTOASC`20
  227. X        Character*25 string
  228. X
  229. X`09integer*4      holder_uic (2), ident_value
  230. X`09integer*4      identifier, attrib_mask, context, status, name_Len
  231. X`09character*132  char_buffer
  232. X`09character*40   char_rights (100)
  233. X
  234. X`09external       SYS$FIND_HELD, SYS$IDTOASC`20
  235. X
  236. X
  237. X
  238. X
  239. X`09holder_uic (1) = uic_value
  240. Xd`09write (66,'(1x,z8)' ) uic_value
  241. Xd`09write (66,*) pasteboard
  242. X
  243. X`09context = 0
  244. X`09attrib_mask = 0
  245. X`09holder_uic (2) = 0
  246. X`09num_rights = 0
  247. X
  248. X`09do while (.true.)
  249. X`09   status = SYS$FIND_HELD (holder_uic(1), identifier, attrib_mask,`20
  250. X`091                          context)
  251. X`09   if (.not. status) then
  252. X`09     if (status .eq. SS$_NOSUCHID) then
  253. X`09        call SYS$FINISH_RDB (context)
  254. X`09        goto 1000
  255. X`09     else
  256. X`09        call SYS$FINISH_RDB (context)
  257. X`09        call LIB$SIGNAL (%val(status))
  258. X`09     endif
  259. X
  260. X`09   else
  261. Xd`09      write (6,*) 'FIND_HELD is OK , identifier= ',identifier
  262. X`09      status = SYS$IDTOASC (%val(identifier), namelen, char_buffer,
  263. X`091                           ident_value, attrib_mask, new_context)
  264. X`09      if (.not. status) then
  265. X`09         call SYS$FINISH_RDB (context)
  266. X`09         call lib$signal(%val(status))
  267. X`09         goto 1000
  268. X`09      else
  269. X`09         num_rights = num_rights + 1
  270. X`09         char_rights (num_rights) = char_buffer(1:namelen)
  271. Xd`09         write (6,*) char_buffer(1:namelen)
  272. X`09      endif
  273. X
  274. X`09   endif
  275. X
  276. X`09enddo
  277. X
  278. X1000`09call DISPLAY_RIGHTS (char_rights, num_rights)
  279. X
  280. X`09return
  281. X`09end
  282. X
  283. Xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  284. Vcccc
  285. Xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  286. Vcccc
  287. Xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  288. Vcccc
  289. X
  290. X
  291. X`09integer*4 function LEFT_JUSTIFY (source)
  292. X
  293. X`09include    '($strdef)'
  294. X
  295. X`09character*(*)    source
  296. X`09character*132    dest
  297. X`09integer*4        length, start
  298. X
  299. X`09call str$trim (dest, source, length)
  300. X`09call repeat (source, ' ')
  301. Xc
  302. Xc ---`09Remove any leading blanks or nulls
  303. Xc
  304. X`09do i = 1, length
  305. X`09   if ((dest(i:i) .ne. ' ') .and. dest(i:i) .ne. char(0)) then
  306. X`09      start = i
  307. X`09      goto 3
  308. X`09   endif
  309. X`09enddo
  310. X
  311. X3`09call str$len_extr (source, dest, start, length-start+1)
  312. X`09call repeat (dest, ' ')
  313. X`09call str$trim (source, source, length)
  314. Xd`09write (66,4) source, length
  315. X4`09format (1x,'dest strng =  'a<length>,/,1x,'Contains ',i2,' chars.')
  316. X`09left_justify = length
  317. X
  318. X`09return
  319. X`09end
  320. X
  321. X
  322. Xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  323. Vcccc
  324. Xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  325. Vcccc
  326. Xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  327. Vcccc
  328. X
  329. X`09integer function LEN_TRIM (string)
  330. Xc
  331. Xc  Function to return length of string to last non-blank, non-null character
  332. Xc
  333. Xc  Form of call:`09length = len_trim(string)
  334. Xc
  335. Xc  Where`09length`09is the returned integer length
  336. Xc`09`09string`09is the character string
  337. Xc
  338. X        character*(*) string
  339. X
  340. X        do i=len(string),1,-1
  341. X            if(string(i:i).ne.' ')then
  342. X`09`09if(string(i:i).ne.char(0))then
  343. X`09`09    goto 10
  344. X`09`09endif
  345. X`09    endif
  346. X`09enddo
  347. X
  348. X10      len_trim=i
  349. X
  350. X        return
  351. X        end
  352. X
  353. Xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  354. Vcccc
  355. Xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  356. Vcccc
  357. Xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  358. Vcccc
  359. X
  360. X`09subroutine DISPLAY_RIGHTS (char_rights, num_rights)
  361. X
  362. X`09implicit      none
  363. X`09include       'uaf.cmn'
  364. X`09include       '($TRMDEF)'
  365. X`09include       '($SMGDEF)'
  366. X
  367. X`09integer*4     rows, cols, status, disp1, modifiers, mask, i, kilo,
  368. X`091             num_scroll_lines, num, current_line, num_rights,
  369. X`092             length, left_justify, max_chars
  370. X
  371. X`09integer*2     terminator
  372. X
  373. X`09character*1   input_string
  374. X`09character*(*) char_rights (*)
  375. X
  376. X
  377. X
  378. X
  379. X`09rows = num_rights + 2   ! make as large as number of total items in`20
  380. X`09`09`09`09! scroll buffer
  381. X`09              `09`09! plus (number of scroll lines displayed - 1)
  382. X`09cols = 40
  383. X
  384. X`09call SMG$ERASE_DISPLAY (message)
  385. X        call SMG$PUT_CHARS ( message,
  386. X     .   'Use arrow keys/NEXT/PREV or keypad to scroll.',
  387. X     .   1, 2 )
  388. X        call SMG$PUT_CHARS ( message,
  389. X     .   'ControlZ: exit to main display.',
  390. X     .   2, 2 )
  391. X        call smg$paste_virtual_display ( message, pasteboard, 22, 1 )
  392. X`09call SMG$CREATE_VIRTUAL_DISPLAY (rows, cols, disp1, SMG$M_BORDER)
  393. X`09call SMG$LABEL_BORDER (disp1, ' RIGHTS ')
  394. X
  395. Xc ---`09The "3" is the number of scroll lines displayed
  396. X`09call SMG$CREATE_VIEWPORT (disp1, 1, 1, 3, 40)
  397. X
  398. X`09if (num_rights .eq. 0) then
  399. X`09   char_rights(1) = 'No Rights Held'
  400. X`09   num_rights = 1
  401. X`09endif
  402. X
  403. X`09do i = 1, num_rights
  404. X`09   length = left_justify (char_rights(i))
  405. X`09   call CENTER_STRING (char_rights(i), 40, status)
  406. X`09   call SMG$PUT_CHARS (disp1, char_rights(i), i, 1)
  407. X`09enddo
  408. X
  409. X`09call SMG$PASTE_VIRTUAL_DISPLAY (disp1, pasteboard, 10, 20)
  410. Xc
  411. Xc ---`09Set smooth scrolling
  412. Xc
  413. X`09mask = 0
  414. X`09mask = SMG$M_SCROLL_SMOOTH + SMG$M_CURSOR_OFF
  415. X
  416. X`09call SMG$SET_CURSOR_MODE (pasteboard, mask)
  417. X
  418. X`09call SMG$HOME_CURSOR (disp1, SMG$C_UPPER_LEFT)
  419. X
  420. X`09modifiers = TRM$M_TM_ESCAPE .or. TRM$M_TM_NOECHO .or. TRM$M_TM_PURGE
  421. X`09max_chars = 6
  422. X`09status = SMG$READ_STRING (keyboard, input_string, ,max_chars,`20
  423. X`091                         modifiers,,,, terminator)
  424. X
  425. X`09num_scroll_lines = 2
  426. X`09current_line     = 1
  427. X
  428. X`09do while (status)
  429. X
  430. X`09   if (.not. status) call LIB$SIGNAL(%val(status))
  431. X
  432. X`09   if ((terminator .eq. SMG$K_TRM_KP8) .or.
  433. X`091      (terminator .eq. SMG$K_TRM_UP)  .or.
  434. X`092      (terminator .eq. SMG$K_TRM_NEXT_SCREEN)) then
  435. X`09      num = current_line + num_scroll_Lines
  436. X`09      if (num .gt. num_rights) then
  437. X`09         num          = num_rights - current_line
  438. X`09         current_line = num_rights
  439. X`09      else
  440. X`09         current_line = num
  441. X`09         num          = num_scroll_lines
  442. X`09      endif
  443. X`09      do i = 1, num
  444. X`09         call SMG$SCROLL_VIEWPORT (disp1, SMG$M_UP, 1)
  445. X`09      enddo
  446. X`09   elseif ((terminator .eq. SMG$K_TRM_KP2) .or.
  447. X`091          (terminator .eq. SMG$K_TRM_DOWN).or.
  448. X`092          (terminator .eq. SMG$K_TRM_PREV_SCREEN)) then
  449. X`09      num = current_line - num_Scroll_Lines
  450. X`09      if (num .lt. 1) then
  451. X`09         num          = current_line - 1
  452. X`09         current_line = 1
  453. X`09      else
  454. X`09         current_line = num
  455. X`09         num          = num_scroll_lines
  456. X`09      endif
  457. X`09      do i = 1, num
  458. X`09         call SMG$SCROLL_VIEWPORT (disp1, SMG$M_DOWN, 1)
  459. X`09      enddo
  460. X
  461. X           elseif ((terminator.eq.smg$k_trm_ctrlz) .or.
  462. X`091          (terminator .eq. SMG$K_TRM_CR)) then
  463. X`09     goto 1000
  464. X
  465. X           elseif (terminator.eq.smg$k_trm_ctrlw) then
  466. X              call smg$repaint_screen ( pasteboard )
  467. X
  468. X`09   endif
  469. X
  470. X`09   status = SMG$READ_STRING (keyboard, input_string, ,max_chars,`20
  471. X`091                            modifiers,,,, terminator)
  472. X`09enddo
  473. X
  474. X1000`09mask = 0
  475. X`09mask = SMG$M_SCROLL_JUMP + SMG$M_CURSOR_ON
  476. X
  477. +-+-+-+-+-+-+-+-  END  OF PART 12 +-+-+-+-+-+-+-+-
  478. -- 
  479. \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  480. < Joe Koffley                        KOFFLEY@NRLVAX.NRL.NAVY.MIL             >
  481. < Naval Research Laboratory          KOFFLEY@CCF.NRL.NAVY.MIL                >
  482. < Space Systems Division             AT&T  :  202-767-0894                   >
  483. \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  484.