summaryrefslogtreecommitdiff
path: root/support/dktools/dk3print.c
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-09-20 03:03:26 +0000
committerNorbert Preining <norbert@preining.info>2020-09-20 03:03:26 +0000
commit1f457376b478257b88d4a857f5ec1b6155442dd7 (patch)
tree2a06a60551dea362cf8cb0cb0ba66c78608717c4 /support/dktools/dk3print.c
parentac690ca29ad5bf8a5203a65fd6252f7b564f4727 (diff)
CTAN sync 202009200303
Diffstat (limited to 'support/dktools/dk3print.c')
-rw-r--r--support/dktools/dk3print.c124
1 files changed, 54 insertions, 70 deletions
diff --git a/support/dktools/dk3print.c b/support/dktools/dk3print.c
index f9c489ceb5..f39c12ddca 100644
--- a/support/dktools/dk3print.c
+++ b/support/dktools/dk3print.c
@@ -1,36 +1,14 @@
/*
- WARNING: This file was generated by dkct.
- Changes you make here will be lost if dkct is run again!
- You should modify the original source and run dkct on it.
- Original source: dk3print.ctr
+Copyright (C) 2013-2020, Dirk Krause
+SPDX-License-Identifier: BSD-3-Clause
*/
/*
-Copyright (C) 2013-2017, Dirk Krause
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-* Redistributions in binary form must reproduce the above opyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-* Neither the name of the author nor the names of contributors may be used
- to endorse or promote products derived from this software without specific
- prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED.
-IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
-DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ WARNING: This file was generated by the dkct program (see
+ http://dktools.sourceforge.net/ for details).
+ Changes you make here will be lost if dkct is run again!
+ You should modify the original source and run dkct on it.
+ Original source: dk3print.ctr
*/
/** @file dk3print.c The dk3print module.
@@ -45,12 +23,13 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "dk3print.h"
#include "dk3prcfg.h"
#include "dk3prreq.h"
+#include "dk3unused.h"
-#line 147 "dk3print.ctr"
+#line 148 "dk3print.ctr"
@@ -81,7 +60,7 @@ dkT("%d"),
NULL
-#line 183 "dk3print.ctr"
+#line 184 "dk3print.ctr"
};
@@ -311,7 +290,7 @@ dkT("Line outside scope, not belonging to printer or host!"),
NULL
-#line 415 "dk3print.ctr"
+#line 416 "dk3print.ctr"
};
@@ -321,12 +300,12 @@ dk3print_win_det_cleanup(dk3_printer_windows_details_t *ptr)
{
-#line 423 "dk3print.ctr"
+#line 424 "dk3print.ctr"
if(ptr) {
}
-#line 426 "dk3print.ctr"
+#line 427 "dk3print.ctr"
}
@@ -336,14 +315,14 @@ dk3print_lprng_det_cleanup(dk3_printer_lprng_details_t *ptr)
{
-#line 434 "dk3print.ctr"
+#line 435 "dk3print.ctr"
if(ptr) {
dk3_release(ptr->hostname);
dk3_release(ptr->queuename);
}
-#line 439 "dk3print.ctr"
+#line 440 "dk3print.ctr"
}
@@ -353,7 +332,7 @@ dk3print_socket_det_cleanup(dk3_printer_socket_t *ptr)
{
-#line 447 "dk3print.ctr"
+#line 448 "dk3print.ctr"
if(ptr) {
dk3_release(ptr->hostname);
ptr->portno = 0;
@@ -361,7 +340,7 @@ dk3print_socket_det_cleanup(dk3_printer_socket_t *ptr)
}
-#line 453 "dk3print.ctr"
+#line 454 "dk3print.ctr"
}
@@ -371,7 +350,7 @@ dk3print_det_cleanup(int tp, dk3_printer_details_t *ptr)
{
-#line 461 "dk3print.ctr"
+#line 462 "dk3print.ctr"
if(ptr) {
switch(tp) {
case DK3_PRINTER_TYPE_WINDOWS: {
@@ -390,7 +369,7 @@ dk3print_det_cleanup(int tp, dk3_printer_details_t *ptr)
}
-#line 478 "dk3print.ctr"
+#line 479 "dk3print.ctr"
}
@@ -400,7 +379,7 @@ dk3print_printer_delete(dk3_printer_t *ptr)
{
-#line 486 "dk3print.ctr"
+#line 487 "dk3print.ctr"
if(ptr) {
dk3print_det_cleanup(ptr->t_p, &(ptr->det_p));
dk3print_det_cleanup(ptr->t_s, &(ptr->det_s));
@@ -410,7 +389,7 @@ dk3print_printer_delete(dk3_printer_t *ptr)
dk3_delete(ptr);
}
-#line 494 "dk3print.ctr"
+#line 495 "dk3print.ctr"
}
@@ -460,7 +439,7 @@ dk3print_alias_delete(dk3_printer_alias_t *ptr)
{
-#line 542 "dk3print.ctr"
+#line 543 "dk3print.ctr"
if(ptr) {
dk3_release(ptr->name);
ptr->printer = NULL;
@@ -468,7 +447,7 @@ dk3print_alias_delete(dk3_printer_alias_t *ptr)
}
-#line 548 "dk3print.ctr"
+#line 549 "dk3print.ctr"
}
@@ -478,14 +457,14 @@ dk3print_host_delete(dk3_print_host_t *ptr)
{
-#line 556 "dk3print.ctr"
+#line 557 "dk3print.ctr"
if(ptr) {
dk3_release(ptr->name);
dk3_delete(ptr);
}
-#line 561 "dk3print.ctr"
+#line 562 "dk3print.ctr"
}
@@ -536,7 +515,7 @@ dk3print_host_alias_delete(dk3_print_host_alias_t *ptr)
{
-#line 610 "dk3print.ctr"
+#line 611 "dk3print.ctr"
if(ptr) {
dk3_release(ptr->name);
ptr->host = NULL;
@@ -544,7 +523,7 @@ dk3print_host_alias_delete(dk3_print_host_alias_t *ptr)
}
-#line 616 "dk3print.ctr"
+#line 617 "dk3print.ctr"
}
@@ -556,7 +535,7 @@ dk3print_conf_delete(dk3_print_conf_t *pc)
-#line 626 "dk3print.ctr"
+#line 627 "dk3print.ctr"
if(pc) {
pc->defPrinter = NULL;
pc->defHost = NULL;
@@ -605,7 +584,7 @@ dk3print_conf_delete(dk3_print_conf_t *pc)
dk3_delete(pc);
}
-#line 673 "dk3print.ctr"
+#line 674 "dk3print.ctr"
}
@@ -849,7 +828,7 @@ dk3print_config_new(dk3_app_t *app)
int ok = 0; /* Flag: Success. */
-#line 915 "dk3print.ctr"
+#line 916 "dk3print.ctr"
if(app) {
back = dk3_new_app(dk3_print_conf_t,1,app);
if(back) {
@@ -903,7 +882,7 @@ dk3print_config_new(dk3_app_t *app)
}
}
-#line 967 "dk3print.ctr"
+#line 968 "dk3print.ctr"
return back;
}
@@ -984,7 +963,7 @@ dk3print_read_system(dk3_print_conf_t *pc)
int back = 1;
-#line 1046 "dk3print.ctr"
+#line 1047 "dk3print.ctr"
cbNeeded = cbReturned = szPeb = (DWORD)0UL;
#if DK3_CHAR_SIZE > 1
EnumPrintersW(PRINTER_ENUM_LOCAL,NULL,2,NULL,szPeb,&cbNeeded,&cbReturned);
@@ -1007,7 +986,11 @@ dk3print_read_system(dk3_print_conf_t *pc)
#endif
if(res) {
if((DWORD)0UL < cbReturned) {
- pi2 = (PRINTER_INFO_2 *)peb;
+#if DK3_CHAR_SIZE > 1
+ pi2 = (PRINTER_INFO_2W *)peb;
+#else
+ pi2 = (PRINTER_INFO_2A *)peb;
+#endif
for(i = (DWORD)0UL; i < cbReturned; i++) {
printer = dk3print_printer_new(pc, pi2->pPrinterName);
if(printer) {
@@ -1025,17 +1008,17 @@ dk3print_read_system(dk3_print_conf_t *pc)
}
} else {
-#line 1085 "dk3print.ctr"
+#line 1090 "dk3print.ctr"
}
} else {
-#line 1087 "dk3print.ctr"
+#line 1092 "dk3print.ctr"
back = 0;
}
dk3_delete(peb);
} else {
-#line 1091 "dk3print.ctr"
+#line 1096 "dk3print.ctr"
back = 0;
}
if(back) {
@@ -1060,11 +1043,11 @@ dk3print_read_system(dk3_print_conf_t *pc)
}
} else {
-#line 1114 "dk3print.ctr"
+#line 1119 "dk3print.ctr"
}
-#line 1116 "dk3print.ctr"
+#line 1121 "dk3print.ctr"
return back;
}
@@ -1079,16 +1062,17 @@ dk3print_read_system(dk3_print_conf_t *pc)
*/
static
int
-dk3print_read_system(dk3_print_conf_t *pc)
+dk3print_read_system(dk3_print_conf_t * DK3_ARG_UNUSED(pc) )
{
int back = 1;
-#line 1134 "dk3print.ctr"
+#line 1139 "dk3print.ctr"
+ DK3_UNUSED_ARG(pc)
/* ##### Read /etc/printcap */
-#line 1136 "dk3print.ctr"
+#line 1142 "dk3print.ctr"
return back;
}
@@ -1111,7 +1095,7 @@ dk3print_read_configuration(dk3_print_conf_t *pc, int useConfigFiles)
-#line 1157 "dk3print.ctr"
+#line 1163 "dk3print.ctr"
/* Find default PS level from preferences */
if(pc->app) {
if(dk3app_get_pref(pc->app, dk3print_nl[5], buf, DK3_SIZEOF(buf,dkChar))) {
@@ -1144,7 +1128,7 @@ dk3print_read_configuration(dk3_print_conf_t *pc, int useConfigFiles)
}
}
-#line 1188 "dk3print.ctr"
+#line 1194 "dk3print.ctr"
return back;
}
@@ -1156,7 +1140,7 @@ dk3print_conf_open(dk3_app_t *app, int useConfigFiles)
dk3_print_conf_t *back = NULL;
-#line 1198 "dk3print.ctr"
+#line 1204 "dk3print.ctr"
if(app) {
back = dk3print_config_new(app);
if(back) {
@@ -1167,7 +1151,7 @@ dk3print_conf_open(dk3_app_t *app, int useConfigFiles)
}
}
-#line 1207 "dk3print.ctr"
+#line 1213 "dk3print.ctr"
return back;
}
@@ -1178,12 +1162,12 @@ dk3print_conf_close(dk3_print_conf_t *pc)
{
-#line 1216 "dk3print.ctr"
+#line 1222 "dk3print.ctr"
if(pc) {
dk3print_conf_delete(pc);
}
-#line 1219 "dk3print.ctr"
+#line 1225 "dk3print.ctr"
}
@@ -1193,7 +1177,7 @@ dk3print_set_det(dk3_printer_details_t *det, int tp)
{
-#line 1227 "dk3print.ctr"
+#line 1233 "dk3print.ctr"
if(det) {
switch(tp) {
case DK3_PRINTER_TYPE_WINDOWS: {
@@ -1219,7 +1203,7 @@ dk3print_set_det(dk3_printer_details_t *det, int tp)
}
}
-#line 1251 "dk3print.ctr"
+#line 1257 "dk3print.ctr"
}