/*
- * "$Id: testlpd.c 6649 2007-07-11 21:46:42Z mike $"
+ * "$Id: testlpd.c 6705 2007-07-20 22:25:31Z mike $"
*
* cups-lpd test program for the Common UNIX Printing System (CUPS).
*
char *cupslpd_argv[1000]; /* Arguments for cups-lpd */
int cupslpd_stdin[2], /* Standard input for cups-lpd */
cupslpd_stdout[2], /* Standard output for cups-lpd */
- cupslpd_pid; /* Process ID for cups-lpd */
+ cupslpd_pid, /* Process ID for cups-lpd */
+ cupslpd_status; /* Status of cups-lpd process */
/*
{
cupslpd_argv[cupslpd_argc++] = argv[i];
- if (argv[i][2])
+ if (!argv[i][2])
{
i ++;
(strcmp(op, "print-job") && strcmp(op, "print-waiting") &&
strcmp(op, "remove-job") && strcmp(op, "status-long") &&
strcmp(op, "status-short")))
+ {
+ printf("op=\"%s\", dest=\"%s\", opargs=%p\n", op, dest, opargs);
usage();
+ }
/*
* Run the cups-lpd program using pipes...
close(cupslpd_stdin[1]);
close(cupslpd_stdout[0]);
- kill(cupslpd_pid, SIGTERM);
+
+ while (wait(&cupslpd_status) != cupslpd_pid);
+
+ printf("cups-lpd exit status was %d...\n", cupslpd_status);
/*
* Return the test status...
}
if (read(infd, &status, 1) < 1)
- puts("IN: ERROR");
+ puts("STATUS: ERROR");
else
- printf("IN: %d\n", status);
+ printf("STATUS: %d\n", status);
return (status);
}
if (read(infd, command, 1) < 1)
{
- puts("IN: ERROR");
+ puts("STATUS: ERROR");
close(fd);
return (-1);
}
{
status = command[0];
- printf("IN: %d\n", status);
+ printf("STATUS: %d\n", status);
}
/*
if (read(infd, command, 1) < 1)
{
- puts("IN: ERROR");
+ puts("STATUS: ERROR");
close(fd);
return (-1);
}
{
status = command[0];
- printf("IN: %d\n", status);
+ printf("STATUS: %d\n", status);
}
return (status);
static void
usage(void)
{
- puts("Usage: testlpd [options] print-job printer user filename [... filename]");
+ puts("Usage: testlpd [options] print-job printer filename [... filename]");
puts(" testlpd [options] print-waiting [printer or user]");
puts(" testlpd [options] remove-job printer [user [job-id]]");
puts(" testlpd [options] status-long [printer or user]");
/*
- * End of "$Id: testlpd.c 6649 2007-07-11 21:46:42Z mike $".
+ * End of "$Id: testlpd.c 6705 2007-07-20 22:25:31Z mike $".
*/