aboutsummaryrefslogtreecommitdiff
path: root/prtdrtst.c
blob: 52de3afb7da081b1d940c9523cdebb82e8722fb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/***********************************************************************
*
*	Name:  prtdrtst
*
*	Purpose:   Test program for prtdrive
*
*	Algorithm: Tests prt_open, prt_write, and prt_close of prtdrive
*
**************************************************************************/

#include <stdio.h>
#include <dos.h>;

int main()
{
    int e_flag;
    int tmp;
    int rc;
    char buffer[100];
    int length;
    extern int prt_write(char far *buff,int far *len);

    /* open printer */
    rc = 1;
    rc = prt_open(&e_flag);
    if ( rc != 0) {
	printf("\nrc(open) = %d",rc);
	exit();
    }

    /* prepare test string */
    strcpy(buffer,"This is a test of the printer driver ... 1234567890 ...........\015\012");
    length = 65;

    /* print test string 25 times */
    for (tmp = 1; tmp < 26; tmp++) {
	e_flag = 0;
	rc = prt_write(buffer,&length);
	if (rc != 0) {
	   printf("\nrc(write) = %d",rc);
	}

	/* loop until printer done */
	while (e_flag == 0)
	    printf("waiting  %d\n",tmp);
    }



    e_flag = 0;
    length = 29;
	rc = prt_write("End of Printer Driver Test\015\012\n",&length);
	if (rc != 0) {
	printf("\nrc(write) = %d",rc);
	}

	/* loop until printer done */
	while (e_flag == 0)
	printf("Waiting for Printer test to finish\n");

	prt_close();
	return 0;
}

int IO_complete(int device, int *stkptr)
{
	return 0;
}