/* 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;
};
Enter your email address for automatic notification of new posts here
(be sure to whitelist 'feedburner.com' if you use spam filtering)
| Views for this page | ||||
|---|---|---|---|---|
| Today | This Week | This Month | This Year | Overall |
| 3 | 6 | 3 | 758 | 2,896 |
Have you tried Searching this site?
Unix/Linux/Mac OS X support by phone, email or on-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. We appreciate comments and article submissions.

Add your comments