diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2018-07-21 16:47:08 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2018-07-21 16:47:08 +0000 |
commit | fbd5d278b4ead5c3d7941bc7a4bbecc7bf684f61 (patch) | |
tree | 616522f8e0496c9b170f4467cdaffb426ffb84a3 | |
parent | 68990372b2a0eb3cdf998933dc0d01b76a0ebe85 (diff) | |
download | s6-portable-utils-fbd5d278b4ead5c3d7941bc7a4bbecc7bf684f61.tar.xz |
Adapt to skalibs-2.7.0.0
-rw-r--r-- | COPYING | 2 | ||||
-rw-r--r-- | INSTALL | 2 | ||||
-rw-r--r-- | NEWS | 6 | ||||
-rw-r--r-- | doc/index.html | 4 | ||||
-rw-r--r-- | doc/upgrade.html | 6 | ||||
-rw-r--r-- | package/info | 2 | ||||
-rw-r--r-- | src/skaembutils/s6-grep.c | 20 | ||||
-rw-r--r-- | src/skaembutils/s6-ln.c | 3 | ||||
-rw-r--r-- | src/skaembutils/s6-update-symlinks.c | 14 |
9 files changed, 31 insertions, 28 deletions
@@ -1,4 +1,4 @@ -Copyright (c) 2011-2017 Laurent Bercot <ska-skaware@skarnet.org> +Copyright (c) 2011-2018 Laurent Bercot <ska-skaware@skarnet.org> Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -6,7 +6,7 @@ Build Instructions - A POSIX-compliant C development environment - GNU make version 3.81 or later - - skalibs version 2.6.0.0 or later: http://skarnet.org/software/skalibs/ + - skalibs version 2.7.0.0 or later: http://skarnet.org/software/skalibs/ This software will run on any operating system that implements POSIX.1-2008, available at: @@ -1,5 +1,11 @@ Changelog for s6-portable-utils. +In 2.2.1.2 +---------- + + - Adaptation to skalibs-2.7.0.0. + + In 2.2.1.1 ---------- diff --git a/doc/index.html b/doc/index.html index 76d4bcc..444ac7b 100644 --- a/doc/index.html +++ b/doc/index.html @@ -61,7 +61,7 @@ the package is now used to host specific utilities such as <li> A POSIX-compliant system with a standard C development environment </li> <li> GNU make, version 3.81 or later </li> <li> <a href="//skarnet.org/software/skalibs/">skalibs</a> version -2.6.0.0 or later. It's a build-time requirement. It's also a run-time +2.7.0.0 or later. It's a build-time requirement. It's also a run-time requirement if you link against the shared version of the skalibs library. </li> </ul> @@ -77,7 +77,7 @@ library. </li> <ul> <li> The current released version of s6-portable-utils is -<a href="s6-portable-utils-2.2.1.1.tar.gz">2.2.1.1</a>. </li> +<a href="s6-portable-utils-2.2.1.2.tar.gz">2.2.1.2</a>. </li> <li> Alternatively, you can checkout a copy of the <a href="//git.skarnet.org/cgi-bin/cgit.cgi/s6-portable-utils/">s6-portable-utils git repository</a>: diff --git a/doc/upgrade.html b/doc/upgrade.html index a0e48d4..b4149ad 100644 --- a/doc/upgrade.html +++ b/doc/upgrade.html @@ -18,6 +18,12 @@ <h1> What has changed in s6-portable-utils </h1> +<h2> in 2.2.1.2 </h2> + +<ul> + <li> skalibs dependency bumped to 2.7.0.0. </li> +</ul> + <h2> in 2.2.1.1 </h2> <ul> diff --git a/package/info b/package/info index 98669e7..53ad634 100644 --- a/package/info +++ b/package/info @@ -1,4 +1,4 @@ package=s6-portable-utils -version=2.2.1.1 +version=2.2.1.2 category=admin package_macro_name=S6_PORTABLE_UTILS diff --git a/src/skaembutils/s6-grep.c b/src/skaembutils/s6-grep.c index bd48cea..2839758 100644 --- a/src/skaembutils/s6-grep.c +++ b/src/skaembutils/s6-grep.c @@ -13,6 +13,7 @@ #include <skalibs/skamisc.h> #define USAGE "s6-grep [ -E | -F ] [ -i ] [ -c ] [ -n ] [ -q ] [ -v ] pattern" +#define dieusage() strerr_dieusage(100, USAGE) typedef struct flags_s flags_t, *flags_t_ref ; struct flags_s @@ -27,6 +28,12 @@ struct flags_s } ; #define FLAGS_ZERO { .extended = 0, .ignorecase = 0, .fixed = 0, .count = 0, .num = 0, .quiet = 0, .not = 0 } +static void xout (char const *s, size_t len) +{ + if (buffer_put(buffer_1, s, len) < 0) + strerr_diefu1sys(111, "write to stdout") ; +} + int main (int argc, char const *const *argv) { unsigned int count = 0 ; @@ -47,12 +54,12 @@ int main (int argc, char const *const *argv) case 'n': flags.num = 1 ; break ; case 'q': flags.quiet = 1 ; break ; case 'v': flags.not = 1 ; break ; - default : strerr_dieusage(100, USAGE) ; + default : dieusage() ; } } argc -= l.ind ; argv += l.ind ; } - if (!argc) strerr_dieusage(100, USAGE) ; + if (!argc) dieusage() ; { stralloc line = STRALLOC_ZERO ; regex_t re ; @@ -109,11 +116,9 @@ int main (int argc, char const *const *argv) char fmt[UINT_FMT] ; size_t n = uint_fmt(fmt, num) ; fmt[n++] = ':' ; - if (buffer_put(buffer_1, fmt, n) < (ssize_t)n) - strerr_diefu1sys(111, "write to stdout") ; + xout(fmt, n) ; } - if (buffer_put(buffer_1, line.s, line.len) < (ssize_t)line.len) - strerr_diefu1sys(111, "write to stdout") ; + xout(line.s, line.len) ; } } } @@ -126,8 +131,7 @@ int main (int argc, char const *const *argv) char fmt[UINT_FMT] ; size_t n = uint_fmt(fmt, count) ; fmt[n++] = '\n' ; - if (buffer_put(buffer_1, fmt, n) < (ssize_t)n) - strerr_diefu1sys(111, "write to stdout") ; + xout(fmt, n) ; } return !count ; } diff --git a/src/skaembutils/s6-ln.c b/src/skaembutils/s6-ln.c index 65a650f..d600aab 100644 --- a/src/skaembutils/s6-ln.c +++ b/src/skaembutils/s6-ln.c @@ -12,6 +12,7 @@ #include <unistd.h> #include <errno.h> #include <stdio.h> +#include <skalibs/posixplz.h> #include <skalibs/sgetopt.h> #include <skalibs/strerr2.h> #include <skalibs/stralloc.h> @@ -61,7 +62,7 @@ static void force (char const *old, char const *new, linkfunc_t_ref doit) strerr_diefu3sys(111, "make a link", " to ", old) ; if (rename(satmp.s + base, new) == -1) { - unlink(satmp.s + base) ; + unlink_void(satmp.s + base) ; strerr_diefu2sys(111, "atomically replace ", new) ; } satmp.len = base ; diff --git a/src/skaembutils/s6-update-symlinks.c b/src/skaembutils/s6-update-symlinks.c index 7ef3eb5..6acb77c 100644 --- a/src/skaembutils/s6-update-symlinks.c +++ b/src/skaembutils/s6-update-symlinks.c @@ -97,10 +97,8 @@ static int addlink (stralloc3 *blah, unsigned int dstpos, unsigned int srcpos) r = sareadlink(&blah->src, blah->dst.s + dstpos) ; if ((r == -1) && (errno != EINVAL)) { - int e = errno ; blah->dst.len = dstbase ; dir_close(dir) ; - errno = e ; return ERROR ; } if (r < 0) @@ -117,11 +115,9 @@ static int addlink (stralloc3 *blah, unsigned int dstpos, unsigned int srcpos) } if (errno) { - int e = errno ; blah->src.len = srcbase ; blah->dst.len = dstbase ; dir_close(dir) ; - errno = e ; return ERROR ; } } @@ -129,11 +125,9 @@ static int addlink (stralloc3 *blah, unsigned int dstpos, unsigned int srcpos) || (mkdir(blah->dst.s + dstpos, 0777) == -1) || !stralloc_catb(&blah->src, "/", 1)) { - int e = errno ; blah->src.len = srcbase ; blah->dst.len = dstbase ; dir_close(dir) ; - errno = e ; return ERROR ; } else /* expand */ @@ -154,21 +148,17 @@ static int addlink (stralloc3 *blah, unsigned int dstpos, unsigned int srcpos) || !stralloc_cats(&blah->src, d->d_name) || !stralloc_0(&blah->src) || (symlink(blah->src.s + srcbase, blah->dst.s + dstbase) == -1)) { - int e = errno ; blah->src.len = srcbase ; blah->dst.len = dstbase ; dir_close(dir) ; - errno = e ; return ERROR ; } } if (errno) { - int e = errno ; blah->src.len = srcbase ; blah->dst.len = dstbase ; dir_close(dir) ; - errno = e ; return ERROR ; } } @@ -214,23 +204,19 @@ static int addlink (stralloc3 *blah, unsigned int dstpos, unsigned int srcpos) continue ; if (!stralloc_cats(&blah->tmp, d->d_name) || !stralloc_0(&blah->tmp)) { - int e = errno ; blah->tmp.len = tmpbase ; blah->src.len = srcbase ; blah->dst.len = dstbase ; dir_close(dir) ; - errno = e ; return ERROR ; } } if (errno) { - int e = errno ; blah->tmp.len = tmpbase ; blah->src.len = srcbase ; blah->dst.len = dstbase ; dir_close(dir) ; - errno = e ; return ERROR ; } dir_close(dir) ; |