| Hello !
I have used small workaround for this. This C program issues lpr
command number of times based on the value given for multiple
copies.
The usage is same as lpr.
regards
Nagaraj Hegde
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#define TRUE 1
#define FALSE 0
main(int argc, char *argv[])
{
int LOOP = argc, MULTIPLE_COPIES = 0, i = 0;
int count = 1;
char command_string[5],system_command[100];
int Hash_Option = -1;
if (argc < 2)
{
fprintf(stderr,"Usage : lpr [flags] <filename>\n");
exit(0);
}
while(LOOP)
{
if( !strncmp(argv[i],"-#",2))
{
MULTIPLE_COPIES=TRUE;
Hash_Option = i;
break;
}
LOOP--;
i++;
}
if(MULTIPLE_COPIES == TRUE)
sscanf( argv[i],"-#%d",&count);
strcpy(system_command,"lpx ");
for( i = 1; i < argc; i++) {
if( MULTIPLE_COPIES == TRUE && i == Hash_Option)
continue;
strcat(system_command," ");
strcat(system_command,argv[i]);
}
for(i = 0;i < count; i++) {
system(system_command);
}
}
|