[UP]


Manual Reference Pages  - system_realpath (3)

NAME

system_realpath(3f) - [M_system] call realpath(3c) to resolve a pathname (LICENSE:PD)

CONTENTS

Synopsis
Description
Options
Return Value
Example

SYNOPSIS

function system_realpath(input) result(output)

character(len=*),intent(in) :: input character(len=:),allocatable :: output

DESCRIPTION

system_realpath(3f) calls the C routine realpath(3c) to obtain the absolute pathname of given path

OPTIONS

INPUT pathname to resolve

RETURN VALUE

OUTPUT The absolute pathname of the given input pathname. The pathname shall contain no components that are dot or dot-dot, or are symbolic links. It is equal to the NULL character if an error occurred.

EXAMPLE

Sample program:

   program demo_system_realpath
   use M_system, only : system_realpath, system_perror
   implicit none
   ! resolve each pathname given on command line
   character(len=:),allocatable :: pathi,patho
   integer                      :: i
   integer                      :: filename_length
      do i = 1, command_argument_count()
         ! get pathname from command line arguments
         call get_command_argument (i , length=filename_length)
         allocate(character(len=filename_length) :: pathi)
         call get_command_argument (i , value=pathi)
         !
         ! resolve each pathname
         patho=system_realpath(pathi)
         if(patho.ne.char(0))then
            write(*,*)trim(pathi),’=>’,trim(patho)
         else
            call system_perror(’*system_realpath* error for pathname ’//trim(pathi)//’:’)
            write(*,*)trim(pathi),’=>’,trim(patho)
         endif
         deallocate(pathi)
      enddo
      ! if there were no pathnames given resolve the pathname "."
      if(i.eq.1)then
         patho=system_realpath(’.’)
         write(*,*)’.=>’,trim(patho)
      endif
   end program demo_system_realpath

Example usage:

  demo_system_realpath
  .=>/home/urbanjs/V600

cd /usr/share/man demo_system_realpath . .. NotThere .=>/usr/share/man ..=>/usr/share *system_realpath* error for pathname NotThere:: No such file or directory NotThere=>NotThere


system_realpath (3) July 05, 2020
Generated by manServer 1.08 from 3f39492e-0932-455f-9fdf-4ed39c550714 using man macros.