Hmm? How does command line processing work under TOPS-20?
If you type:

@ FINGER MIM::

would the finger program be started, and it would do a read from the terminal to read a line, and it would actually get the command line "FINGER MIM::", or actually, would it get "MIM::" in that case? Because that is how it would need to be in order to work the same if it came via DECnet.

Not quite, the answer is that it fools itself into not reading from the terminal in certain cases.

If you are a 'new' style program, then the program that calls you (in this case the EXEC, the Tops-20 command scanner) scans the line and puts the stuff into something that PRARG% can handle.  Think of it as something like argc, argv in Unix except not quite.

If you are an 'old' style program, the EXEC may or may not do a certain amount of pre-processing and stuff the result into the rescan buffer.  A program will use RSCAN% to see if there is anything in the rescan buffer and, if so change primary input to the rescan buffer. 

The EXEC does not do host name or node name recognition in Finger's case, it just scans a field with a particular break mask and stuffs the whole thing into the rescan buffer.  Again, the point here is that doing a RSCAN% causes regular terminal I/O to read from the rescan buffer and not from the terminal.  The program can not tell a rescan is happening once it is in progress.

Regarding network transport, Finger is the personal name portion of the Tops-20 mail system, so it has the HSTNAM module for very powerful network parsing.

Finger reads everything up to an @ or end of line.  If it hits end of line with no @, then this is a local command and it reads from system tables.  If it does hit an @, then network parsing happens, which (I seem to remember) can include specification of transport protocol.  Tops-20 will do IP, DECnet, Chaos, Pup and something else that I don't remember.  HSTNAM will default to a particular order for transport unless it is specifically overridden.

The connection is made on the selected or defaulted transport and everything after "finger " but before the @ is stuffed over the link and the output read until the link is disconnected.

On a default PANDA system, it tries the Internet first, the DNS (CHIVES) taking precedence over the HOSTS.TXT file, and then DECnet.  On my systems ('PANDA II'), it tries DECnet first, then Internet, with HOSTS.TXT taking precedence over DNS (MRC and I never agreed about this).  To make all of this concrete, let's suppose you have a host named MIM:: which has a HECnet address of [1.13] and a Internet name of MIM.Stupi.NET.

DECNET:

    FINGER>@mim
    [Fork FINGER opening DCN:MIM-117 for reading, writing]
    RSX-11M-PLUS system MIM. Sun Jul 21 01:03:07 2024. Up: 3 days, 1:44.

    Luser         Real name         Term    Idle  Logged in     From
    BILLQUIST     Johnny Billquist  TT10:      1  19 Jul 14:56  c-5eeaac7c-74736162


INTERNET

    FINGER>@mim.stupi.net
    [Fork FINGER opening TCP:.30033145112-79;PERSIST:30;CONNECTION:ACTIVE for reading, writing]
    RSX-11M-PLUS system MIM. Sun Jul 21 01:02:50 2024. Up: 3 days, 1:43.

    Luser         Real name         Term    Idle  Logged in     From
    BILLQUIST     Johnny Billquist  TT10:      1  19 Jul 14:56  c-5eeaac7c-74736162

I can't remember how (or if) you could force a transport override.  There was some magic character, which I thought was #, but that's how you specify a numeric IP network address.  Tops-20 DECnet will not accept numeric addresses in place of host names.

The Internet finger server listens for a TCP: connection on port 117 and, when it gets something, it reads the input and stuffs that into the rescan buffer of a finger subfork and starts the first.  It's fairly minimal.  There was a DECnet finger server, but those sources may be lost.  At least, I don't remember seeing them.  It would be fairly straightforward to rewrite it, it's just not high on my priority list right now.