summaryrefslogtreecommitdiff
path: root/source3/printing/lpq_parse.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-11-12 23:20:50 +0000
committerJeremy Allison <jra@samba.org>2002-11-12 23:20:50 +0000
commit2f194322d419350f35a48dff750066894d68eccf (patch)
treeb0501eaf874ca8e740a51a8e0f29d261e32e0093 /source3/printing/lpq_parse.c
parentf2b669b37fecda2687860eba4a15801dc89855dc (diff)
downloadsamba-2f194322d419350f35a48dff750066894d68eccf.tar.gz
samba-2f194322d419350f35a48dff750066894d68eccf.tar.bz2
samba-2f194322d419350f35a48dff750066894d68eccf.zip
Removed global_myworkgroup, global_myname, global_myscope. Added liberal
dashes of const. This is a rather large check-in, some things may break. It does compile though :-). Jeremy. (This used to be commit f755711df8f74f9b8e8c1a2b0d07d02a931eeb89)
Diffstat (limited to 'source3/printing/lpq_parse.c')
-rw-r--r--source3/printing/lpq_parse.c40
1 files changed, 22 insertions, 18 deletions
diff --git a/source3/printing/lpq_parse.c b/source3/printing/lpq_parse.c
index 1307cdb3f8..59a844689c 100644
--- a/source3/printing/lpq_parse.c
+++ b/source3/printing/lpq_parse.c
@@ -232,12 +232,11 @@ static BOOL parse_lpq_lprng(char *line,print_queue_struct *buf,BOOL first)
#define LPRNG_MAXTOK 128 /* PFMA just to keep us from running away. */
fstring tokarr[LPRNG_MAXTOK];
- char *cptr;
+ const char *cptr;
+ char *ptr;
int num_tok = 0;
- pstring line2;
- pstrcpy(line2,line);
- cptr = line2;
+ cptr = line;
while(next_token( &cptr, tokarr[num_tok], " \t", sizeof(fstring)) && (num_tok < LPRNG_MAXTOK))
num_tok++;
@@ -273,8 +272,8 @@ static BOOL parse_lpq_lprng(char *line,print_queue_struct *buf,BOOL first)
* for the current user on the taskbar. Plop in a null.
*/
- if ((cptr = strchr_m(buf->fs_user,'@')) != NULL) {
- *cptr = '\0';
+ if ((ptr = strchr_m(buf->fs_user,'@')) != NULL) {
+ *ptr = '\0';
}
StrnCpy(buf->fs_file,tokarr[LPRNG_FILETOK],sizeof(buf->fs_file)-1);
@@ -314,6 +313,7 @@ static BOOL parse_lpq_aix(char *line,print_queue_struct *buf,BOOL first)
{
fstring tok[11];
int count=0;
+ const char *cline = line;
/* handle the case of "(standard input)" as a filename */
string_sub(line,"standard input","STDIN",0);
@@ -322,7 +322,7 @@ static BOOL parse_lpq_aix(char *line,print_queue_struct *buf,BOOL first)
for (count=0;
count<10 &&
- next_token(&line,tok[count],NULL, sizeof(tok[count]));
+ next_token(&cline,tok[count],NULL, sizeof(tok[count]));
count++) ;
/* we must get 6 tokens */
@@ -406,7 +406,7 @@ ljplus-2153 user priority 0 Jan 19 08:14 on ljplus
ljplus-2154 user priority 0 Jan 19 08:14 from client
(standard input) 7551 bytes
****************************************************************************/
-static BOOL parse_lpq_hpux(char * line, print_queue_struct *buf, BOOL first)
+static BOOL parse_lpq_hpux(char *line, print_queue_struct *buf, BOOL first)
{
/* must read two lines to process, therefore keep some values static */
static BOOL header_line_ok=False, base_prio_reset=False;
@@ -418,9 +418,9 @@ static BOOL parse_lpq_hpux(char * line, print_queue_struct *buf, BOOL first)
/* to store minimum priority to print, lpstat command should be invoked
with -p option first, to work */
static int base_prio;
-
int count;
char htab = '\011';
+ const char *cline = line;
fstring tok[12];
/* If a line begins with a horizontal TAB, it is a subline type */
@@ -437,7 +437,7 @@ static BOOL parse_lpq_hpux(char * line, print_queue_struct *buf, BOOL first)
all_string_sub(line,"(","\"",0);
all_string_sub(line,")","\"",0);
- for (count=0; count<2 && next_token(&line,tok[count],NULL,sizeof(tok[count])); count++) ;
+ for (count=0; count<2 && next_token(&cline,tok[count],NULL,sizeof(tok[count])); count++) ;
/* we must get 2 tokens */
if (count < 2) return(False);
@@ -473,7 +473,7 @@ static BOOL parse_lpq_hpux(char * line, print_queue_struct *buf, BOOL first)
/* handle the dash in the job id */
string_sub(line,"-"," ",0);
- for (count=0; count<12 && next_token(&line,tok[count],NULL,sizeof(tok[count])); count++) ;
+ for (count=0; count<12 && next_token(&cline,tok[count],NULL,sizeof(tok[count])); count++) ;
/* we must get 8 tokens */
if (count < 8) return(False);
@@ -519,6 +519,7 @@ static BOOL parse_lpq_sysv(char *line,print_queue_struct *buf,BOOL first)
fstring tok[9];
int count=0;
char *p;
+ const char *cline = line;
/*
* Handle the dash in the job id, but make sure that we skip over
@@ -542,7 +543,7 @@ static BOOL parse_lpq_sysv(char *line,print_queue_struct *buf,BOOL first)
if((p >= line) && (*p == '-'))
*p = ' ';
- for (count=0; count<9 && next_token(&line,tok[count],NULL,sizeof(tok[count])); count++)
+ for (count=0; count<9 && next_token(&cline,tok[count],NULL,sizeof(tok[count])); count++)
;
/* we must get 7 tokens */
@@ -591,6 +592,7 @@ static BOOL parse_lpq_qnx(char *line,print_queue_struct *buf,BOOL first)
{
fstring tok[7];
int count=0;
+ const char *cline;
DEBUG(4,("antes [%s]\n", line));
@@ -605,9 +607,7 @@ static BOOL parse_lpq_qnx(char *line,print_queue_struct *buf,BOOL first)
string_sub(line,"]","",0);
DEBUG(4,("despues 2 [%s]\n", line));
-
-
- for (count=0; count<7 && next_token(&line,tok[count],NULL,sizeof(tok[count])); count++) ;
+ for (count=0; count<7 && next_token(&cline,tok[count],NULL,sizeof(tok[count])); count++) ;
/* we must get 7 tokens */
if (count < 7)
@@ -656,13 +656,14 @@ static BOOL parse_lpq_plp(char *line,print_queue_struct *buf,BOOL first)
{
fstring tok[11];
int count=0;
+ const char *cline = line;
/* handle the case of "(standard input)" as a filename */
string_sub(line,"stdin","STDIN",0);
all_string_sub(line,"(","\"",0);
all_string_sub(line,")","\"",0);
- for (count=0; count<11 && next_token(&line,tok[count],NULL,sizeof(tok[count])); count++) ;
+ for (count=0; count<11 && next_token(&cline,tok[count],NULL,sizeof(tok[count])); count++) ;
/* we must get 11 tokens */
if (count < 11)
@@ -726,11 +727,12 @@ static BOOL parse_lpq_softq(char *line,print_queue_struct *buf,BOOL first)
{
fstring tok[10];
int count=0;
+ const char *cline = line;
/* mung all the ":"s to spaces*/
string_sub(line,":"," ",0);
- for (count=0; count<10 && next_token(&line,tok[count],NULL,sizeof(tok[count])); count++) ;
+ for (count=0; count<10 && next_token(&cline,tok[count],NULL,sizeof(tok[count])); count++) ;
/* we must get 9 tokens */
if (count < 9)
@@ -958,6 +960,7 @@ static BOOL parse_lpq_vlp(char *line,print_queue_struct *buf,BOOL first)
{
int toknum = 0;
fstring tok;
+ const char *cline = line;
/* First line is printer status */
@@ -965,7 +968,7 @@ static BOOL parse_lpq_vlp(char *line,print_queue_struct *buf,BOOL first)
/* Parse a print job entry */
- while(next_token(&line, tok, NULL, sizeof(fstring))) {
+ while(next_token(&cline, tok, NULL, sizeof(fstring))) {
switch (toknum) {
case 0:
buf->job = atoi(tok);
@@ -997,6 +1000,7 @@ static BOOL parse_lpq_vlp(char *line,print_queue_struct *buf,BOOL first)
/****************************************************************************
parse a lpq line. Choose printing style
****************************************************************************/
+
BOOL parse_lpq_entry(int snum,char *line,
print_queue_struct *buf,
print_status_struct *status,BOOL first)