MCPcopy Create free account
hub / github.com/OpenPrinting/cups / main

Function main

notifier/testnotify.c:29–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27 */
28
29int /* O - Exit status */
30main(int argc, /* I - Number of command-line arguments */
31 char *argv[]) /* I - Command-line arguments */
32{
33 int i; /* Looping var */
34 ipp_t *event; /* Event from scheduler */
35 ipp_state_t state; /* IPP event state */
36
37
38 setbuf(stderr, NULL);
39
40 fprintf(stderr, "DEBUG: argc=%d\n", argc);
41 for (i = 0; i < argc; i ++)
42 fprintf(stderr, "DEBUG: argv[%d]=\"%s\"\n", i, argv[i]);
43 fprintf(stderr, "DEBUG: TMPDIR=\"%s\"\n", getenv("TMPDIR"));
44
45 for (;;)
46 {
47 event = ippNew();
48 while ((state = ippReadFile(0, event)) != IPP_DATA)
49 {
50 if (state <= IPP_IDLE)
51 break;
52 }
53
54 if (state == IPP_ERROR)
55 fputs("DEBUG: ippReadFile() returned IPP_ERROR!\n", stderr);
56
57 if (state <= IPP_IDLE)
58 {
59 ippDelete(event);
60 return (0);
61 }
62
63 print_attributes(event, 4);
64 ippDelete(event);
65
66 /*
67 * If the recipient URI is "testnotify://nowait", then we exit after each
68 * event...
69 */
70
71 if (!strcmp(argv[1], "testnotify://nowait"))
72 return (0);
73 }
74}
75
76
77/*

Callers

nothing calls this directly

Calls 4

ippNewFunction · 0.85
ippReadFileFunction · 0.85
ippDeleteFunction · 0.85
print_attributesFunction · 0.70

Tested by

no test coverage detected