Re: [pull] build-sys and lsblk enhancements

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux