Thread View: comp.lang.fortran
4 messages
4 total messages
Started by Peter Kocks
Mon, 25 Jan 1993 21:40
How to get command line arguments from unix with FORTRAN?
Author: Peter Kocks
Date: Mon, 25 Jan 1993 21:40
Date: Mon, 25 Jan 1993 21:40
13 lines
683 bytes
683 bytes
Subject says all.
Can someone tell me how to read the command line arguments of
a unix command line from with FORTRAN. Something presumably similar
to the c
main(int argc, char **argv){
}
Thanks
Peter Kocks
kocks@chemistry.stanford.edu
Re: How to get command line arguments from unix with FORTRAN?
Author: Patrick L. Nolan
Date: Mon, 25 Jan 1993 22:24
Date: Mon, 25 Jan 1993 22:24
40 lines
1695 bytes
1695 bytes
Peter Kocks (kocks@leland.Stanford.EDU) wrote:
:
: Subject says all.
:
: Can someone tell me how to read the command line arguments of
: a unix command line from with FORTRAN. Something presumably similar
: to the c
:
: main(int argc, char **argv){
: }
:
It probably varies with the flavor of unix. On a Sun, you have:
GETARG(3F) FORTRAN LIBRARY ROUTINES GETARG(3F)
NAME
getarg, iargc - get the kth command line argument
SYNOPSIS
subroutine getarg ( k, arg )
character*(*) arg
function iargc ()
DESCRIPTION
The statement call getarg( k , arg ) will get the kth
command-line argument and put it into arg .
The 0th argument is the command name.
The function iargc returns the index of the last command-
line argument,
and therefore the number of arguments after the command
name.
--
* Patrick L. Nolan (415)723-0133 *
* W. W. Hansen Experimental Physics Laboratory (HEPL) *
* Stanford University *
* Bitnet: PLN@SLACVM Internet: pln@egret0.stanford.edu *
Re: How to get command line arguments from unix with FORTRAN?
Author: Pat Murphy
Date: Tue, 26 Jan 1993 17:18
Date: Tue, 26 Jan 1993 17:18
33 lines
2093 bytes
2093 bytes
"PLN" == Patrick L. Nolan <pln@egret0.Stanford.EDU> writes:
PLN> Peter Kocks (kocks@leland.Stanford.EDU) wrote:
PLN> : Can someone tell me how to read the command line arguments of
PLN> : a unix command line from with FORTRAN. Something presumably similar
PLN> : to the c
PLN> :
PLN> : main(int argc, char **argv){
PLN> : }
PLN> :
PLN> It probably varies with the flavor of unix. On a Sun, you have:
PLN> subroutine getarg ( k, arg )
PLN> character*(*) arg
PLN>
PLN> function iargc ()
A brief experiment with telnet shows that his posting machine is not a
Sun: "ULTRIX V4.2A (Rev. 47)". My f77 info for Ultrix (4.0),
fortunately shows getarg identical to the above. However I know that
for other flavors of unix it is different. For example, HP-UX uses a
function IGETARG with three arguments.
- Pat
--
==========================================================================
| Patrick P. Murphy, Ph.D. Scientific Programming Analyst |
| National Radio Astronomy Observatory Net: pmurphy@nrao.edu |
| 520 Edgemont Road Phone: (804) 296-0372 |
| Charlottesville, VA 22903-2475 VoiceMail: (804) 980-5889 |
| "I don't believe in the no-win scenario" --- James T. Kirk |
==========================================================================
Re: How to get command line arguments from unix with FORTRAN?
Author: Richard M. Venable
Date: Wed, 27 Jan 1993 01:03
Date: Wed, 27 Jan 1993 01:03
23 lines
1710 bytes
1710 bytes
In article <PMURPHY.93Jan26121847@orangutan.cv.nrao.edu>, pmurphy@nrao.edu (Pat Murphy) writes: |> A brief experiment with telnet shows that his posting machine is not a |> Sun: "ULTRIX V4.2A (Rev. 47)". My f77 info for Ultrix (4.0), |> fortunately shows getarg identical to the above. However I know that |> for other flavors of unix it is different. For example, HP-UX uses a |> function IGETARG with three arguments. Ah, but you can still use GETARG under HP-UX; it's just that IGETARG provides info on the length of the string returned, while GETARG does not. Also, a compiler directive is required to use GETARG. However, I think HP's biggest sin here is that CALL GETARG(1,string) returns the program name, where most other implementations consider that to be argument 0 (zero) and not 1 (one). ----------------------------------------------------------------- Rick Venable | "Eschew FDA/CBER Biophysics Lab | Obfuscation" rvenable@helix.nih.gov | -- the Phantom Nerd -----------------------------------------------------------------
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads