-----Original Message-----
From: SMACK-discuss [mailto:smack-discuss-bounces@lists.01.org] On
Behalf Of Jarkko Sakkinen
Sent: Monday, April 14, 2014 3:43 PM
To: smack-discuss(a)ml01.01.org
Cc: José Bollo
Subject: Re: [SMACK-discuss] [PATCH] utils/chsmack: add version
information
Is this what #104 in github is after?
/Jarkko
On Tue, Apr 15, 2014 at 01:40:06AM +0300, Jarkko Sakkinen wrote:
> Added option -v/--version for displaying version information for
> chsmack.
>
> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen(a)linux.intel.com>
> ---
> configure.ac | 1 +
> utils/chsmack.c | 9 ++++++++-
> 2 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/configure.ac b/configure.ac index 6e306c9..3f02ced 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -6,6 +6,7 @@ AC_INIT([libsmack],
> [
https://github.com/smack-team/smack])
> AC_CONFIG_SRCDIR([libsmack/libsmack.c])
> AC_CONFIG_AUX_DIR([build-aux])
> +AC_CONFIG_HEADERS([utils/config.h])
> AM_INIT_AUTOMAKE([-Wall -Werror dist-bzip2 foreign])
AC_GNU_SOURCE
> AC_CONFIG_MACRO_DIR([m4])
> diff --git a/utils/chsmack.c b/utils/chsmack.c index f72bb56..eb27737
> 100644
> --- a/utils/chsmack.c
> +++ b/utils/chsmack.c
> @@ -32,10 +32,12 @@
> #include <getopt.h>
> #include <errno.h>
> #include <libgen.h>
> +#include "config.h"
>
> static const char usage[] =
> "Usage: %s [options] <path>\n"
> "options:\n"
> + " -v --version output version information and exit\n"
> " -a --access set/remove "XATTR_NAME_SMACK"\n"
> " -e --exec set/remove "XATTR_NAME_SMACKEXEC"\n"
> " -m --mmap set/remove "XATTR_NAME_SMACKMMAP"\n"
> @@ -114,8 +116,9 @@ static int smack_remove_label_for_path(const char
> *path,
> /* main */
> int main(int argc, char *argv[])
> {
> - static const char shortoptions[] = "a::e::m::tdL";
> + static const char shortoptions[] = "va::e::m::tdL";
> static struct option options[] = {
> + {"version", no_argument, 0, 'v'},
> {"access", optional_argument, 0, 'a'},
> {"exec", optional_argument, 0, 'e'},
> {"mmap", optional_argument, 0, 'm'}, @@ -185,6 +188,10
@@ int
> main(int argc, char *argv[])
> basename(argv[0]),
options[options_map[c]].name);
> follow_flag = 1;
> break;
> + case 'v':
> + printf("%s (libsmack) version "
PACKAGE_VERSION "\n",
> + basename(argv[0]));
> + exit(0);
> default:
> printf(usage, basename(argv[0]));
> exit(1);
> --
> 1.7.9.5
>
_______________________________________________
SMACK-discuss mailing list
SMACK-discuss(a)lists.01.org
https://lists.01.org/mailman/listinfo/smack-discuss