| 164 | */ |
| 165 | |
| 166 | int /* O - Exit status */ |
| 167 | main(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 */ |
nothing calls this directly
no test coverage detected