home *** CD-ROM | disk | FTP | other *** search
- /*
- ** prbufs.c
- ** contains: PrBufS()
- */
-
- #include <stdio.h>
- #include "gf.h"
- #include "parint.h"
-
-
- /*
- ** unsigned short
- ** PrBufS(PARINT *p,int option,char *string)
- **
- ** ARGUMENT(s)
- ** p - points to PARINT structure.
- ** option - 1==send CR/LF sequence to printer after
- ** string.
- ** 0==send nothing after string.
- ** string - points to NULL terminated string to transmit.
- **
- ** DESCRIPTION
- ** Transfers a string to the printer buffer. Will optionally add a
- ** CR/LF sequence to the end of the string. If there is not enough
- ** room in the buffer to hold all characters in string this function
- ** will return. Look at the return code to determine how many characters
- ** were actually put in the buffer.
- **
- ** RETURNS
- ** Number of characters sent to the printer buffer.
- **
- ** AUTHOR
- ** "" Fri 18-Nov-1988 11:34:33
- ** Copyright (C)1988-1990 Greenleaf Software Inc. All Rights Reserved.
- **
- ** MODIFICATIONS
- **
- */
-
- unsigned GF_CONV PrBufS(p,option,string)
- PARINT *p;
- int option;
- char *string;
- {
- unsigned returnvalue=0;
-
- while(*string&&!p->StatusBits.bufferfull){
- PrBufC(p,*string++);
- returnvalue++;
- }
- if(*string)
- return(returnvalue);
- if(option) {
- if(!PrBufC(p,'\x0d')) {
- ++returnvalue;
- if(!PrBufC(p,'\x0a'))
- ++returnvalue;
- }
- }
- return(returnvalue);
- }
-