Skip to content

Commit de18b75

Browse files
committed
ppdTest(): Do not handle command line errors of testppdfile
The command line utility testppdfile has to handle its command line syntax by itself, not the library function ppdTest(). ppdTest() is not only used by testppdfile but by many other clients, too.
1 parent f259f96 commit de18b75

3 files changed

Lines changed: 10 additions & 41 deletions

File tree

ppd/ppd-test.c

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,6 @@ int ppdTest(int ignore, // Which errors to ignore
109109
char *rootdir, // What is the root directory if mentioned
110110
int verbose, // Want verbose output?
111111
int relaxed, // If relaxed mode is to be used
112-
int q_with_v, // If q is used together with v in the command
113-
// line
114-
int v_with_q, // If v is used together with q in the command
115-
// line
116112
int root_present, // Whether root directory is specified
117113
int files, // Number of files
118114
cups_array_t *file_array, // Array consisting of filenames of the
@@ -178,30 +174,6 @@ int ppdTest(int ignore, // Which errors to ignore
178174
if (relaxed == 1)
179175
ppdSetConformance(PPD_CONFORM_RELAXED);
180176

181-
if (q_with_v == 1)
182-
{
183-
snprintf(str_format, sizeof(str_format) - 1,
184-
"ppdTest: The -q option is incompatible with the -v option.");
185-
if (*report)
186-
cupsArrayAdd(*report, (void *)str_format);
187-
if (log) log(ld, CF_LOGLEVEL_ERROR, "ppdTest: %s", str_format);
188-
return (-1);
189-
190-
}
191-
192-
if (v_with_q == 1)
193-
{
194-
195-
snprintf(str_format, sizeof(str_format) - 1,
196-
"ppdTest: The -v option is incompatible with the -q option.");
197-
if (*report)
198-
cupsArrayAdd(*report, (void *)str_format);
199-
if (log) log(ld, CF_LOGLEVEL_ERROR, "ppdTest: %s", str_format);
200-
201-
return (-1);
202-
203-
}
204-
205177
//
206178
// Open the PPD file...
207179
//

ppd/ppd.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -896,8 +896,7 @@ extern cf_cmyk_t *ppdCMYKLoad(ppd_file_t *ppd,
896896
// **** New in libppd 2.0.0: Function to check the correctness
897897
// of PPD files, originally cupstestppd of CUPS ****
898898
extern int ppdTest(int ignore, int warn, char *rootdir,
899-
int verbose, int relaxed, int q_with_v,
900-
int v_with_q, int root_present, int files,
899+
int verbose, int relaxed, int root_present, int files,
901900
cups_array_t *file_array, cups_array_t **report,
902901
cf_logfunc_t log, void *ld);
903902

ppd/testppdfile.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,13 @@ usage()
3131
fprintf(stderr, "-W {all, none, constraints, defaults, duplex, filters,\n"
3232
" profiles, sizes, translations}\n"
3333
" Issue warnings instead of errors\n");
34-
fprintf(stderr, "-q Run silently\n");
34+
fprintf(stderr, "-q Run silently (not to be used\n"
35+
" together with -v)\n");
3536
fprintf(stderr, "-r Use 'relaxed' open mode\n");
36-
fprintf(stderr, "-v Be verbose\n");
37-
fprintf(stderr, "-vv Be very verbose\n\n");
37+
fprintf(stderr, "-v Be verbose (not to be used\n"
38+
" together with -q)\n");
39+
fprintf(stderr, "-vv Be very verbose (not to be used\n"
40+
" together with -q)\n\n");
3841
}
3942

4043

@@ -51,10 +54,6 @@ int main(int argc, // I - Number of command-line args
5154
char *rootdir = ""; // What is the root directory if mentioned
5255
int help = 0; // Whether to run help dialog
5356
char *opt; // Option character
54-
int q_with_v = 0; // If q is used together with v in the
55-
// command line
56-
int v_with_q = 0; // If v is used together with q in the
57-
// command line
5857
int relaxed = 0; // If relaxed mode is to be used
5958
cups_array_t *file_array; // Array consisting of filenames of the ppd
6059
// files to be checked
@@ -138,7 +137,7 @@ int main(int argc, // I - Number of command-line args
138137
case 'q': // Quiet mode
139138

140139
if (verbose > 0)
141-
q_with_v = 1;
140+
help = 1;
142141
verbose --;
143142
break;
144143

@@ -147,7 +146,7 @@ int main(int argc, // I - Number of command-line args
147146

148147
case 'v': // Verbose mode
149148
if (verbose < 0)
150-
v_with_q = 1;
149+
help = 1;
151150

152151
verbose ++;
153152
break;
@@ -168,8 +167,7 @@ int main(int argc, // I - Number of command-line args
168167
return (0);
169168
}
170169

171-
result = ppdTest(ignore, warn, rootdir, verbose,
172-
relaxed, q_with_v, v_with_q, root_present, files,
170+
result = ppdTest(ignore, warn, rootdir, verbose, relaxed, root_present, files,
173171
file_array, &report, NULL, NULL);
174172

175173
if (result == 1 && files > 0) puts("PPD PASSED");

0 commit comments

Comments
 (0)