From: Karel Zak <kzak@redhat.com>
To: kerolasa@gmail.com
Cc: util-linux <util-linux@vger.kernel.org>
Subject: Re: [pull] build-sys and lsblk enhancements
Date: Mon, 10 Oct 2011 15:02:32 +0200 [thread overview]
Message-ID: <20111010130232.GC17242@nb.net.home> (raw)
In-Reply-To: <CAG27Bk0ACb_sAmTiBaEpGRxgeVDJ7-tWhx9N9Ok47ZE3bTD4Zg@mail.gmail.com>
On Wed, Oct 05, 2011 at 10:42:38PM +0200, Sami Kerola wrote:
> autogen.sh | 1 +
> configure.ac | 34 ++++++++++++++++++++++++++++++++++
> include/c.h | 4 ++--
> libmount/src/tab_parse.c | 20 +++++++++++++++++++-
> misc-utils/lsblk.8 | 9 +++++++++
> misc-utils/lsblk.c | 12 ++++++++++++
> 6 files changed, 77 insertions(+), 3 deletions(-)
Applied (with some changes), thanks.
> +if test "x$scanf_cv_type_modifier" = "xms"; then
> + AC_MSG_RESULT([yes])
> + AC_DEFINE([HAVE_SCANF_MS_MODIFIER], [1], [scanf %ms modifier])
> +else
> + if test "x$scanf_cv_type_modifier" = "xas"; then
> + AC_MSG_RESULT([yes])
> + AC_DEFINE([HAVE_SCANF_AS_MODIFIER], [1], [scanf %as modifier])
> + else
> + build_libmount=no
> + AC_MSG_RESULT([no])
> + fi
> +fi
It usually more readable to use "case .. esac".
[...]
> +#ifdef HAVE_SCANF_MS_MODIFIER
> rc = sscanf(s, "%ms " /* (1) source */
> "%ms " /* (2) target */
> "%ms " /* (3) FS type */
> "%ms " /* (4) options */
> +#elif defined(HAVE_SCANF_AS_MODIFIER)
> + rc = sscanf(s, "%as " /* (1) source */
> + "%as " /* (2) target */
> + "%as " /* (3) FS type */
> + "%as " /* (4) options */
> +#endif
I have add UL_SCNsA macro with %{ms,as} modifiers to c.h, so we don't
have to use #ifdef everywhere.
[...]
> +static void check_sysdevblock(void)
> +{
> + DIR *dir;
> + if (!(dir = opendir(_PATH_SYS_DEVBLOCK)))
> + err(EXIT_FAILURE, _("failed to open sysfs directory: %s"),
> + _PATH_SYS_DEVBLOCK);
> + closedir(dir);
> + return;
> +}
access() should be enough :-)
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
prev parent reply other threads:[~2011-10-10 13:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-05 20:42 [pull] build-sys and lsblk enhancements Sami Kerola
2011-10-10 13:02 ` Karel Zak [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111010130232.GC17242@nb.net.home \
--to=kzak@redhat.com \
--cc=kerolasa@gmail.com \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).