APLawrence - Information and Resources for Unix and Linux Systems, Bloggers and the self-employed
RSS Feeds Get APLawrence.com by RSS











(OLDER) <- More Stuff -> (NEWER) (NEWEST)
Home > Unix Scripts > Unix Programs: LP Driver ioctl program
Printer Friendly Version




lp2status.c for SCO Unix 3.2v4.x


See Also

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;
};




If this page was useful to you, please click to help others find it:  

Your +1's can help friends, contacts, and others on the web find the best stuff when they search.

2 comments




More Articles by Tony Lawrence - Find me on Google+



Click here to add your comments





Wed May 26 06:52:19 2010:   komachi

gravatar
does it works?





Wed May 26 10:10:11 2010:   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?

Don't miss responses! Subscribe to Comments by RSS or by Email

Click here to add your comments


If you want a picture to show with your comment, go get a Gravatar



ad

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.

Publishing your articles here

Jump to Comments



Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.

Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.

We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.


My Troubleshooting E-Book will show you how to solve tough problems on Linux and Unix systems!


book graphic unix and linux troubleshooting guide




 I sell and support
 Kerio Mail server
pavatar.jpg

This post tagged:

       - Code
       - Drivers
       - Kernel
       - Printing




Unix/Linux Consultants

Skills Tests

Guest Post Here