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

Function main

notifier/dbus.c:166–580  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164 */
165
166int /* O - Exit status */
167main(int argc, /* I - Number of command-line args */
168 char *argv[]) /* I - Command-line arguments */
169{
170 ipp_t *msg; /* Event message from scheduler */
171 ipp_state_t state; /* IPP event state */
172 struct sigaction action; /* POSIX sigaction data */
173 DBusConnection *con = NULL; /* Connection to DBUS server */
174 DBusError error; /* Error, if any */
175 DBusMessage *message; /* Message to send */
176 DBusMessageIter iter; /* Iterator for message data */
177 int lock_fd = -1; /* Lock file descriptor */
178
179
180 /*
181 * Don't buffer stderr...
182 */
183
184 setbuf(stderr, NULL);
185
186 /*
187 * Ignore SIGPIPE signals...
188 */
189
190 memset(&action, 0, sizeof(action));
191 action.sa_handler = SIG_IGN;
192 sigaction(SIGPIPE, &action, NULL);
193
194 /*
195 * Validate command-line options...
196 */
197
198 if (argc != 3)
199 {
200 fputs("Usage: dbus dbus:/// notify-user-data\n", stderr);
201 return (1);
202 }
203
204 if (strncmp(argv[1], "dbus:", 5))
205 {
206 fprintf(stderr, "ERROR: Bad URI \"%s\"!\n", argv[1]);
207 return (1);
208 }
209
210 /*
211 * Loop forever until we run out of events...
212 */
213
214 for (;;)
215 {
216 ipp_attribute_t *attr; /* Current attribute */
217 const char *event; /* Event name */
218 const char *signame = NULL;/* DBUS signal name */
219 char *printer_reasons = NULL;
220 /* Printer reasons string */
221 char *job_reasons = NULL;
222 /* Job reasons string */
223 const char *nul = ""; /* Empty string value */

Callers

nothing calls this directly

Calls 11

ippNewFunction · 0.85
ippReadFileFunction · 0.85
ippDeleteFunction · 0.85
acquire_lockFunction · 0.85
ippFindAttributeFunction · 0.85
ippGetStringFunction · 0.85
ippGetIntegerFunction · 0.85
ippGetCountFunction · 0.85
ippGetBooleanFunction · 0.85
release_lockFunction · 0.85
sigactionClass · 0.70

Tested by

no test coverage detected