[UP]


Manual Reference Pages  - sgets (3)

NAME

sgets(3f) - [ARGUMENTS:M_kracken] given keyword fetch string value parsed on whitespace into an array (LICENSE:PD)

CONTENTS

Synopsis
Description
Options
Returns
Example
See Also
Author
License

SYNOPSIS

function sgets(name,delim) result(strings)

   character(len=*),intent(in) :: name
   character(len=*),intent(in),optional :: delim
   character(len=:),allocatable :: strings(:)

DESCRIPTION

The sgets(3f) function returns a dynamically allocated array of character values from a string that is the value for a command line option. It is part of the M_kracken(3fm) module.

OPTIONS

name the dictionary keyword (in form VERB_KEYWORD) to retrieve. The VERB name comes from the first argument of the KRACKEN(3f) or DISSECT(3f) call. The KEYWORD is a keyword from the second argument to the KRACKEN(3f) or DISSECT(3f) call. This routine trusts that the desired name exists. If the name does not exist the array [char(0)] is returned. An array of zero size is returned if the string is blank.
delim characters to split the string at into elements

RETURNS

strings
  returned string array

EXAMPLE

Sample program:

   program demo_sgets
   use M_kracken, only : kracken, sgets
   character(len=:),allocatable :: strings(:)
      call kracken(’cmd’,’ -string    This   is  a sentence ’)
      strings= sgets("cmd_string")            ! get -strings words
      print *, "string=",(’[’//trim(strings(i))//’]’,i=1,size(strings))
      print *, "len= ",len(strings)
      print *, "size=",size(strings)
   end program demo_sgets

Example program execution:

   $ demo_sgets
    string=[This][is][a][sentence]
    len=            8
    size=           4

$ demo_sgets -string a b c d e f g string=[a][b][c][d][e][f][g] len= 1 size= 7

SEE ALSO

M_kracken(3f),
  kracken(3f)
dget(3f), dgets(3f), iget(3f), igets(3f), lget(3f), lgets(3f), rget(3f), rgets(3f), sget(3f), retrev(3f)

parse(3f), dissect(3f), store(3f), setprompts(3f), show(3f)

AUTHOR

John S. Urban

LICENSE

Public Domain


sgets (3) March 11, 2021
Generated by manServer 1.08 from 7e521772-1b89-44bf-bd13-d64c3478cb50 using man macros.