summaryrefslogtreecommitdiff
path: root/source3/printing
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1996-05-31 15:13:29 +0000
committerAndrew Tridgell <tridge@samba.org>1996-05-31 15:13:29 +0000
commit58734631b4233ec08b7a262587e400792f31f185 (patch)
tree960d8520ca847203a89aee2ae9e7cd362d9d7730 /source3/printing
parent26e045daff2762c3739609da19934aadc552cae8 (diff)
downloadsamba-58734631b4233ec08b7a262587e400792f31f185.tar.gz
samba-58734631b4233ec08b7a262587e400792f31f185.tar.bz2
samba-58734631b4233ec08b7a262587e400792f31f185.zip
Lots of changes!
- add faq info on NT printer handling - add "delete readonly" option to help rcs users - add stuff to man pages on new printer options - add "proxy name resolution" option - add "command string" -c option to smbclient (thanks Ken) - split time functions into time.c - rearrange the quotas stuff a bit and fix some bugs - complete rehash of the time handling code thanks to Paul Eggert - fix nmblookup output a bit - add plp print queue parsing from Bertrand Wallrich (This used to be commit 635b56f19c817527c52e9bbde31faa6a8a47777b)
Diffstat (limited to 'source3/printing')
-rw-r--r--source3/printing/printing.c81
1 files changed, 79 insertions, 2 deletions
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index 1dd8921800..2aa27926d9 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -149,7 +149,7 @@ process time fields
********************************************************************/
static time_t EntryTime(string tok[], int ptr, int count, int minimum)
{
- time_t jobtime;
+ time_t jobtime,jobtime1;
jobtime = time(NULL); /* default case: take current time */
if (count >= minimum) {
@@ -181,7 +181,9 @@ static time_t EntryTime(string tok[], int ptr, int count, int minimum)
t->tm_hour = hour;
t->tm_min = min;
t->tm_sec = sec;
- jobtime = mktime(t);
+ jobtime1 = mktime(t);
+ if (jobtime1 != (time_t)-1)
+ jobtime = jobtime1;
}
}
return jobtime;
@@ -596,6 +598,78 @@ static BOOL parse_lpq_qnx(char *line,print_queue_struct *buf,BOOL first)
}
+/****************************************************************************
+ parse a lpq line for the plp printing system
+ Bertrand Wallrich <Bertrand.Wallrich@loria.fr>
+****************************************************************************/
+static BOOL parse_lpq_plp(char *line,print_queue_struct *buf,BOOL first)
+{
+ string tok[5];
+ int count=0;
+
+ /* handle the case of "(standard input)" as a filename */
+ string_sub(line,"stdin","STDIN");
+ string_sub(line,"(","\"");
+ string_sub(line,")","\"");
+
+ for (count=0; count<8 && next_token(&line,tok[count],NULL); count++) ;
+
+ /* we must get 5 tokens */
+ if (count < 8)
+ return(False);
+
+ /* the 4rd must be integer */
+ if (!isdigit(*tok[3])) return(False);
+
+ /* if the fname contains a space then use STDIN */
+ if (strchr(tok[3],' '))
+ strcpy(tok[3],"STDIN");
+
+ /* only take the last part of the filename */
+ {
+ string tmp;
+ char *p = strrchr(tok[5],'/');
+ if (p)
+ {
+ strcpy(tmp,p+1);
+ strcpy(tok[5],tmp);
+ }
+ }
+
+
+ buf->job = atoi(tok[3]);
+
+ /* calcul de la taille du fichier */
+ if (!isdigit(*tok[7])) { buf->size = atoi(tok[7]) * 1.0 ; }
+ else {
+ string tmp;
+ strcpy(tmp,tok[7]);
+ if (strchr(tok[7],'K')) {
+ strncpy(tok[7],tmp,strlen(tmp)-1);
+ buf->size = atoi(tok[7]);
+ buf->size = buf->size * 1024;
+ }
+ if (strchr(tok[7],'M')) {
+ strncpy(tok[7],tmp,strlen(tmp)-1);
+ buf->size = atoi(tok[7]);
+ buf->size = buf->size * 1024.0 * 1000.0;
+ }
+ if (strchr(tok[7],'G')) {
+ strncpy(tok[7],tmp,strlen(tmp)-1);
+ buf->size = atoi(tok[7]);
+ buf->size = buf->size * 1024.0 * 1000000.0;
+ }
+
+ }
+ buf->status = strequal(tok[0],"active")?LPQ_PRINTING:LPQ_QUEUED;
+ buf->priority = 0;
+ buf->time = time(NULL);
+ StrnCpy(buf->user,tok[1],sizeof(buf->user)-1);
+ StrnCpy(buf->file,tok[5],sizeof(buf->file)-1);
+ return(True);
+}
+
+
char *stat0_strings[] = { "enabled", "online", "idle", "no entries", "free", "ready", NULL };
char *stat1_strings[] = { "offline", "disabled", "down", "off", "waiting", "no daemon", NULL };
@@ -624,6 +698,9 @@ static BOOL parse_lpq_entry(int snum,char *line,
case PRINT_QNX:
ret = parse_lpq_qnx(line,buf,first);
break;
+ case PRINT_PLP:
+ ret = parse_lpq_plp(line,buf,first);
+ break;
default:
ret = parse_lpq_bsd(line,buf,first);
break;