[comp.os.minix] Bug fix to term.c

TEMARI%ECAMV1.dnet.ge.com@vm1.nodak.edu (10/05/90)

Here is a bug fix to term.c

What the problem was is that if an error occured after the setting of stdin
it would not get reset back.

crc before: 05401    8017
crc after:  45036    8258


Michael Temari                                      temari@ecamv1.dnet.ge.com
-----------------------------------------------------------------------------
19a20,22
>  * 04 Oct 90 MAT (Michael A. Temari): Fixed bug where terminal isn't reset
>  * if an error occurs.
>  *
130c133
< 			error("Too many communication devices", "");
---
> 			error("Too many communication devices", "",0);
138,140c141,143
<   if (argc > i) error("Usage: term [baudrate] [data_bits] [parity]", "");
<   commfd = open(commdev, O_RDWR);
<   if (commfd < 0) error("Can't open ", commdev);
---
>   if (argc > i) error("Usage: term [baudrate] [data_bits] [parity]", "",0);
>   commfd = open(commdev, O_RDWR);
>   if (commfd < 0) error("Can't open ", commdev,0);
145,147c148,152
<   set_mode(0, -1, -1, -1, &sgstdin);	/* RAW mode on stdin, others
< 					 * current */
<   set_uart(argc, argv);
---
>
>   set_uart(argc, argv);
>
>   set_mode(0, -1, -1, -1, &sgstdin);	/* RAW mode on stdin, others
> 					 * current */
152,155c157,160
<   if (pipe(pipefd) < 0) error("Can't create pipe", "");
<   switch ((writepid = fork())) {
<       case -1:
< 	error("Can't create process to write to comm device", "");
---
>   if (pipe(pipefd) < 0) error("Can't create pipe", "",1);
>   switch ((writepid = fork())) {
>       case -1:
> 	error("Can't create process to write to comm device", "",1);
159c164
< 	copy(pipefd[0], "piped stdin", commfd, commdev, "");
---
> 	copy(pipefd[0], "piped stdin", commfd, commdev, "",1);
164c169
< 	error("Can't create process to read from comm device", "");
---
> 	error("Can't create process to read from comm device", "",1);
197,200c202,205
< 		error("Invalid parameter: ", arg);
< 	    case BITS:
< 		bits = param->value;
< 		if (++nbits > 1) error("Too many character sizes", "");
---
> 		error("Invalid parameter: ", arg,0);
> 	    case BITS:
> 		bits = param->value;
> 		if (++nbits > 1) error("Too many character sizes", "",0);
204c209
< 		if (++nparities > 1) error("Too many parities", "");
---
> 		if (++nparities > 1) error("Too many parities", "",0);
208,209c213,214
< 		if (speed == 0) error("Invalid speed: ", arg);
< 		if (++nspeeds > 1) error("Too many speeds", "");
---
> 		if (speed == 0) error("Invalid speed: ", arg,0);
> 		if (++nspeeds > 1) error("Too many speeds", "",0);
282,285c287,295
< error(s1, s2)
< char *s1;
< char *s2;
< {
---
> error(s1, s2, reset)
> char *s1;
> char *s2;
> int   reset;
> {
>   if(reset) {
>      ioctl(commfd, TIOCSETP, &sgcommfd);
>      ioctl(0, TIOCSETP, &sgstdin);
>   }