diff options
author | Andrew Tridgell <tridge@samba.org> | 1996-06-19 12:23:54 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 1996-06-19 12:23:54 +0000 |
commit | dc38599c5a01211f20b9685dd440df82cd25c5cc (patch) | |
tree | 80fc911e9cfda52e4ea183bf55fc3bc842821554 /source3 | |
parent | 912d4dae3af4ca952b06c491f5c711c0cdea568b (diff) | |
download | samba-dc38599c5a01211f20b9685dd440df82cd25c5cc.tar.gz samba-dc38599c5a01211f20b9685dd440df82cd25c5cc.tar.bz2 samba-dc38599c5a01211f20b9685dd440df82cd25c5cc.zip |
- change date as a demo for john
- modified plp printing parser to work on my system
(This used to be commit 9408f91e1b9a2482af96afe9df08e0a5fba60cdb)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/locking/locking.c | 2 | ||||
-rw-r--r-- | source3/printing/printing.c | 64 |
2 files changed, 32 insertions, 34 deletions
diff --git a/source3/locking/locking.c b/source3/locking/locking.c index e81e1125e8..78661d6970 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -2,7 +2,7 @@ Unix SMB/Netbios implementation. Version 1.9. Locking functions - Copyright (C) Andrew Tridgell 1992-1995 + Copyright (C) Andrew Tridgell 1992-1996 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/source3/printing/printing.c b/source3/printing/printing.c index b6265798a1..2eef0d303b 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -600,10 +600,19 @@ 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> + +redone by tridge. Here is a sample queue: + +Local Printer 'lp2' (fjall): + Printing (started at Jun 15 13:33:58, attempt 1). + Rank Owner Pr Opt Job Host Files Size Date + active tridge X - 6 fjall /etc/hosts 739 Jun 15 13:33 + 3rd tridge X - 7 fjall /etc/hosts 739 Jun 15 13:33 + ****************************************************************************/ static BOOL parse_lpq_plp(char *line,print_queue_struct *buf,BOOL first) { - string tok[5]; + string tok[11]; int count=0; /* handle the case of "(standard input)" as a filename */ @@ -611,60 +620,49 @@ static BOOL parse_lpq_plp(char *line,print_queue_struct *buf,BOOL first) string_sub(line,"(","\""); string_sub(line,")","\""); - for (count=0; count<8 && next_token(&line,tok[count],NULL); count++) ; + for (count=0; count<11 && next_token(&line,tok[count],NULL); count++) ; - /* we must get 5 tokens */ - if (count < 8) + /* we must get 11 tokens */ + if (count < 11) return(False); - /* the 4rd must be integer */ - if (!isdigit(*tok[3])) return(False); + /* the first must be "active" or begin with an integer */ + if (strcmp(tok[0],"active") && !isdigit(tok[0][0])) + return(False); + + /* the 5th and 8th must be integer */ + if (!isdigit(*tok[4]) || !isdigit(*tok[7])) + return(False); /* if the fname contains a space then use STDIN */ - if (strchr(tok[3],' ')) - strcpy(tok[3],"STDIN"); + if (strchr(tok[6],' ')) + strcpy(tok[6],"STDIN"); /* only take the last part of the filename */ { string tmp; - char *p = strrchr(tok[5],'/'); + char *p = strrchr(tok[6],'/'); if (p) { strcpy(tmp,p+1); - strcpy(tok[5],tmp); + strcpy(tok[6],tmp); } } - buf->job = atoi(tok[3]); + buf->job = atoi(tok[4]); - /* 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->size = atoi(tok[7]); + if (strchr(tok[7],'K')) + buf->size *= 1024; + if (strchr(tok[7],'M')) + buf->size *= 1024*1024; - } 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); + StrnCpy(buf->file,tok[6],sizeof(buf->file)-1); return(True); } |