ENTRY - entry to your program from B setup.

Description:

When your program is started by the operating system, B run-time initialization is done before control is passed to your code. This includes setting up fault vectors, disabling overflow faults, and establishing the size of the "memory hole" (used to contain your program and possible overlays). B setup also calls the function .BSET, which obtains the command line if there is one, then breaks it up and arranges it in a way your program will find convenient to process. MAIN is then entered by the call

main( argc, argv )

where "argc" is the number of substrings found in the command line and "argv" is a vector of pointers to those substrings. "argv[argc]" is always set to -1 to denote the end of the substrings. Both "argv" and "argc" are obtained from the status returned by .BSET.

Substrings in the command line are separated by blanks or tabs. A string enclosed by quotes may contain blanks or tabs, but it is considered to be a single substring. In this case, .BSET strips away the surrounding single or double quotes. Suppose you have the following command line:

comm s /file1 "quoted string" >outfile

Then "argc" and "argv" would be set up as follows:

argc    = 4
argv[0] = "comm"
argv[1] = "s"
argv[2] = "/file1"
argv[3] = "quoted string"
argv[4] = -1

The contents of any remaining elements of "argv" are undefined. Note that ">outfile" does not normally appear in the "argv" vector; it is stripped by .BSET and used for redirection of I/O. If there is no command line, "argc" will be set to zero.

This discussion has outlined only the default action of .BSET. The .BSET function has other features, including the ability to scan command lines more completely in accordance with a table specified by the user. For full details, see "expl b lib .bset".

Copyright © 1996, Thinkage Ltd.