summaryrefslogtreecommitdiff
path: root/support/dktools/dk-blks.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/dk-blks.c
parentac690ca29ad5bf8a5203a65fd6252f7b564f4727 (diff)
CTAN sync 202009200303
Diffstat (limited to 'support/dktools/dk-blks.c')
-rw-r--r--support/dktools/dk-blks.c147
1 files changed, 71 insertions, 76 deletions
diff --git a/support/dktools/dk-blks.c b/support/dktools/dk-blks.c
index 80a5ae9a9b..1aa17e421c 100644
--- a/support/dktools/dk-blks.c
+++ b/support/dktools/dk-blks.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: dk-blks.ctr
+Copyright (C) 2015-2020, Dirk Krause
+SPDX-License-Identifier: BSD-3-Clause
*/
/*
-Copyright (C) 2015-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: dk-blks.ctr
*/
@@ -119,12 +97,16 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "dk4numco.h"
#include "dk4fdrde.h"
#include "dk4fdwre.h"
+#include "dk4unused.h"
+#ifndef DK4WMAIN_H_INCLUDED
+#include "dk4wmain.h"
+#endif
-#line 98 "dk-blks.ctr"
+#line 102 "dk-blks.ctr"
@@ -154,12 +136,12 @@ dkT("--manual\t*** SHOW FULL MANUAL. ***"),
dkT("--version\tShow version information."),
dkT("--license\tShow license information."),
dkT(""),
-dkT("http://dktools.sourceforge.net"),
+dkT("http://sourceforge.net/p/dktools/wiki/dk-blks/"),
dkT(""),
NULL
-#line 131 "dk-blks.ctr"
+#line 135 "dk-blks.ctr"
};
@@ -170,7 +152,8 @@ dkT("This software uses code from the following projects, either directly or as"
dkT("a library:"),
dkT(""),
dkT("dktools\t\tDirk Krause's tools and libraries."),
-dkT("\t\tSee http://dktools.sourceforge.net/ for more information."),
+dkT("\t\tSee http://sourceforge.net/p/dktools/wiki/Home/"),
+dkT("\t\tfor more information."),
#if DK4_HAVE_ZLIB_H
dkT(""),
dkT("zlib\t\tData compression library."),
@@ -197,27 +180,28 @@ dkT(""),
dkT("Redistribution and use in source and binary forms, with or without"),
dkT("modification, are permitted provided that the following conditions are met:"),
dkT(""),
-dkT("* Redistributions of source code must retain the above copyright notice,"),
-dkT(" this list of conditions and the following disclaimer."),
-dkT("* Redistributions in binary form must reproduce the above copyright"),
-dkT(" notice, this list of conditions and the following disclaimer in the"),
-dkT(" documentation and/or other materials provided with the distribution."),
-dkT("* Neither the name of the Dirk Krause nor the names of contributors may be"),
-dkT(" used to endorse or promote products derived from this software without"),
-dkT(" specific prior written permission."),
-dkT(""),
-dkT("THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\""),
-dkT("AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE"),
-dkT("IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE"),
-dkT("ARE DISCLAIMED."),
-dkT(""),
-dkT("IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,"),
-dkT("INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,"),
-dkT("BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,"),
-dkT("DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY"),
-dkT("OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING"),
-dkT("NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,"),
-dkT("EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."),
+dkT("1. Redistributions of source code must retain the above copyright notice,"),
+dkT(" this list of conditions and the following disclaimer."),
+dkT("2. Redistributions in binary form must reproduce the above copyright"),
+dkT(" notice, this list of conditions and the following disclaimer in the"),
+dkT(" documentation and/or other materials provided with the distribution."),
+dkT("3. Neither the name of the copyright holder nor the names of its"),
+dkT(" contributors may be used to endorse or promote products derived from"),
+dkT(" this software without specific prior written permission."),
+dkT(""),
+dkT("THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS"),
+dkT("``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT"),
+dkT("LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR"),
+dkT("A PARTICULAR PURPOSE ARE DISCLAIMED."),
+dkT("IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY"),
+dkT("DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES"),
+dkT("(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR"),
+dkT("SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER"),
+dkT("CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT"),
+dkT("LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY"),
+dkT("OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF"),
+dkT("SUCH DAMAGE."),
+dkT(""),
#if DK4_HAVE_ZLIB_H
dkT(""),
dkT(""),
@@ -291,7 +275,7 @@ dkT(""),
NULL
-#line 261 "dk-blks.ctr"
+#line 267 "dk-blks.ctr"
};
@@ -330,7 +314,7 @@ dkT("stdout"),
NULL
-#line 300 "dk-blks.ctr"
+#line 306 "dk-blks.ctr"
};
@@ -372,7 +356,7 @@ dkT("\" ignored!"),
NULL
-#line 347 "dk-blks.ctr"
+#line 353 "dk-blks.ctr"
};
@@ -464,8 +448,9 @@ sig_pass_pointer(DK4_VOLATILE dk4_sig_atomic_t *ptr)
*/
static
void
-sig_handler_pipe(int signo)
+sig_handler_pipe(int DK4_ARG_UNUSED(signo) )
{
+ DK4_UNUSED_ARG(signo)
*sig_pass_pointer(&sig_had_pipe) = 1;
}
#endif
@@ -475,8 +460,9 @@ sig_handler_pipe(int signo)
*/
static
void
-sig_handler_int(int signo)
+sig_handler_int(int DK4_ARG_UNUSED(signo) )
{
+ DK4_UNUSED_ARG(signo)
*sig_pass_pointer(&sig_had_int) = 1;
}
@@ -485,8 +471,9 @@ sig_handler_int(int signo)
*/
static
void
-sig_handler_term(int signo)
+sig_handler_term(int DK4_ARG_UNUSED(signo) )
{
+ DK4_UNUSED_ARG(signo)
*sig_pass_pointer(&sig_had_term) = 1;
}
@@ -510,10 +497,18 @@ sig_read_atomic(DK4_VOLATILE dk4_sig_atomic_t *ap)
*/
static
int
-sig_can_continue(int check_pipe)
+sig_can_continue(
+#ifdef SIGPIPE
+int check_pipe
+#else
+int DK4_ARG_UNUSED(check_pipe)
+#endif
+)
{
int back = 1;
-#ifdef SIGPIPE
+#ifndef SIGPIPE
+ DK4_UNUSED_ARG(check_pipe)
+#else
if (0 != check_pipe) {
if (0 != sig_read_atomic(&sig_had_pipe)) { back = 0; }
}
@@ -546,7 +541,7 @@ dk_blks_transfer(char *ib, char *ob, size_t bs)
dk4_sig_atomic_t shp; /* Had pipe */
-#line 519 "dk-blks.ctr"
+#line 536 "dk-blks.ctr"
/* Process input
*/
exval = EXIT_SUCCESS;
@@ -554,7 +549,7 @@ dk_blks_transfer(char *ib, char *ob, size_t bs)
if (1 == sig_can_continue(0)) {
errno = 0;
-#line 525 "dk-blks.ctr"
+#line 542 "dk-blks.ctr"
#if DK4_ON_WINDOWS
rdres = _read(0, ib, (unsigned)bs);
#else
@@ -562,7 +557,7 @@ dk_blks_transfer(char *ib, char *ob, size_t bs)
#endif
if (0 < rdres) {
-#line 531 "dk-blks.ctr"
+#line 548 "dk-blks.ctr"
irdb = rdres;
iused = 0;
while(iused < irdb) {
@@ -594,7 +589,7 @@ dk_blks_transfer(char *ib, char *ob, size_t bs)
wrres = write(1, ob, bs);
#endif
if (0 <= wrres) {
- if (wrres < bs) {
+ if (((size_t)wrres) < bs) {
/* ERROR: Not all bytes written */
dk4app_log_1(app, dk_blks_msg, sz_msg, DK4_LL_ERROR, 0);
exval = EXIT_FAILURE;
@@ -613,11 +608,11 @@ dk_blks_transfer(char *ib, char *ob, size_t bs)
} else {
if (0 == rdres) {
-#line 580 "dk-blks.ctr"
+#line 597 "dk-blks.ctr"
cc = 0;
} else {
-#line 582 "dk-blks.ctr"
+#line 599 "dk-blks.ctr"
/* ERROR: Read operation failed */
dk4fd_read_error_msg(app, kwnl[3], errno);
cc = 0;
@@ -650,7 +645,7 @@ dk_blks_transfer(char *ib, char *ob, size_t bs)
wrres = write(1, ob, oused);
#endif
if (0 <= wrres) {
- if (wrres < oused) {
+ if (((size_t)wrres) < oused) {
/* ERROR: Not all bytes written */
dk4app_log_1(app, dk_blks_msg, sz_msg, DK4_LL_ERROR, 0);
exval = EXIT_FAILURE;
@@ -679,7 +674,7 @@ dk_blks_transfer(char *ib, char *ob, size_t bs)
-#line 642 "dk-blks.ctr"
+#line 659 "dk-blks.ctr"
}
@@ -722,7 +717,7 @@ dk_blks_normal_run(void)
int res = 0;
-#line 683 "dk-blks.ctr"
+#line 700 "dk-blks.ctr"
if (0 != dk4app_opt_is_set_short(app, dkT('b'), NULL)) {
res = dk4app_opt_get_size_short(&mybs, app, dkT('b'), NULL);
if (0 == res) {
@@ -753,7 +748,7 @@ dk_blks_normal_run(void)
}
-#line 712 "dk-blks.ctr"
+#line 729 "dk-blks.ctr"
}
@@ -960,10 +955,10 @@ int main(int argc, char *argv[])
int i;
-#line 917 "dk-blks.ctr"
+#line 934 "dk-blks.ctr"
-#line 918 "dk-blks.ctr"
+#line 935 "dk-blks.ctr"
app = dk4app_open_cmd(
argc, argv, options, sz_options, kwnl[0], DKT_VERSION_DK,
kwnl[1], help_text, license_text
@@ -1003,10 +998,10 @@ int main(int argc, char *argv[])
}
-#line 956 "dk-blks.ctr"
+#line 973 "dk-blks.ctr"
-#line 957 "dk-blks.ctr"
+#line 974 "dk-blks.ctr"
exit(exval); return exval;
}