1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

r16243: Fix Klocwork bugs #581 and #706, ensure we check

the end of array first in the loop. Reformat to
modern standards.
Jeremy.
(This used to be commit 66275bd3bc)
This commit is contained in:
Jeremy Allison 2006-06-15 05:20:21 +00:00 committed by Gerald (Jerry) Carter
parent f9147c4e40
commit 8f2d6e4852

View File

@ -102,6 +102,7 @@ Rank Pri Owner Job Files Total Size
Modified to handle file names with spaces, like the parse_lpq_lprng code
further below.
****************************************************************************/
static BOOL parse_lpq_bsd(char *line,print_queue_struct *buf,BOOL first)
{
#ifdef OSF1
@ -133,8 +134,9 @@ static BOOL parse_lpq_bsd(char *line,print_queue_struct *buf,BOOL first)
{
size_t length;
length = strlen(line2);
if (line2[length-3] == ':')
return(False);
if (line2[length-3] == ':') {
return False;
}
}
#endif /* OSF1 */
@ -142,16 +144,19 @@ static BOOL parse_lpq_bsd(char *line,print_queue_struct *buf,BOOL first)
tok[0] = strtok(line2," \t");
count++;
while (((tok[count] = strtok(NULL," \t")) != NULL) && (count < MAXTOK)) {
while ((count < MAXTOK) && ((tok[count] = strtok(NULL," \t")) != NULL)) {
count++;
}
/* we must get at least NTOK tokens */
if (count < NTOK)
return(False);
if (count < NTOK) {
return False;
}
/* the Job and Total columns must be integer */
if (!isdigit((int)*tok[JOBTOK]) || !isdigit((int)*tok[TOTALTOK])) return(False);
if (!isdigit((int)*tok[JOBTOK]) || !isdigit((int)*tok[TOTALTOK])) {
return False;
}
buf->job = atoi(tok[JOBTOK]);
buf->size = atoi(tok[TOTALTOK]);
@ -179,7 +184,7 @@ static BOOL parse_lpq_bsd(char *line,print_queue_struct *buf,BOOL first)
#else
buf->priority = 1;
#endif
return(True);
return True;
}
/*
@ -227,13 +232,14 @@ static time_t LPRng_time(char *time_string)
return jobtime;
}
/****************************************************************************
parse a lprng lpq line
<allan@umich.edu> June 30, 1998.
Re-wrote this to handle file names with spaces, multiple file names on one
lpq line, etc;
****************************************************************************/
static BOOL parse_lpq_lprng(char *line,print_queue_struct *buf,BOOL first)
{
#define LPRNG_RANKTOK 0
@ -252,16 +258,17 @@ static BOOL parse_lpq_lprng(char *line,print_queue_struct *buf,BOOL first)
int num_tok = 0;
cptr = line;
while(next_token( &cptr, tokarr[num_tok], " \t", sizeof(fstring)) && (num_tok < LPRNG_MAXTOK))
while((num_tok < LPRNG_MAXTOK) && next_token( &cptr, tokarr[num_tok], " \t", sizeof(fstring))) {
num_tok++;
}
/* We must get at least LPRNG_NTOK tokens. */
if (num_tok < LPRNG_NTOK) {
return(False);
return False;
}
if (!isdigit((int)*tokarr[LPRNG_JOBTOK]) || !isdigit((int)*tokarr[LPRNG_TOTALTOK])) {
return(False);
return False;
}
buf->job = atoi(tokarr[LPRNG_JOBTOK]);
@ -307,11 +314,9 @@ static BOOL parse_lpq_lprng(char *line,print_queue_struct *buf,BOOL first)
fstrterminate(buf->fs_file);
}
return(True);
return True;
}
/*******************************************************************
parse lpq on an aix system
@ -324,6 +329,7 @@ lazer lazer RUNNING 537 6297doc.A kvintus@IE 0 10 2445 1 1
QUEUED 540 L.ps root@IEDVB 172 1 4
QUEUED 541 P.ps root@IEDVB 22 1 5
********************************************************************/
static BOOL parse_lpq_aix(char *line,print_queue_struct *buf,BOOL first)
{
fstring tok[11];
@ -335,69 +341,65 @@ static BOOL parse_lpq_aix(char *line,print_queue_struct *buf,BOOL first)
all_string_sub(line,"(","\"",0);
all_string_sub(line,")","\"",0);
for (count=0;
count<10 &&
next_token(&cline,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 6 tokens */
if (count < 10)
{
if ((count == 7) && ((strcmp(tok[0],"QUEUED") == 0) || (strcmp(tok[0],"HELD") == 0)))
{
if (count < 10) {
if ((count == 7) && ((strcmp(tok[0],"QUEUED") == 0) || (strcmp(tok[0],"HELD") == 0))) {
/* the 2nd and 5th columns must be integer */
if (!isdigit((int)*tok[1]) || !isdigit((int)*tok[4])) return(False);
if (!isdigit((int)*tok[1]) || !isdigit((int)*tok[4])) {
return False;
}
buf->size = atoi(tok[4]) * 1024;
/* if the fname contains a space then use STDIN */
if (strchr_m(tok[2],' '))
if (strchr_m(tok[2],' ')) {
fstrcpy(tok[2],"STDIN");
}
/* only take the last part of the filename */
{
fstring tmp;
char *p = strrchr_m(tok[2],'/');
if (p)
{
if (p) {
fstrcpy(tmp,p+1);
fstrcpy(tok[2],tmp);
}
}
buf->job = atoi(tok[1]);
buf->status = strequal(tok[0],"HELD")?LPQ_PAUSED:LPQ_QUEUED;
buf->priority = 0;
buf->time = time(NULL);
fstrcpy(buf->fs_user,tok[3]);
fstrcpy(buf->fs_file,tok[2]);
}
else
{
} else {
DEBUG(6,("parse_lpq_aix count=%d\n", count));
return(False);
return False;
}
}
else
{
} else {
/* the 4th and 9th columns must be integer */
if (!isdigit((int)*tok[3]) || !isdigit((int)*tok[8])) return(False);
if (!isdigit((int)*tok[3]) || !isdigit((int)*tok[8])) {
return False;
}
buf->size = atoi(tok[8]) * 1024;
/* if the fname contains a space then use STDIN */
if (strchr_m(tok[4],' '))
if (strchr_m(tok[4],' ')) {
fstrcpy(tok[4],"STDIN");
}
/* only take the last part of the filename */
{
fstring tmp;
char *p = strrchr_m(tok[4],'/');
if (p)
{
if (p) {
fstrcpy(tmp,p+1);
fstrcpy(tok[4],tmp);
}
}
buf->job = atoi(tok[3]);
buf->status = strequal(tok[2],"RUNNING")?LPQ_PRINTING:LPQ_QUEUED;
buf->priority = 0;
@ -406,11 +408,9 @@ static BOOL parse_lpq_aix(char *line,print_queue_struct *buf,BOOL first)
fstrcpy(buf->fs_file,tok[4]);
}
return(True);
return True;
}
/****************************************************************************
parse a lpq line
here is an example of lpq output under hpux; note there's no space after -o !
@ -421,6 +421,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)
{
/* must read two lines to process, therefore keep some values static */
@ -446,22 +447,33 @@ static BOOL parse_lpq_hpux(char *line, print_queue_struct *buf, BOOL first)
base_prio=atoi(&line[18]);
DEBUG(4, ("fence priority set at %d\n", base_prio));
}
if (!header_line_ok) return (False); /* incorrect header line */
if (!header_line_ok) {
return False; /* incorrect header line */
}
/* handle the case of "(standard input)" as a filename */
string_sub(line,"standard input","STDIN",0);
all_string_sub(line,"(","\"",0);
all_string_sub(line,")","\"",0);
for (count=0; count<2 && next_token(&cline,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);
if (count < 2) {
return False;
}
/* the 2nd column must be integer */
if (!isdigit((int)*tok[1])) return(False);
if (!isdigit((int)*tok[1])) {
return False;
}
/* if the fname contains a space then use STDIN */
if (strchr_m(tok[0],' '))
if (strchr_m(tok[0],' ')) {
fstrcpy(tok[0],"STDIN");
}
buf->size = atoi(tok[1]);
fstrcpy(buf->fs_file,tok[0]);
@ -473,29 +485,35 @@ static BOOL parse_lpq_hpux(char *line, print_queue_struct *buf, BOOL first)
buf->priority = jobprio;
fstrcpy(buf->fs_user,jobuser);
return(True);
}
else { /* header line */
return True;
} else { /* header line */
header_line_ok=False; /* reset it */
if (first) {
if (!base_prio_reset) {
base_prio=0; /* reset it */
base_prio_reset=True;
}
} else if (base_prio) {
base_prio_reset=False;
}
else if (base_prio) base_prio_reset=False;
/* handle the dash in the job id */
string_sub(line,"-"," ",0);
for (count=0; count<12 && next_token(&cline,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);
if (count < 8) {
return False;
}
/* first token must be printer name (cannot check ?) */
/* the 2nd, 5th & 7th column must be integer */
if (!isdigit((int)*tok[1]) || !isdigit((int)*tok[4]) || !isdigit((int)*tok[6])) return(False);
if (!isdigit((int)*tok[1]) || !isdigit((int)*tok[4]) || !isdigit((int)*tok[6])) {
return False;
}
jobid = atoi(tok[1]);
fstrcpy(jobuser,tok[2]);
jobprio = atoi(tok[4]);
@ -504,22 +522,22 @@ static BOOL parse_lpq_hpux(char *line, print_queue_struct *buf, BOOL first)
jobtime=EntryTime(tok, 5, count, 8);
if (jobprio < base_prio) {
jobstat = LPQ_PAUSED;
DEBUG (4, ("job %d is paused: prio %d < %d; jobstat=%d\n", jobid, jobprio, base_prio, jobstat));
}
else {
DEBUG (4, ("job %d is paused: prio %d < %d; jobstat=%d\n",
jobid, jobprio, base_prio, jobstat));
} else {
jobstat = LPQ_QUEUED;
if ((count >8) && (((strequal(tok[8],"on")) ||
((strequal(tok[8],"from")) &&
((count > 10)&&(strequal(tok[10],"on")))))))
((count > 10)&&(strequal(tok[10],"on"))))))) {
jobstat = LPQ_PRINTING;
}
}
header_line_ok=True; /* information is correct */
return(False); /* need subline info to include into queuelist */
return False; /* need subline info to include into queuelist */
}
}
/****************************************************************************
parse a lpstat line
@ -529,6 +547,7 @@ dcslw-896 tridge 4712 Dec 20 10:30:30 on dcslw
dcslw-897 tridge 4712 Dec 20 10:30:30 being held
****************************************************************************/
static BOOL parse_lpq_sysv(char *line,print_queue_struct *buf,BOOL first)
{
fstring tok[9];
@ -545,31 +564,38 @@ static BOOL parse_lpq_sysv(char *line,print_queue_struct *buf,BOOL first)
/*
* Move to the first space.
*/
for (p = line ; !isspace(*p) && *p; p++)
for (p = line ; !isspace(*p) && *p; p++) {
;
}
/*
* Back up until the last '-' character or
* start of line.
*/
for (; (p >= line) && (*p != '-'); p--)
for (; (p >= line) && (*p != '-'); p--) {
;
}
if((p >= line) && (*p == '-'))
if((p >= line) && (*p == '-')) {
*p = ' ';
}
for (count=0; count<9 && next_token(&cline,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 */
if (count < 7)
return(False);
if (count < 7) {
return False;
}
/* the 2nd and 4th, 6th columns must be integer */
if (!isdigit((int)*tok[1]) || !isdigit((int)*tok[3]))
return(False);
if (!isdigit((int)*tok[5]))
return(False);
if (!isdigit((int)*tok[1]) || !isdigit((int)*tok[3])) {
return False;
}
if (!isdigit((int)*tok[5])) {
return False;
}
/* if the user contains a ! then trim the first part of it */
if ((p=strchr_m(tok[2],'!'))) {
@ -580,17 +606,18 @@ static BOOL parse_lpq_sysv(char *line,print_queue_struct *buf,BOOL first)
buf->job = atoi(tok[1]);
buf->size = atoi(tok[3]);
if (count > 7 && strequal(tok[7],"on"))
if (count > 7 && strequal(tok[7],"on")) {
buf->status = LPQ_PRINTING;
else if (count > 8 && strequal(tok[7],"being") && strequal(tok[8],"held"))
} else if (count > 8 && strequal(tok[7],"being") && strequal(tok[8],"held")) {
buf->status = LPQ_PAUSED;
else
} else {
buf->status = LPQ_QUEUED;
}
buf->priority = 0;
buf->time = EntryTime(tok, 4, count, 7);
fstrcpy(buf->fs_user,tok[2]);
fstrcpy(buf->fs_file,tok[2]);
return(True);
return True;
}
/****************************************************************************
@ -603,6 +630,7 @@ Printer: txt (ready)
0001: root [job #2 ] ready 2378 bytes /etc/install
0002: root [job #3 ] ready 1146 bytes -- standard input --
****************************************************************************/
static BOOL parse_lpq_qnx(char *line,print_queue_struct *buf,BOOL first)
{
fstring tok[7];
@ -622,27 +650,30 @@ 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(&cline,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)
return(False);
if (count < 7) {
return False;
}
/* the 3rd and 5th columns must be integer */
if (!isdigit((int)*tok[2]) || !isdigit((int)*tok[4])) return(False);
if (!isdigit((int)*tok[2]) || !isdigit((int)*tok[4])) {
return False;
}
/* only take the last part of the filename */
{
fstring tmp;
char *p = strrchr_m(tok[6],'/');
if (p)
{
if (p) {
fstrcpy(tmp,p+1);
fstrcpy(tok[6],tmp);
}
}
buf->job = atoi(tok[2]);
buf->size = atoi(tok[4]);
buf->status = strequal(tok[3],"active")?LPQ_PRINTING:LPQ_QUEUED;
@ -650,10 +681,9 @@ static BOOL parse_lpq_qnx(char *line,print_queue_struct *buf,BOOL first)
buf->time = time(NULL);
fstrcpy(buf->fs_user,tok[1]);
fstrcpy(buf->fs_file,tok[6]);
return(True);
return True;
}
/****************************************************************************
parse a lpq line for the plp printing system
Bertrand Wallrich <Bertrand.Wallrich@loria.fr>
@ -667,6 +697,7 @@ Local Printer 'lp2' (fjall):
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)
{
fstring tok[11];
@ -678,50 +709,56 @@ static BOOL parse_lpq_plp(char *line,print_queue_struct *buf,BOOL first)
all_string_sub(line,"(","\"",0);
all_string_sub(line,")","\"",0);
for (count=0; count<11 && next_token(&cline,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)
return(False);
if (count < 11) {
return False;
}
/* the first must be "active" or begin with an integer */
if (strcmp(tok[0],"active") && !isdigit((int)tok[0][0]))
return(False);
if (strcmp(tok[0],"active") && !isdigit((int)tok[0][0])) {
return False;
}
/* the 5th and 8th must be integer */
if (!isdigit((int)*tok[4]) || !isdigit((int)*tok[7]))
return(False);
if (!isdigit((int)*tok[4]) || !isdigit((int)*tok[7])) {
return False;
}
/* if the fname contains a space then use STDIN */
if (strchr_m(tok[6],' '))
if (strchr_m(tok[6],' ')) {
fstrcpy(tok[6],"STDIN");
}
/* only take the last part of the filename */
{
fstring tmp;
char *p = strrchr_m(tok[6],'/');
if (p)
{
if (p) {
fstrcpy(tmp,p+1);
fstrcpy(tok[6],tmp);
}
}
buf->job = atoi(tok[4]);
buf->size = atoi(tok[7]);
if (strchr_m(tok[7],'K'))
if (strchr_m(tok[7],'K')) {
buf->size *= 1024;
if (strchr_m(tok[7],'M'))
}
if (strchr_m(tok[7],'M')) {
buf->size *= 1024*1024;
}
buf->status = strequal(tok[0],"active")?LPQ_PRINTING:LPQ_QUEUED;
buf->priority = 0;
buf->time = time(NULL);
fstrcpy(buf->fs_user,tok[1]);
fstrcpy(buf->fs_file,tok[6]);
return(True);
return True;
}
/*******************************************************************
@ -737,6 +774,7 @@ root (9.99. Paused /usr/lib/rhs/rhs-pr 4 625 0 1
jmcd Waiting Re: Samba Open Sour 26 32476 1 1
********************************************************************/
static BOOL parse_lpq_nt(char *line,print_queue_struct *buf,BOOL first)
{
#define LPRNT_OWNSIZ 11
@ -744,8 +782,7 @@ static BOOL parse_lpq_nt(char *line,print_queue_struct *buf,BOOL first)
#define LPRNT_JOBSIZ 19
#define LPRNT_IDSIZ 6
#define LPRNT_SIZSIZ 9
typedef struct
{
typedef struct {
char owner[LPRNT_OWNSIZ];
char space1;
char status[LPRNT_STATSIZ];
@ -766,26 +803,30 @@ static BOOL parse_lpq_nt(char *line,print_queue_struct *buf,BOOL first)
memset(&parse_line, '\0', sizeof(parse_line));
strncpy((char *) &parse_line, line, sizeof(parse_line) -1);
if (strlen((char *) &parse_line) != sizeof(parse_line) - 1)
return(False);
if (strlen((char *) &parse_line) != sizeof(parse_line) - 1) {
return False;
}
/* Just want the first word in the owner field - the username */
if (strchr_m(parse_line.owner, ' '))
if (strchr_m(parse_line.owner, ' ')) {
*(strchr_m(parse_line.owner, ' ')) = '\0';
else
} else {
parse_line.space1 = '\0';
}
/* Make sure we have an owner */
if (!strlen(parse_line.owner))
return(False);
if (!strlen(parse_line.owner)) {
return False;
}
/* Make sure the status is valid */
parse_line.space2 = '\0';
trim_char(parse_line.status, '\0', ' ');
if (!strequal(parse_line.status, LPRNT_PRINTING) &&
!strequal(parse_line.status, LPRNT_PAUSED) &&
!strequal(parse_line.status, LPRNT_WAITING))
return(False);
!strequal(parse_line.status, LPRNT_WAITING)) {
return False;
}
parse_line.space3 = '\0';
trim_char(parse_line.jobname, '\0', ' ');
@ -796,14 +837,15 @@ static BOOL parse_lpq_nt(char *line,print_queue_struct *buf,BOOL first)
buf->time = time(NULL);
fstrcpy(buf->fs_user, parse_line.owner);
fstrcpy(buf->fs_file, parse_line.jobname);
if (strequal(parse_line.status, LPRNT_PRINTING))
if (strequal(parse_line.status, LPRNT_PRINTING)) {
buf->status = LPQ_PRINTING;
else if (strequal(parse_line.status, LPRNT_PAUSED))
} else if (strequal(parse_line.status, LPRNT_PAUSED)) {
buf->status = LPQ_PAUSED;
else
} else {
buf->status = LPQ_QUEUED;
}
return(True);
return True;
}
/*******************************************************************
@ -815,6 +857,7 @@ JobID File Name Rank Size Status Comment
4 /etc/motd 2 11666 Queued root@psflinu
********************************************************************/
static BOOL parse_lpq_os2(char *line,print_queue_struct *buf,BOOL first)
{
#define LPROS2_IDSIZ 5
@ -822,8 +865,7 @@ static BOOL parse_lpq_os2(char *line,print_queue_struct *buf,BOOL first)
#define LPROS2_SIZSIZ 8
#define LPROS2_STATSIZ 12
#define LPROS2_OWNSIZ 12
typedef struct
{
typedef struct {
char jobid[LPROS2_IDSIZ];
char space1[2];
char jobname[LPROS2_JOBSIZ];
@ -844,8 +886,9 @@ static BOOL parse_lpq_os2(char *line,print_queue_struct *buf,BOOL first)
memset(&parse_line, '\0', sizeof(parse_line));
strncpy((char *) &parse_line, line, sizeof(parse_line) -1);
if (strlen((char *) &parse_line) != sizeof(parse_line) - 1)
return(False);
if (strlen((char *) &parse_line) != sizeof(parse_line) - 1) {
return False;
}
/* Get the jobid */
buf->job = atoi(parse_line.jobid);
@ -860,26 +903,29 @@ static BOOL parse_lpq_os2(char *line,print_queue_struct *buf,BOOL first)
buf->time = time(NULL);
/* Make sure we have an owner */
if (!strlen(parse_line.owner))
return(False);
if (!strlen(parse_line.owner)) {
return False;
}
/* Make sure we have a valid status */
parse_line.space4[0] = '\0';
trim_char(parse_line.status, '\0', ' ');
if (!strequal(parse_line.status, LPROS2_PRINTING) &&
!strequal(parse_line.status, LPROS2_PAUSED) &&
!strequal(parse_line.status, LPROS2_WAITING))
return(False);
!strequal(parse_line.status, LPROS2_WAITING)) {
return False;
}
fstrcpy(buf->fs_user, parse_line.owner);
if (strequal(parse_line.status, LPROS2_PRINTING))
if (strequal(parse_line.status, LPROS2_PRINTING)) {
buf->status = LPQ_PRINTING;
else if (strequal(parse_line.status, LPROS2_PAUSED))
} else if (strequal(parse_line.status, LPROS2_PAUSED)) {
buf->status = LPQ_PAUSED;
else
} else {
buf->status = LPQ_QUEUED;
}
return(True);
return True;
}
static const char *stat0_strings[] = { "enabled", "online", "idle", "no entries", "free", "ready", NULL };
@ -891,6 +937,7 @@ static const char *stat2_strings[] = { "jam", "paper", "error", "responding", "n
/****************************************************************************
parse a vlp line
****************************************************************************/
static BOOL parse_lpq_vlp(char *line,print_queue_struct *buf,BOOL first)
{
int toknum = 0;
@ -942,8 +989,7 @@ BOOL parse_lpq_entry(enum printing_types printing_type,char *line,
{
BOOL ret;
switch (printing_type)
{
switch (printing_type) {
case PRINT_SYSV:
ret = parse_lpq_sysv(line,buf,first);
break;
@ -982,19 +1028,19 @@ BOOL parse_lpq_entry(enum printing_types printing_type,char *line,
/* We don't want the newline in the status message. */
{
char *p = strchr_m(line,'\n');
if (p) *p = 0;
if (p) {
*p = 0;
}
}
/* in the LPRNG case, we skip lines starting by a space.*/
if (!ret && (printing_type==PRINT_LPRNG) )
{
if (line[0]==' ')
if (!ret && (printing_type==PRINT_LPRNG) ) {
if (line[0]==' ') {
return ret;
}
}
if (status && !ret)
{
if (status && !ret) {
/* a few simple checks to see if the line might be a
printer status line:
handle them so that most severe condition is shown */
@ -1003,29 +1049,34 @@ BOOL parse_lpq_entry(enum printing_types printing_type,char *line,
switch (status->status) {
case LPSTAT_OK:
for (i=0; stat0_strings[i]; i++)
for (i=0; stat0_strings[i]; i++) {
if (strstr_m(line,stat0_strings[i])) {
fstrcpy(status->message,line);
status->status=LPSTAT_OK;
return ret;
}
}
/* fallthrough */
case LPSTAT_STOPPED:
for (i=0; stat1_strings[i]; i++)
for (i=0; stat1_strings[i]; i++) {
if (strstr_m(line,stat1_strings[i])) {
fstrcpy(status->message,line);
status->status=LPSTAT_STOPPED;
return ret;
}
}
/* fallthrough */
case LPSTAT_ERROR:
for (i=0; stat2_strings[i]; i++)
for (i=0; stat2_strings[i]; i++) {
if (strstr_m(line,stat2_strings[i])) {
fstrcpy(status->message,line);
status->status=LPSTAT_ERROR;
return ret;
}
}
break;
}
}
return(ret);
return ret;
}