[comp.os.minix] Fix to printer.c

ast@cs.vu.nl (Andy Tanenbaum) (12/09/88)

There have been lots of reports about printers not working, giving printer
busy or out of paper and refusing to work.  A few weeks ago, somebody (I forget
who, sorry) posted a message saying these were caused by using the wrong 
printer port.  I have now changed printer.c to make a dynamic test to discover
the printer port.  The fix below to printer.c should end this problem forever.
If it doesn't, let me know.

Andy Tanenbaum (ast@cs.vu.nl)

*** printer.old	Thu Dec  8 21:18:44 1988
--- printer.c	Thu Dec  8 21:56:54 1988
***************
*** 221,230 ****
  {
  /* Color display uses 0x378 for printer; mono display uses 0x3BC. */
  
!   int i;
!   extern int color;
! 
!   port_base = (color ? PR_COLOR_BASE : PR_MONO_BASE);
    pr_busy = FALSE;
    port_out(port_base + 2, INIT_PRINTER);
    for (i = 0; i < DELAY_COUNT; i++) ;	/* delay loop */
--- 221,233 ----
  {
  /* Color display uses 0x378 for printer; mono display uses 0x3BC. */
  
!   int i = 0, testval = 0xAA;
!   extern int color;
! 
!   /* See if PR_COLOR_BASE installed by writing to it and reading it back. */
!   port_out(PR_COLOR_BASE, testval);	/* output random bit pattern */
!   port_in(PR_COLOR_BASE, &i);		/* read it back */
!   port_base = (i == testval ? PR_COLOR_BASE : PR_MONO_BASE);
    pr_busy = FALSE;
    port_out(port_base + 2, INIT_PRINTER);
    for (i = 0; i < DELAY_COUNT; i++) ;	/* delay loop */
***************
*** 233,239 ****
  
  
  /*===========================================================================*
!  *				pr_char				     *
   *===========================================================================*/
  PUBLIC pr_char()
  {
--- 236,242 ----
  
  
  /*===========================================================================*
!  *				pr_char					     *
   *===========================================================================*/
  PUBLIC pr_char()
  {

dtynan@sultra.UUCP (Der Tynan) (12/13/88)

In article <1785@ast.cs.vu.nl>, ast@cs.vu.nl (Andy Tanenbaum) writes:
> There have been lots of reports about printers not working, giving printer
> busy or out of paper and refusing to work.  A few weeks ago, somebody (I forget
> who, sorry) posted a message saying these were caused by using the wrong 
> printer port.  I have now changed printer.c to make a dynamic test to discover
> the printer port.  The fix below to printer.c should end this problem forever.
> If it doesn't, let me know.
> 
> Andy Tanenbaum (ast@cs.vu.nl)

I can't vouch for the person who said that it was caused by the wrong port,
but that's not the problem I have.  Basically, the printer skips characters.
On the average, about five per page.  It doesn't do this under Messy-DOS.
Way back in the old days, when I was running version 1.2, I installed Barry
McMullens' revised version which fixed the problem.  However, since I went
to 1.3c, I haven't changed his driver to work with the new locking yet.  I
have heard of other people with this problem.  It seems the common-denominator
is a slow printer.  At any rate, it is not a function of the port number.

BTW; could a V7-guru please let me know if the following is an un-problem.  I
noticed that if I set the protection of an executable to 511, then no-one but
the owner can execute it.  This is not the case with System V.  Is this a bug
or a feature?  If it's a bug, I'll post the diffs to fix it as soon as I *do*
actually fix it.
						- Der
-- 
	dtynan@zorba.Tynan.COM  (Dermot Tynan @ Tynan Computers)
	{apple,mips,pyramid,uunet}!Tynan.COM!dtynan

 ---  If the Law is for the People, then why do we need Lawyers? ---

henry@utzoo.uucp (Henry Spencer) (12/15/88)

In article <2718@sultra.UUCP> dtynan@sultra.UUCP (Der Tynan) writes:
>BTW; could a V7-guru please let me know if the following is an un-problem.  I
>noticed that if I set the protection of an executable to 511, then no-one but
>the owner can execute it.  This is not the case with System V.  Is this a bug
>or a feature? ...

If it's a real executable, as opposed to a shell file or the equivalent,
then a 511 file ought to be executable to everybody.
-- 
SunOSish, adj:  requiring      |     Henry Spencer at U of Toronto Zoology
32-bit bug numbers.            | uunet!attcan!utzoo!henry henry@zoo.toronto.edu

tif@cpe.UUCP (12/15/88)

Written  5:17 pm  Dec 12, 1988 by sultra.UUCP!dtynan in cpe:comp.os.minix
>I noticed that if I set the protection of an executable to 511, then no-one but
>the owner can execute it.  This is not the case with System V.  Is this a bug
>or a feature?

The behavior you describe would be correct for shell scripts, incorrect for
a real executable.

			Paul Chamberlain
			Computer Product Engineering, Tandy Corp.
			bellcore!motown!sys1!cpe!tif