Modulinos: Difference between revisions

Content added Content deleted
(Added Sidef)
(→‎{{header|REXX}}: updated the program's boxed comment to reflect that any program utilization the "command interface" can also seem like the program was invoked via the command line (interface).)
Line 1,323: Line 1,323:


=={{header|REXX}}==
=={{header|REXX}}==
<lang rexx>/*REXX program detects whether or not it is a "scripted main" program. */
<lang rexx>/*REXX program detects whether or not it is a "scripted main" program. */
parse source . howInvoked . /*ask REXX how we got invoked.*/
parse source . howInvoked @fn /*query REXX how this pgm got invoked. */
if howInvoked \== "COMMAND" then exit 0 /*if not a COMMAND, just exit.*/


say 'This program ('@fn") was invoked as a: " howInvoked
/* ╔════════════════════════════════════════════════════════════╗
║ At this point, we know that this program was invoked via ║
the "command line" and not via another program.
╚════════════════════════════════════════════════════════════╝ */


if howInvoked\=='COMMAND' then do
say 'and away we go ···'</lang>
say 'This program ('@fn") wasn't invoked via a command."
Note: &nbsp; Actually another program can invoke the above (ma.rex) as a command:
exit 12
<lang rexx>'rexx ma'</lang>
end

/*╔════════════════════════════════════════════════════════════════════════════════╗
║ At this point, we know that this program was invoked via the "command line"
or a program using the "command interface" and not via another program. ║
╚════════════════════════════════════════════════════════════════════════════════╝*/

/*────────────────────────────── The main code follows here ... ────────────────────────*/
say
say '(from' @fn"): and away we go ···"</lang> <br><br>


=={{header|Ring}}==
=={{header|Ring}}==