Octopus
help.F90
Go to the documentation of this file.
1!! Copyright (C) 2007 Xavier Andrade
2!!
3!! This program is free software; you can redistribute it and/or modify
4!! it under the terms of the GNU General Public License as published by
5!! the Free Software Foundation; either version 2, or (at your option)
6!! any later version.
7!!
8!! This program is distributed in the hope that it will be useful,
9!! but WITHOUT ANY WARRANTY; without even the implied warranty of
10!! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11!! GNU General Public License for more details.
12!!
13!! You should have received a copy of the GNU General Public License
14!! along with this program; if not, write to the Free Software
15!! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16!! 02110-1301, USA.
17!!
18
19#include "global.h"
20
21program oct_help
23 use global_oct_m
24 use iso_c_binding
25 use string_oct_m
27
28 implicit none
29
30 integer :: ierr
31 character(len=32) :: mode
32 character(len=100) :: varname
33 character(kind=c_char) :: cmode(33), cvarname(101)
34
35 integer, parameter :: help_stdout = 6, help_stderr = 0
36
38
39 call getopt_init(ierr)
40 if (ierr /= 0) then
41 write(stderr, '(a)') "Your Fortran compiler doesn't support command-line arguments;"
42 write(stderr, '(a)') "the oct-help command is not available."
43 stop
44 end if
45
46 cmode = c_null_char
47 cvarname = c_null_char
48 call getopt_help(cmode, cvarname)
49 call string_c_to_f(cmode, mode)
50 call string_c_to_f(cvarname, varname)
51 call getopt_end()
52
53 select case (mode)
54 case ("print")
55 call varinfo_print(help_stdout, trim(varname), ierr)
56 if (ierr /= 0) then
57 write(help_stderr, '(a)') "Error: Variable "//trim(varname)//" not found."
58 end if
59
60 case ("search")
61 call varinfo_search(help_stdout, trim(varname), ierr)
62
63 case ("list")
64 call varinfo_search(help_stdout, "", ierr)
65 end select
66
67 call global_end()
68
69end program oct_help
70
71!! Local Variables:
72!! mode: f90
73!! coding: utf-8
74!! End:
program oct_help
Definition: help.F90:116
subroutine, public getopt_init(ierr)
Initializes the getopt machinery. Must be called before attempting to parse the options....
subroutine, public getopt_end
subroutine, public global_end()
Finalise parser varinfo file, and MPI.
Definition: global.F90:421
type(mpi_comm), parameter, public serial_dummy_comm
Alias MPI_COMM_UNDEFINED for the specific use case of initialising Octopus utilities with no MPI supp...
Definition: global.F90:280
subroutine, public init_octopus_globals(comm)
Initialise Octopus-specific global constants and files. This routine performs no initialisation calls...
Definition: global.F90:390
subroutine, public string_c_to_f(c_string, f_string)
convert a C string to a Fortran string
Definition: string.F90:292
subroutine, public varinfo_print(iunit, var, ierr)
Definition: varinfo.F90:207
subroutine, public varinfo_search(iunit, var, ierr)
Definition: varinfo.F90:369