cstringfortranirafspplang

How to refer to string content when using ls


I'm working with IRAF, based on SPP, kind of a mix between Fortran and C. I'm looking for a way of referring to a string content when using ls. For example, I can type ls *hola* if I want to list every file containing the word hola in my directory. Supose I have an string called id whose content is the world hola. How could I refer to the content in id? I'm looking for some sort of ls id (I know that construction won't work) which returns the same result as in ls *hola*.

Thank you in advance.

EDIT: SPP is somehow hidden on the Internet but here you have a reference manual https://www.mn.uio.no/astro/english/services/it/help/visualization/iraf/SPPManual.pdf although I haven't found any information there related to this topic.


Solution

  • First, I would recommend not to use SPP (and IRAF) at all. IRAF is out of official maintainance now, and writing new code for a deprecated software is probably a dead end.

    Concerning your question: SPP comes with a function fntopnb() for IRAF style access to filename templates. They are documented at pages 101ff. of the SPP manual. A usage example can be found in the sources of pkg/system/files.x of IRAF:

    call salloc (fname, SZ_FNAME, TY_CHAR)
    
    list = fntopnb ("*id*", NO)
    while (fntgfnb (list, Memc[fname], SZ_FNAME) != EOF) {
        call printf ("%s\n")
        call pargstr (Memc[fname])
    }
    
    call fntclsb (list)