Skip to content

Commit e3952d3

Browse files
committed
Cleanup, removal of deprecated constants, DEBUG_printf modernization.
1 parent 26836ad commit e3952d3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+7016
-7107
lines changed

backend/dnssd.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,7 @@ main(int argc, /* I - Number of command-line args */
158158
AvahiClient *client; /* Client information */
159159
int error; /* Error code, if any */
160160
#endif /* HAVE_AVAHI */
161-
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
162161
struct sigaction action; /* Actions for POSIX signals */
163-
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
164162

165163

166164
/*
@@ -169,17 +167,11 @@ main(int argc, /* I - Number of command-line args */
169167

170168
setbuf(stderr, NULL);
171169

172-
#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
173-
sigset(SIGTERM, sigterm_handler);
174-
#elif defined(HAVE_SIGACTION)
175170
memset(&action, 0, sizeof(action));
176171

177172
sigemptyset(&action.sa_mask);
178173
action.sa_handler = sigterm_handler;
179174
sigaction(SIGTERM, &action, NULL);
180-
#else
181-
signal(SIGTERM, sigterm_handler);
182-
#endif /* HAVE_SIGSET */
183175

184176
/*
185177
* Check command-line...

backend/ipp.c

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,7 @@ main(int argc, /* I - Number of command-line args */
265265
int fd; /* File descriptor */
266266
off_t bytes = 0; /* Bytes copied */
267267
char buffer[16384]; /* Copy buffer */
268-
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
269268
struct sigaction action; /* Actions for POSIX signals */
270-
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
271269
int version; /* IPP version */
272270
ppd_file_t *ppd = NULL; /* PPD file */
273271
_ppd_cache_t *pc = NULL; /* PPD cache and mapping data */
@@ -284,10 +282,6 @@ main(int argc, /* I - Number of command-line args */
284282
* Ignore SIGPIPE and catch SIGTERM signals...
285283
*/
286284

287-
#ifdef HAVE_SIGSET
288-
sigset(SIGPIPE, SIG_IGN);
289-
sigset(SIGTERM, sigterm_handler);
290-
#elif defined(HAVE_SIGACTION)
291285
memset(&action, 0, sizeof(action));
292286
action.sa_handler = SIG_IGN;
293287
sigaction(SIGPIPE, &action, NULL);
@@ -296,10 +290,6 @@ main(int argc, /* I - Number of command-line args */
296290
sigaddset(&action.sa_mask, SIGTERM);
297291
action.sa_handler = sigterm_handler;
298292
sigaction(SIGTERM, &action, NULL);
299-
#else
300-
signal(SIGPIPE, SIG_IGN);
301-
signal(SIGTERM, sigterm_handler);
302-
#endif /* HAVE_SIGSET */
303293

304294
/*
305295
* Check command-line...
@@ -796,8 +786,8 @@ main(int argc, /* I - Number of command-line args */
796786
* Validate TLS credentials...
797787
*/
798788

799-
cups_array_t *creds; /* TLS credentials */
800-
cups_array_t *lcreds = NULL; /* Loaded credentials */
789+
char *creds; /* TLS credentials */
790+
char *lcreds = NULL; /* Loaded credentials */
801791
http_trust_t trust; /* Trust level */
802792
char credinfo[1024], /* Information on credentials */
803793
lcredinfo[1024];/* Information on saved credentials */
@@ -815,21 +805,23 @@ main(int argc, /* I - Number of command-line args */
815805

816806
fputs("DEBUG: Connection is encrypted.\n", stderr);
817807

818-
if (!httpCopyCredentials(http, &creds))
808+
if ((creds = httpCopyPeerCredentials(http)) != NULL)
819809
{
820-
trust = httpCredentialsGetTrust(creds, hostname);
821-
httpCredentialsString(creds, credinfo, sizeof(credinfo));
810+
trust = cupsGetCredentialsTrust(NULL, hostname, creds);
811+
cupsGetCredentialsInfo(creds, credinfo, sizeof(credinfo));
822812

823813
fprintf(stderr, "DEBUG: %s (%s)\n", trust_msgs[trust], cupsGetErrorString());
824814
fprintf(stderr, "DEBUG: Printer credentials: %s\n", credinfo);
825815

826-
if (!httpLoadCredentials(NULL, &lcreds, hostname))
816+
if ((lcreds = cupsCopyCredentials(NULL, hostname)) != NULL)
827817
{
828-
httpCredentialsString(lcreds, lcredinfo, sizeof(lcredinfo));
818+
cupsGetCredentialsInfo(lcreds, lcredinfo, sizeof(lcredinfo));
829819
fprintf(stderr, "DEBUG: Stored credentials: %s\n", lcredinfo);
830820
}
831821
else
822+
{
832823
fputs("DEBUG: No stored credentials.\n", stderr);
824+
}
833825

834826
update_reasons(NULL, "-cups-pki-invalid,cups-pki-changed,cups-pki-expired,cups-pki-unknown");
835827
if (trusts[trust])
@@ -845,11 +837,11 @@ main(int argc, /* I - Number of command-line args */
845837
* can detect changes...
846838
*/
847839

848-
httpSaveCredentials(NULL, creds, hostname);
840+
cupsSaveCredentials(NULL, hostname, creds, /*key*/NULL);
849841
}
850842

851-
httpFreeCredentials(lcreds);
852-
httpFreeCredentials(creds);
843+
free(lcreds);
844+
free(creds);
853845
}
854846
else
855847
{
@@ -864,8 +856,8 @@ main(int argc, /* I - Number of command-line args */
864856
_cupsLangPrintFilter(stderr, "INFO", _("Connected to printer."));
865857

866858
fprintf(stderr, "DEBUG: Connected to %s:%d...\n",
867-
httpAddrString(http->hostaddr, addrname, sizeof(addrname)),
868-
httpAddrPort(http->hostaddr));
859+
httpAddrGetString(http->hostaddr, addrname, sizeof(addrname)),
860+
httpAddrGetPort(http->hostaddr));
869861

870862
/*
871863
* Build a URI for the printer and fill the standard IPP attributes for

backend/lpd.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
121121
copies; /* Number of copies */
122122
ssize_t bytes = 0; /* Initial bytes read */
123123
char buffer[16384]; /* Initial print buffer */
124-
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
125124
struct sigaction action; /* Actions for POSIX signals */
126-
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
127125
int num_jobopts; /* Number of job options */
128126
cups_option_t *jobopts = NULL; /* Job options */
129127

@@ -138,10 +136,6 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
138136
* Ignore SIGPIPE and catch SIGTERM signals...
139137
*/
140138

141-
#ifdef HAVE_SIGSET
142-
sigset(SIGPIPE, SIG_IGN);
143-
sigset(SIGTERM, sigterm_handler);
144-
#elif defined(HAVE_SIGACTION)
145139
memset(&action, 0, sizeof(action));
146140
action.sa_handler = SIG_IGN;
147141
sigaction(SIGPIPE, &action, NULL);
@@ -150,10 +144,6 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
150144
sigaddset(&action.sa_mask, SIGTERM);
151145
action.sa_handler = sigterm_handler;
152146
sigaction(SIGTERM, &action, NULL);
153-
#else
154-
signal(SIGPIPE, SIG_IGN);
155-
signal(SIGTERM, sigterm_handler);
156-
#endif /* HAVE_SIGSET */
157147

158148
/*
159149
* Check command-line...
@@ -582,7 +572,7 @@ cups_rresvport(int *port, /* IO - Port number to bind to */
582572
* Set the port number...
583573
*/
584574

585-
_httpAddrSetPort(&addr, *port);
575+
httpAddrSetPort(&addr, *port);
586576

587577
/*
588578
* Try binding the port to the socket; return if all is OK...

backend/runloop.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,7 @@ backendRunLoop(
149149
struct timeval timeout; /* Timeout for select() */
150150
time_t curtime, /* Current time */
151151
snmp_update = 0;
152-
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
153152
struct sigaction action; /* Actions for POSIX signals */
154-
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
155153

156154

157155
fprintf(stderr,
@@ -168,17 +166,11 @@ backendRunLoop(
168166

169167
if (!print_fd)
170168
{
171-
#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
172-
sigset(SIGTERM, SIG_IGN);
173-
#elif defined(HAVE_SIGACTION)
174169
memset(&action, 0, sizeof(action));
175170

176171
sigemptyset(&action.sa_mask);
177172
action.sa_handler = SIG_IGN;
178173
sigaction(SIGTERM, &action, NULL);
179-
#else
180-
signal(SIGTERM, SIG_IGN);
181-
#endif /* HAVE_SIGSET */
182174
}
183175
else if (print_fd < 0)
184176
{

backend/snmp.c

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
177177
{
178178
int ipv4, /* SNMP IPv4 socket */
179179
ipv6; /* SNMP IPv6 socket */
180-
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
181180
struct sigaction action; /* Actions for POSIX signals */
182-
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
183181

184182

185183
/*
@@ -202,18 +200,12 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
202200
* Catch SIGALRM signals...
203201
*/
204202

205-
#ifdef HAVE_SIGSET
206-
sigset(SIGALRM, alarm_handler);
207-
#elif defined(HAVE_SIGACTION)
208203
memset(&action, 0, sizeof(action));
209204

210205
sigemptyset(&action.sa_mask);
211206
sigaddset(&action.sa_mask, SIGALRM);
212207
action.sa_handler = alarm_handler;
213208
sigaction(SIGALRM, &action, NULL);
214-
#else
215-
signal(SIGALRM, alarm_handler);
216-
#endif /* HAVE_SIGSET */
217209

218210
/*
219211
* Open the SNMP socket...
@@ -428,10 +420,6 @@ alarm_handler(int sig) /* I - Signal number */
428420

429421
(void)sig;
430422

431-
#if !defined(HAVE_SIGSET) && !defined(HAVE_SIGACTION)
432-
signal(SIGALRM, alarm_handler);
433-
#endif /* !HAVE_SIGSET && !HAVE_SIGACTION */
434-
435423
if (DebugLevel)
436424
backendMessage("DEBUG: ALARM!\n");
437425
}
@@ -1132,7 +1120,7 @@ read_snmp_response(int fd) /* I - SNMP socket file descriptor */
11321120
scheme, sizeof(scheme),
11331121
userpass, sizeof(userpass),
11341122
hostname, sizeof(hostname), &port,
1135-
resource, sizeof(resource)) >= HTTP_URI_OK)
1123+
resource, sizeof(resource)) >= HTTP_URI_STATUS_OK)
11361124
device->uri = strdup((char *)packet.object_value.string.bytes);
11371125
}
11381126
break;
@@ -1328,7 +1316,7 @@ try_connect(http_addr_t *addr, /* I - Socket address */
13281316
return (-1);
13291317
}
13301318

1331-
_httpAddrSetPort(addr, port);
1319+
httpAddrSetPort(addr, port);
13321320

13331321
alarm(1);
13341322

backend/socket.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
7878
ssize_t bytes = 0, /* Initial bytes read */
7979
tbytes; /* Total number of bytes written */
8080
char buffer[1024]; /* Initial print buffer */
81-
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
8281
struct sigaction action; /* Actions for POSIX signals */
83-
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
8482

8583

8684
/*
@@ -93,15 +91,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
9391
* Ignore SIGPIPE signals...
9492
*/
9593

96-
#ifdef HAVE_SIGSET
97-
sigset(SIGPIPE, SIG_IGN);
98-
#elif defined(HAVE_SIGACTION)
9994
memset(&action, 0, sizeof(action));
10095
action.sa_handler = SIG_IGN;
10196
sigaction(SIGPIPE, &action, NULL);
102-
#else
103-
signal(SIGPIPE, SIG_IGN);
104-
#endif /* HAVE_SIGSET */
10597

10698
/*
10799
* Check command-line...

backend/usb.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
130130
username[255], /* Username info (not used) */
131131
resource[1024], /* Resource info (device and options) */
132132
*options; /* Pointer to options */
133-
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
134133
struct sigaction action; /* Actions for POSIX signals */
135-
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
136134

137135

138136
/*
@@ -145,15 +143,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
145143
* Ignore SIGPIPE signals...
146144
*/
147145

148-
#ifdef HAVE_SIGSET
149-
sigset(SIGPIPE, SIG_IGN);
150-
#elif defined(HAVE_SIGACTION)
151146
memset(&action, 0, sizeof(action));
152147
action.sa_handler = SIG_IGN;
153148
sigaction(SIGPIPE, &action, NULL);
154-
#else
155-
signal(SIGPIPE, SIG_IGN);
156-
#endif /* HAVE_SIGSET */
157149

158150
/*
159151
* Check command-line...
@@ -181,7 +173,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
181173
if (httpSeparateURI(HTTP_URI_CODING_ALL, uri,
182174
method, sizeof(method), username, sizeof(username),
183175
hostname, sizeof(hostname), &port,
184-
resource, sizeof(resource)) < HTTP_URI_OK)
176+
resource, sizeof(resource)) < HTTP_URI_STATUS_OK)
185177
{
186178
_cupsLangPrintFilter(stderr, "ERROR",
187179
_("No device URI found in argv[0] or in DEVICE_URI "

berkeley/lpq.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ main(int argc, /* I - Number of command-line arguments */
7878
switch (*opt)
7979
{
8080
case 'E' : /* Encrypt */
81-
cupsSetEncryption(HTTP_ENCRYPT_REQUIRED);
81+
cupsSetEncryption(HTTP_ENCRYPTION_REQUIRED);
8282

8383
if (http)
84-
httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
84+
httpEncryption(http, HTTP_ENCRYPTION_REQUIRED);
8585
break;
8686

8787
case 'U' : /* Username */

berkeley/lpr.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ main(int argc, /* I - Number of command-line arguments */
6969
switch (ch = *opt)
7070
{
7171
case 'E' : /* Encrypt */
72-
cupsSetEncryption(HTTP_ENCRYPT_REQUIRED);
72+
cupsSetEncryption(HTTP_ENCRYPTION_REQUIRED);
7373
break;
7474

7575
case 'U' : /* Username */
@@ -391,11 +391,11 @@ main(int argc, /* I - Number of command-line arguments */
391391
status = cupsStartDocument(CUPS_HTTP_DEFAULT, printer, job_id, NULL,
392392
format, 1);
393393

394-
while (status == HTTP_CONTINUE &&
394+
while (status == HTTP_STATUS_CONTINUE &&
395395
(bytes = read(0, buffer, sizeof(buffer))) > 0)
396396
status = cupsWriteRequestData(CUPS_HTTP_DEFAULT, buffer, (size_t)bytes);
397397

398-
if (status != HTTP_CONTINUE)
398+
if (status != HTTP_STATUS_CONTINUE)
399399
{
400400
_cupsLangPrintf(stderr, _("%s: Error - unable to queue from stdin - %s."),
401401
argv[0], httpStatus(status));

berkeley/lprm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ main(int argc, /* I - Number of command-line arguments */
6666
switch (*opt)
6767
{
6868
case 'E' : /* Encrypt */
69-
cupsSetEncryption(HTTP_ENCRYPT_REQUIRED);
69+
cupsSetEncryption(HTTP_ENCRYPTION_REQUIRED);
7070
break;
7171

7272
case 'P' : /* Cancel jobs on a printer */

0 commit comments

Comments
 (0)