1 /*****************************************************************************
2 
3 	FindES()
4 
5 	This function finds the end of the text argument to a command.
6 If the command is at-sign (@) modified,  the text argument may be delimited
7 by a special character.
8 	On entry,  CBfPtr points at the beginning of the text argument.
9 TrmChr contains the "usual" termination character for the command.  If the
10 ATSIGN bit of CmdMod is set,  it means the command is at-sign modified.
11 In that case the first character of the text argument (pointed to by CBfPtr)
12 is the delimiter character.
13 	On return,  ArgPtr points to the beginning of the true text argument
14 and CBfPtr points to the termination character.
15 
16 *****************************************************************************/
17 
18 #include "zport.h"		/* define portability identifiers */
19 #include "tecoc.h"		/* define general identifiers */
20 #include "defext.h"		/* define external global variables */
21 #include "deferr.h"		/* define identifiers for error messages */
22 
FindES(TrmChr)23 DEFAULT FindES(TrmChr)		/* find end of text argument */
24 unsigned char TrmChr;		/* termination char if no @ modifier */
25 {
26 #if DEBUGGING
27     static char *DbgFNm = "FindES";
28     sprintf(DbgSBf,", string is %sat-sign modified",
29 	(CmdMod & ATSIGN) ? "" : "not ");
30     DbgFEn(3,DbgFNm,DbgSBf);
31 #endif
32 
33     if (IncCBP() == FAILURE) {		/* point to 1st char of text */
34 	DBGFEX(3,DbgFNm,"FAILURE, IncCBP() failed");
35 	return FAILURE;
36     }
37 
38     if (CmdMod & ATSIGN) {		/* if it's @-modified */
39 	TrmChr = *CBfPtr;
40 	if (IncCBP() == FAILURE) {
41 	    DBGFEX(3,DbgFNm,"FAILURE, IncCBP() failed");
42 	    return FAILURE;
43 	}
44     }
45 
46     ArgPtr = CBfPtr;
47     while (*CBfPtr != TrmChr) {
48 	if (IncCBP() == FAILURE) {
49 	    DBGFEX(3,DbgFNm,"FAILURE");
50 	    return FAILURE;
51 	}
52     }
53 
54     DBGFEX(3,DbgFNm,"SUCCESS");
55     return SUCCESS;
56 }
57