1 /*****************************************************************************
2 
3 	ExePW()
4 
5 	This function executes a PW command.  Note that this function is
6 called only by ExeP.
7 
8 	nPW	Write buffer n times
9 	m,nPW	Write out chars m to n
10 
11 *****************************************************************************/
12 
13 #include "zport.h"		/* define portability identifiers */
14 #include "tecoc.h"		/* define general identifiers */
15 #include "defext.h"		/* define external global variables */
16 
ExePW()17 DEFAULT ExePW()			/* execute a PW command */
18 {
19 	DBGFEN(1,"ExePW",NULL);
20 
21 	if (CmdMod & MARGIS) {			/* if it's m,nPW */
22 		if (MArgmt != NArgmt) {		/* if m != n */
23 		    if ((*CBfPtr == 'W') || (*CBfPtr == 'w')) {
24 			MEMMOVE(ErrTxt, "m,nPW", 6);
25 		    } else {
26 			MEMMOVE(ErrTxt, "m,nP", 5);
27 		    }
28 		    if (GetAra() == FAILURE) {
29 			DBGFEX(1,DbgFNm,"FAILURE");
30 			return FAILURE;
31 		    }
32 		    if (WrPage(CurOut,AraBeg,AraEnd,0L) == FAILURE) {
33 			DBGFEX(1,DbgFNm,"FAILURE");
34 			return FAILURE;
35 		    }
36 		}
37 	} else {				/* else it's nPW */
38 		while (NArgmt-- > 0)
39 			if (WrPage(CurOut,EBfBeg,EBfEnd,-1L) == FAILURE) {
40 				DBGFEX(1,DbgFNm,"FAILURE");
41 				return FAILURE;
42 			}
43 	}
44 
45 	CmdMod = '\0';				/* clear modifiers flags */
46 	EStTop = EStBot;			/* clear expression stack */
47 
48 	DBGFEX(1,DbgFNm,"SUCCESS");
49 	return SUCCESS;
50 }
51