Skip to content
This repository has been archived by the owner on Sep 16, 2023. It is now read-only.

Commit

Permalink
papd: Send replies to client when printing to prompt more data to be …
Browse files Browse the repository at this point in the history
…sent. Original patch by Nat Sloss.
  • Loading branch information
rdmark committed Jan 28, 2022
1 parent 196782d commit c17f794
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
16 changes: 15 additions & 1 deletion etc/papd/file.c
Expand Up @@ -40,7 +40,7 @@ int markline( struct papfile *pf, char **start, int *linelength, int *crlflength
if ( *linelength >= pf->pf_datalen ) {
if ( pf->pf_state & PF_EOF ) {
append( pf, "\n", 1 );
} else if (*linelength < 1024) {
} else {
return( -1 );
}
}
Expand Down Expand Up @@ -109,6 +109,20 @@ void append(struct papfile *pf, const char *data, int len)
}


void spoolreply(struct papfile *out, char *str)
{
char *pserr1 = "%%[ status: ";
char *pserr2 = " ]%%\n";

if ( str == NULL ) {
str = "Spooler error.";
}

append( out, pserr1, strlen( pserr1 ));
append( out, str, strlen( str ));
append( out, pserr2, strlen( pserr2 ));
}

void spoolerror(struct papfile *out, char *str)
{
char *pserr1 = "%%[ Error: ";
Expand Down
1 change: 1 addition & 0 deletions etc/papd/file.h
Expand Up @@ -41,5 +41,6 @@ int markline ( struct papfile *, char **, int *, int * );
void morespace ( struct papfile *, const char *, int );
void append ( struct papfile *, const char *, int );
void spoolerror ( struct papfile *, char * );
void spoolreply ( struct papfile *, char * );

#endif /* PAPD_FILE_H */
2 changes: 2 additions & 0 deletions etc/papd/magics.c
Expand Up @@ -78,6 +78,7 @@ int ps( struct papfile *infile, struct papfile *outfile, struct sockaddr_at *sat
return( 0 );

case -1 :
spoolreply( outfile, "Processing..." );
return( 0 );
}

Expand Down Expand Up @@ -130,6 +131,7 @@ int cm_psquery( struct papfile *in, struct papfile *out, struct sockaddr_at *sat
return( CH_DONE );

case -1 :
spoolreply( out, "Processing..." );
return( CH_MORE );

case -2 :
Expand Down

0 comments on commit c17f794

Please sign in to comment.