blob: 8e583f55d6b429a238d191a2002d409c25539ef3 (
plain)
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
|
module fmtmsg_mod
implicit none
contains
subroutine fmtmsg(msg, iz)
implicit none
!--------------------------------------------------------------------
! Arguments
!--------------------------------------------------------------------
character(len=22), intent(inout) :: msg
integer, intent(out) :: iz
!--------------------------------------------------------------------
! Locals
!--------------------------------------------------------------------
integer :: i, iter, ib2
!--------------------------------------------------------------------
! Convert all letters to upper case and track last nonblank
!--------------------------------------------------------------------
iz = 22
do i = 1, 22
if (msg(i:i) >= 'a' .and. msg(i:i) <= 'z') then
msg(i:i) = char(ichar(msg(i:i)) + ichar('A') - ichar('a'))
end if
if (msg(i:i) /= ' ') iz = i
end do
!--------------------------------------------------------------------
! Collapse multiple blanks into one (up to 5 passes)
!--------------------------------------------------------------------
do iter = 1, 5
ib2 = index(msg(1:iz), ' ')
if (ib2 < 1) exit
msg = msg(1:ib2) // msg(ib2+2:)
iz = iz - 1
end do
end subroutine fmtmsg
end module fmtmsg_mod
|