From:	MERC::"uunet!CRVAX.SRI.COM!RELAY-INFO-VAX" 20-JUL-1992 10:05:54.23
To:	info-vax@sri.com
CC:	
Subj:	OPCON  5/5

+-+-+-+ Beginning of part 5 +-+-+-+
X*     Selects the user to send a message too.  Only the username is        *
X*     displayed.  Only processes associated with terminals are displayed.  *
X*                                                                          *
X*                         Version 1.00    29-May-1992                      *
X*                         Version 1.00    29-May-1992                      *
X*                                                                          *
X****************************************************************************
X
X      implicit none
X     `032
X      include '($ssdef)'
X      include '($smgdef)'
X      include '($jpidef)'
X      include 'smg_common.for'
X           `032
X      structure   /itmlst/
X        union
X          map
X            integer*2 buflen,itmcod
X            integer*4 bufadr,retadr
X          end map
X          map
X            integer*4 end_list
X          end map
X        end union
X      end structure
X       `032
X      structure   /iosblk/
X        integer*4 sts,zeroed
X      end structure
X           `032
X      character*12  menu_choices(200),user(200)
X      character*12  user_to_send_to         `032
X      character*12  username
X      character*256 junk
X      character*7   terminal
X      character*8   label    /'Send to:'/
X     `032
X      integer   choice
X      integer   i,j
X      integer   length
X      integer   number_of_users   `032
X      integer   status
X      integer   sys$getjpiw
X      integer   terminal_len     `032
X      integer   terminator
X      integer   user_menu
X      integer   username_len
X      integer   what_pid  /-1/
X
X      logical quit,flipped
X               `032
X      record /itmlst/ jpi_list(10)
X      record /iosblk/ iosb
X                 `032
X      jpi_list(1).buflen = 12
X      jpi_list(1).itmcod = jpi$_username
X      jpi_list(1).bufadr = %loc(username)
X      jpi_list(1).retadr = %loc(username_len)
X     `032
X      jpi_list(2).buflen = 7
X      jpi_list(2).itmcod = jpi$_terminal
X      jpi_list(2).bufadr = %loc(terminal)
X      jpi_list(2).retadr = %loc(terminal_len)
X     `032
X      jpi_list(3).end_list = 0
X     `032
X      i = 0    `032
X
X      do j =1,200
X        menu_choices(j) = ' '
X        user(j) = ' '
X      end do
X     `032
X      what_pid = -1
X     `032
X      do while ((status .and. ss$_nomoreproc) .ne. ss$_nomoreproc)
X        status = sys$getjpiw(,what_pid,,jpi_list,iosb,,)
X        if ((status) .and. (length(terminal) .ne. 0)) then
X          i = i + 1
X          user(i) = username(1:username_len)
X          menu_choices(i) = user(i)
X        end if `032
X      end do
X     `032
X      what_pid = 0          !Reset Wildcard operation
X      status = sys$getjpiw(,what_pid,,jpi_list,iosb,,)`032
X     `032
X      number_of_users = i               `032
X
X*********************************************
X*     Bubble sort with duplicate remove     *
X*********************************************     `032
X     `032
X      flipped = .true.
X     `032
X      do while (flipped)
X        flipped = .false.
X        do i = 1,number_of_users-1
X          if (menu_choices(i) .gt. menu_choices(i+1)) then
X            junk = menu_choices(i)
X            menu_choices(i) = menu_choices(i+1)
X            menu_choices(i+1) = junk
X            flipped = .true.
X          else if (menu_choices(i) .eq. menu_choices(i+1) .and.`032
X     &             menu_choices(i) .ne. ' ') then
X            menu_choices(i) = ' '            !Remove duplicate entries
X            flipped = .true.           `032
X          end if
X        end do
X      end do
X
X      i = 0
X           `032
X      do j = 1,number_of_users                !Move valid entries`032
X        if (menu_choices(j) .ne. ' ') then    !on top of erased`032
X          i = i + 1                           !entries.
X          menu_choices(i) = menu_choices(j)
X        end if `032
X      end do `032
X     `032
X      number_of_users = i
X                         `032
X      do j = number_of_users+1,200
X        menu_choices(j) = ' '                 !Erase old junk
X      end do
X     `032
X      menu_choices(number_of_users+1) = 'ALL USERS'
X
X      status = smg$create_virtual_display(20,14,user_menu,smg$m_border,,)
X      status = smg$label_border(user_menu,label,,,smg$m_reverse,,)
X      status = smg$paste_virtual_display(user_menu,pbid,2,26)
X      status = smg$create_menu(user_menu,menu_choices,smg$k_vertical,,,,)
X      status = smg$select_from_menu(kb,user_menu,choice,,,,,terminator,
X     &         user_to_send_to,,)
X
X      if (terminator .eq. smg$k_trm_ctrlz) then
X        quit = .true.
X      else`032
X        call send(user_to_send_to)
X      end if
X     `032
X      status = smg$delete_virtual_display(user_menu)
X     `032
X      end `032
$ GOSUB UNPACK_FILE

$ FILE_IS = "VIEW_MESSAGES.FOR"
$ CHECKSUM_IS = 1392993278
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X      subroutine view_messages
X
X****************************************************************************
X*                                                                          *
X*     This subroutine will display a history of the messages received      *
X*     while the program was running.  Pressing a key will end this         *
X*     display.                                                             *
X*                                                                          *
X*                         Version 1.00    29-May-1992                      *
X*                         Version 1.00    29-May-1992                      *
X*                                                                          *
X****************************************************************************
X     `032
X      implicit none
X     `032
X      include '($smgdef)'
X      include 'smg_common.for'
X     `032
X      integer   terminator
X      integer   status
X     `032
X      character*21  label
X     `032
X      label = 'Press any key to Exit'
X             `032
X      status = smg$label_border(old_messages_id,label,,,smg$m_reverse,,)
X      status = smg$paste_virtual_display(old_messages_id,pbid,3,2)
X      status = smg$read_keystroke(kb,terminator,,,,,)
X      status = smg$unpaste_virtual_display(old_messages_id,pbid)
X     `032
X      return
X     `032
X      end
$ GOSUB UNPACK_FILE

$ FILE_IS = "YES_NO.FOR"
$ CHECKSUM_IS = 1174411814
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X      subroutine yes_no_selection(verify)
X     `032
X      implicit none
X     `032
X      include '($smgdef)'
X      include 'smg_common.for'
X           `032
X      logical verify
X     `032
X      integer   yes_no_menu
X      integer   terminator
X      integer   status`032
X      integer   choice
X     `032
X      character*4   yes_no(2)
X     `032
X      yes_no(1) = 'Yes'
X      yes_no(2) = 'No'
X     `032
X      status = smg$create_virtual_display(2,6,yes_no_menu,smg$m_border,,)
X      status = smg$create_menu(yes_no_menu,yes_no,smg$k_vertical,,,,)
X      status = smg$paste_virtual_display(yes_no_menu,pbid,10,35)
X                 `032
X      status = smg$select_from_menu(kb,yes_no_menu,choice,2,,,,terminator,,,)
X
X      if (terminator .ne. smg$k_trm_cr .and.`032
X     &    terminator .ne. smg$k_trm_lf) then`032
X        verify = .false.
X      else if (choice .eq. 1) then
X        verify = .true.
X      else if (choice .eq. 2) then
X        verify = .false.
X      end if
X                                                               `032
X      status = smg$delete_virtual_display(yes_no_menu)
X     `032
X      end                                               `032
$ GOSUB UNPACK_FILE
$ EXIT
-+-+-+-+-+ End of part 5 +-+-+-+-+-

