@@ -34,41 +34,43 @@ end module os
3434
3535program main
3636 ! ! Prints the name of the operating system to stdout, using pre-processor
37- ! ! macros. Compile the source code with parameter `-cpp` ( GNU Fortran) or
38- ! ! `-fpp` (IFORT) and `-D__<OS identifier>__`, for example:
37+ ! ! macros. Pass the parameter `-D__<OS identifier>__` to GNU Fortran, for
38+ ! ! example:
3939 ! !
4040 ! ! ```
41- ! ! $ gfortran -cpp - D__linux__ -o os os.f90
42- ! ! $ gfortran -cpp - D__FreeBSD__ -o os os.f90
43- ! ! $ gfortran -cpp - D__APPLE__ -o os os.f90
44- ! ! $ ifort -fpp - o os os.f90
41+ ! ! $ gfortran -D__linux__ -o os os.F90
42+ ! ! $ gfortran -D__FreeBSD__ -o os os.F90
43+ ! ! $ gfortran -D__APPLE__ -o os os.F90
44+ ! ! $ ifort -o os os.F90
4545 ! ! ```
4646 use :: os
4747 implicit none
4848 integer :: current_os
4949
50- print ' (a) ' , ' Current Operating System'
51- print ' (a) ' , repeat ( ' - ' , 24 )
50+ print ' (" Current Operating System") '
51+ print ' (24("-")) '
5252
5353 current_os = os_type()
5454
55+ write (* , ' ("Name: ")' , advance= ' no' )
56+
5557 select case (current_os)
5658 case (OS_UNKNOWN)
57- print ' ("Name: ", a) ' , ' Unknown OS'
59+ print ' ("Unknown OS") '
5860
5961 case (OS_WINDOWS)
60- print ' ("Name: ", a) ' , ' Microsoft Windows (Cygwin, MSYS2)'
62+ print ' ("Microsoft Windows (Cygwin, MSYS2)" )'
6163
6264 case (OS_MACOS)
63- print ' ("Name: ", a) ' , ' macOS '
65+ print ' ("macOS") '
6466
6567 case (OS_LINUX)
66- print ' ("Name: ", a) ' , ' GNU/Linux'
68+ print ' ("GNU/Linux") '
6769
6870 case (OS_FREEBSD)
69- print ' ("Name: ", a) ' , ' FreeBSD '
71+ print ' ("FreeBSD") '
7072
7173 case default
72- print ' (a) ' , ' Error'
74+ print ' (" Error") '
7375 end select
7476end program main
0 commit comments