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

Function main

filter/commandtops.c:34–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32 */
33
34int /* O - Exit status */
35main(int argc, /* I - Number of command-line arguments */
36 char *argv[]) /* I - Command-line arguments */
37{
38 int status = 0; /* Exit status */
39 cups_file_t *fp; /* Command file */
40 char line[1024], /* Line from file */
41 *value; /* Value on line */
42 int linenum; /* Line number in file */
43 ppd_file_t *ppd; /* PPD file */
44
45
46 /*
47 * Check for valid arguments...
48 */
49
50 if (argc != 6 && argc != 7)
51 {
52 /*
53 * We don't have the correct number of arguments; write an error message
54 * and return.
55 */
56
57 _cupsLangPrintf(stderr,
58 _("Usage: %s job-id user title copies options [file]"),
59 argv[0]);
60 return (1);
61 }
62
63 /*
64 * Open the PPD file...
65 */
66
67 if ((ppd = ppdOpenFile(getenv("PPD"))) == NULL)
68 {
69 fputs("ERROR: Unable to open PPD file!\n", stderr);
70 return (1);
71 }
72
73 /*
74 * Open the command file as needed...
75 */
76
77 if (argc == 7)
78 {
79 if ((fp = cupsFileOpen(argv[6], "r")) == NULL)
80 {
81 perror("ERROR: Unable to open command file - ");
82 return (1);
83 }
84 }
85 else
86 fp = cupsFileStdin();
87
88 /*
89 * Read the commands from the file and send the appropriate commands...
90 */
91

Callers

nothing calls this directly

Calls 10

_cupsLangPrintfFunction · 0.85
ppdOpenFileFunction · 0.85
cupsFileOpenFunction · 0.85
cupsFileStdinFunction · 0.85
cupsFileGetConfFunction · 0.85
_cups_strcasecmpFunction · 0.85
auto_configureFunction · 0.85
print_self_test_pageFunction · 0.85
report_levelsFunction · 0.85
_cupsLangPrintFilterFunction · 0.85

Tested by

no test coverage detected