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

Function main

backend/usb.c:120–247  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118 */
119
120int /* O - Exit status */
121main(int argc, /* I - Number of command-line arguments (6 or 7) */
122 char *argv[]) /* I - Command-line arguments */
123{
124 int print_fd; /* Print file */
125 int copies; /* Number of copies to print */
126 int status; /* Exit status */
127 int port; /* Port number (not used) */
128 const char *uri; /* Device URI */
129 char method[255], /* Method in URI */
130 hostname[1024], /* Hostname */
131 username[255], /* Username info (not used) */
132 resource[1024], /* Resource info (device and options) */
133 *options; /* Pointer to options */
134#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
135 struct sigaction action; /* Actions for POSIX signals */
136#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
137
138
139 /*
140 * Make sure status messages are not buffered...
141 */
142
143 setbuf(stderr, NULL);
144
145 /*
146 * Ignore SIGPIPE signals...
147 */
148
149#ifdef HAVE_SIGSET
150 sigset(SIGPIPE, SIG_IGN);
151#elif defined(HAVE_SIGACTION)
152 memset(&action, 0, sizeof(action));
153 action.sa_handler = SIG_IGN;
154 sigaction(SIGPIPE, &action, NULL);
155#else
156 signal(SIGPIPE, SIG_IGN);
157#endif /* HAVE_SIGSET */
158
159 /*
160 * Check command-line...
161 */
162
163 if (argc == 1)
164 {
165 list_devices();
166 return (CUPS_BACKEND_OK);
167 }
168 else if (argc != 6 && argc != 7)
169 {
170 _cupsLangPrintf(stderr,
171 _("Usage: %s job-id user title copies options [file]"),
172 argv[0]);
173 return (CUPS_BACKEND_FAILED);
174 }
175
176 /*
177 * Extract the device name and options from the URI...

Callers

nothing calls this directly

Calls 8

_cupsLangPrintfFunction · 0.85
cupsBackendDeviceURIFunction · 0.85
httpSeparateURIFunction · 0.85
_cupsLangPrintFilterFunction · 0.85
_cupsLangPrintErrorFunction · 0.85
sigactionClass · 0.70
list_devicesFunction · 0.70
print_deviceFunction · 0.70

Tested by

no test coverage detected