file: update to 5.24.

This commit is contained in:
Juan RP 2015-07-10 07:07:37 +02:00
parent 531c0a66bf
commit 78a451a097
2 changed files with 5 additions and 113 deletions

View File

@ -1,109 +0,0 @@
From 21f9d5f0e0340ada998f7f9d316368c7167a4afa Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos@zoulas.com>
Date: Thu, 11 Jun 2015 12:52:32 +0000
Subject: [PATCH] Fix bug with long options and explicitly number them to avoid
this in the future.
---
src/file.c | 45 +++++++++++++++++++++++----------------------
src/file_opts.h | 10 +++++-----
2 files changed, 28 insertions(+), 27 deletions(-)
diff --git src/file.c src/file.c
index f60dde0..c700f66 100644
--- src/file.c
+++ src/file.c
@@ -89,10 +89,15 @@ private int /* Global command-line options */
private const char *separator = ":"; /* Default field separator */
private const struct option long_options[] = {
+#define OPT_HELP 1
+#define OPT_APPLE 2
+#define OPT_EXTENSIONS 3
+#define OPT_MIME_TYPE 4
+#define OPT_MIME_ENCODING 5
#define OPT(shortname, longname, opt, doc) \
{longname, opt, NULL, shortname},
-#define OPT_LONGONLY(longname, opt, doc) \
- {longname, opt, NULL, 0},
+#define OPT_LONGONLY(longname, opt, doc, id) \
+ {longname, opt, NULL, id},
#include "file_opts.h"
#undef OPT
#undef OPT_LONGONLY
@@ -182,24 +187,20 @@ main(int argc, char *argv[])
while ((c = getopt_long(argc, argv, OPTSTRING, long_options,
&longindex)) != -1)
switch (c) {
- case 0 :
- switch (longindex) {
- case 0:
- help();
- break;
- case 10:
- flags |= MAGIC_APPLE;
- break;
- case 11:
- flags |= MAGIC_EXTENSION;
- break;
- case 12:
- flags |= MAGIC_MIME_TYPE;
- break;
- case 13:
- flags |= MAGIC_MIME_ENCODING;
- break;
- }
+ case OPT_HELP:
+ help();
+ break;
+ case OPT_APPLE:
+ flags |= MAGIC_APPLE;
+ break;
+ case OPT_EXTENSIONS:
+ flags |= MAGIC_EXTENSION;
+ break;
+ case OPT_MIME_TYPE:
+ flags |= MAGIC_MIME_TYPE;
+ break;
+ case OPT_MIME_ENCODING:
+ flags |= MAGIC_MIME_ENCODING;
break;
case '0':
nulsep = 1;
@@ -595,7 +596,7 @@ help(void)
#define OPT(shortname, longname, opt, doc) \
fprintf(stdout, " -%c, --" longname, shortname), \
docprint(doc);
-#define OPT_LONGONLY(longname, opt, doc) \
+#define OPT_LONGONLY(longname, opt, doc, id) \
fprintf(stdout, " --" longname), \
docprint(doc);
#include "file_opts.h"
diff --git src/file_opts.h src/file_opts.h
index 036505f..2e30d06 100644
--- src/file_opts.h
+++ src/file_opts.h
@@ -12,7 +12,7 @@
* switch statement!
*/
-OPT_LONGONLY("help", 0, " display this help and exit\n")
+OPT_LONGONLY("help", 0, " display this help and exit\n", OPT_HELP)
OPT('v', "version", 0, " output version information and exit\n")
OPT('m', "magic-file", 1, " LIST use LIST as a colon-separated list of magic\n"
" number files\n")
@@ -29,10 +29,10 @@ OPT('f', "files-from", 1, " FILE read the filenames to be examined from FIL
OPT('F', "separator", 1, " STRING use string as separator instead of `:'\n")
OPT('i', "mime", 0, " output MIME type strings (--mime-type and\n"
" --mime-encoding)\n")
-OPT_LONGONLY("apple", 0, " output the Apple CREATOR/TYPE\n")
-OPT_LONGONLY("extension", 0, " output a slash-separated list of extnsions\n")
-OPT_LONGONLY("mime-type", 0, " output the MIME type\n")
-OPT_LONGONLY("mime-encoding", 0, " output the MIME encoding\n")
+OPT_LONGONLY("apple", 0, " output the Apple CREATOR/TYPE\n", OPT_APPLE)
+OPT_LONGONLY("extension", 0, " output a slash-separated list of extensions\n", OPT_EXTENSIONS)
+OPT_LONGONLY("mime-type", 0, " output the MIME type\n", OPT_MIME_TYPE)
+OPT_LONGONLY("mime-encoding", 0, " output the MIME encoding\n", OPT_MIME_ENCODING)
OPT('k', "keep-going", 0, " don't stop at the first match\n")
OPT('l', "list", 0, " list magic strength\n")
#ifdef S_IFLNK

View File

@ -1,8 +1,9 @@
# Template file for 'file'
pkgname=file
version=5.23
revision=2
version=5.24
revision=1
bootstrap=yes
build_pie=yes
build_style=gnu-configure
configure_args="--enable-static"
makedepends="zlib-devel"
@ -11,7 +12,7 @@ maintainer="Juan RP <xtraeme@voidlinux.eu>"
homepage="http://www.darwinsys.com/file/"
license="BSD"
distfiles="ftp://ftp.astron.com/pub/file/file-${version}.tar.gz"
checksum=2c8ab3ff143e2cdfb5ecee381752f80a79e0b4cfe9ca4cc6e1c3e5ec15e6157c
checksum=802cb3de2e49e88ef97cdcb52cd507a0f25458112752e398445cea102bc750ce
libmagic_package() {
short_desc="File type identification library"
@ -22,7 +23,7 @@ libmagic_package() {
}
}
file-devel_package() {
depends="zlib-devel libmagic>=${version}_${revision}"
depends="${makedepends} libmagic>=${version}_${revision}"
short_desc="File type identification library - development files"
pkg_install() {
vmove usr/include