# echo - test program to echo command line passed by XEQ, MCR, or TERMINAL define(MCR,-2) define(MESSAGE,-1) define(TERMINAL,0) program echo byte buf(80) integer source, len, i repeat { # This loop is executed once when the command # line is from XEQ or MCR, and until a or # ^Z is received when the command lines are from # the terminal. call gcmd(5, 'ECHO> ', buf, len, 80, source) # The lun, 5 in this case, # need not be open, but # must be assigned to TI: if (len > 0) switch (source) { case MCR: write(5, (' Source was MCR: '80a1)) (buf(i), i=1, len) case MESSAGE: write(5, (' Source was XEQ: '80a1)) (buf(i), i=1, len) case TERMINAL: write(5, (' Source was TERMINAL: '80a1))_ (buf(i), i=1, len) default: write(5, (' Can''t happen!!!')) } } until (len <= 0 | source != TERMINAL) end