CompuServe Messages

#using DevPac

    26-Sep-95 15:16:25
Sb: #48307-#using DevPac
Fm: Jim Butterfield 73624,14
To: Phillip Wooller 100024,2227
The command tail is indeed pointed to by A0, with D0 containing the number of bytes it has. This is not your raw command tail, since redirection information will have been removed. The value in D0 includes the trailing NewLine character; as far as I know, that character is always in place. A number of programs start with MOVE #0,-1(A0,D0) .. which stuffs a binary zero over top of the NewLine. As a general rule, it's better not to mess with anything that the system gives you .. copy it and mess with the copy; but the technique seems to work just fine. If a program has been launched by anything other than CLI/Shell, it had better be ready to detect this, since there won't be a command tail to look at. Instead, a message will be coming – perhaps from the Workbench, perhaps from a parent process – and there needs to be a whole mess of code in place to catch incoming message(s) and reply at the appropriate time. The whole business of detecting whether or not you're called from CLI/Shell or not is done with a call to FindTask() [to have the task find "itself"] and then examining the pr_CLI item within the task structure; if it's non-zero, you have a CLI and can use this B-pointer to find the program name as typed by the CLI user (if you care). By this time, the original A0 and D0 values will be long gone, so you'd better have saved them somewhere. An oddity: some debuggers (such as MetaScope) do not give you the same command tail that you'd get with a direct CLI program call. In the case of MetaScope, the difference is that the tail contains a leading space (so is one byte longer). –Jim