APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

lp2status.c for SCO Unix 3.2v4.x

Outdated material; included only for historical reference


January 1993



/* lp2status.c */

#include <fcntl.h>
#include <stdio.h>
#include "lp2status.h"

/* cc -o lp2status lp2status.c -lc */


main(int argc,char **argv)
{
char key=' ';
struct lp2 arg; 

int fild=open("/dev/lp2io",O_WRONLY);
while (key != 'Q')
{

ioctl(fild,MAGIC,&arg);

printf("\n\n\n\n");
if (arg.Lpflags & LPEXIST)
    printf(" LPEXIST");
if (arg.Lpflags & SLEEP)
    printf(" SLEEP");
if (arg.Lpflags & LPBUSY)
    printf(" LPBUSY");
if (arg.Lpflags & WAIT)
    printf(" WAIT");
if (arg.Lpflags & TOPEND)
    printf(" TOPEND");
if (arg.Lpflags & EXCLOPEN)
    printf(" EXCLOPEN");
if (arg.Lpflags & OPEN)
     printf(" OPEN");
printf("\n");

printf("1:Change Debug level %d\n",arg.DeBug);
printf("2:Reset Ccount %d\n",arg.Ccount);
printf("3:Reset Icount %d\n",arg.Icount);
printf("4:Reset spindowns %d\n",arg.spindowns);
printf("5:Reset wsleeps %d\n",arg.wsleeps);
printf("6:Change spinloop %d\n",arg.spinloop);
printf("7:Change Low_water %d\n",arg.Low_water);
printf("8:Change Highwater %d\n",arg.Highwater);
printf("9:Change Wait_int %d\n",arg.Wait_int);

printf("Q to exit or number to be changed ");

scanf(" %1c",&key);
key &= 0xff;
if (key == 'Q' || key == 'q')
  break;
if (key < '1' || key > '9')
 continue;
switch (key)
 {
 case '1': printf("\nNew DeBug level %d ",arg.DeBug);
         scanf("%1d",&(arg.DeBug));
         break;
 case '2': arg.Ccount=0;
         break;
 case '3': arg.Icount=0;
         break;
 case '4': arg.spindowns=0;
         break;
 case '5': arg.wsleeps=0;
         break;
 case '6': printf("\nNew spinloop level %d ",arg.spinloop);
         scanf("%3d",&(arg.spinloop));
         break;
 case '7': printf("\nNew Low_water level %d ",arg.Low_water);
         scanf("%3d",&(arg.Low_water));
         break;
 case '8': printf("\nNew Highwater level %d ",arg.Highwater);
         scanf("%3d",&(arg.Highwater));
         break;
 case '9': printf("\nNew Wait_int level %d ",arg.Wait_int);
         scanf("%3d",&(arg.Wait_int));
         break;
 }

ioctl(fild,1+MAGIC,&arg);


}
close(fild);
}


int Wait_int;
};





Got something to add? Send me email.





(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> -> Unix Programs: LP Driver ioctl program

2 comments



Increase ad revenue 50-250% with Ezoic


More Articles by

Find me on Google+

© Tony Lawrence







Wed May 26 06:52:19 2010: 8639   komachi

gravatar


does it works?





Wed May 26 10:10:11 2010: 8640   TonyLawrence

gravatar


Not on any current operating system as it stands, though much of it would with a little work.

This was written for a Unix OS of twenty years back. I doubt anyone still has this running - for that matter, how many parallel ports do you see today?

------------------------
Kerio Samepage


Have you tried Searching this site?

Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us