diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2019-09-01 00:00:32 +0200 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2019-09-01 00:00:32 +0200 |
commit | ca9627e70852f6b2e835660df870fe3ab405882d (patch) | |
tree | 0a008b1d5b16fa0679a195ed7b5662c7891f591c /app-arch/unzip | |
download | darklin4-ca9627e70852f6b2e835660df870fe3ab405882d.tar.gz darklin4-ca9627e70852f6b2e835660df870fe3ab405882d.tar.bz2 darklin4-ca9627e70852f6b2e835660df870fe3ab405882d.tar.xz darklin4-ca9627e70852f6b2e835660df870fe3ab405882d.zip |
Initial import
Diffstat (limited to 'app-arch/unzip')
-rw-r--r-- | app-arch/unzip/Manifest | 18 | ||||
-rw-r--r-- | app-arch/unzip/files/librcc-0.2.7.h | 1544 | ||||
-rw-r--r-- | app-arch/unzip/files/unzip-5.50-dotdot.patch | 84 | ||||
-rw-r--r-- | app-arch/unzip/files/unzip-5.52-CVE-2008-0888.patch | 35 | ||||
-rw-r--r-- | app-arch/unzip/files/unzip-5.52-ds-rusxmms.patch | 150 | ||||
-rw-r--r-- | app-arch/unzip/files/unzip-5.52-ds-rusxmms2.patch | 149 | ||||
-rw-r--r-- | app-arch/unzip/files/unzip-5.52-no-exec-stack.patch | 13 | ||||
-rw-r--r-- | app-arch/unzip/files/unzip-6.0-no-exec-stack.patch | 13 | ||||
-rw-r--r-- | app-arch/unzip/files/unzip-ds-lazyrcc.patch | 146 | ||||
-rw-r--r-- | app-arch/unzip/files/unzip-ds-rcc.patch | 105 | ||||
-rw-r--r-- | app-arch/unzip/files/unzip-ds-unixenc.patch | 9 | ||||
-rw-r--r-- | app-arch/unzip/files/unzip60-ds-isprint.patch | 12 | ||||
-rw-r--r-- | app-arch/unzip/unzip-5.52-r3.ebuild | 51 | ||||
-rw-r--r-- | app-arch/unzip/unzip-5.52-r4.ebuild | 67 | ||||
-rw-r--r-- | app-arch/unzip/unzip-5.52-r5.ebuild | 74 | ||||
-rw-r--r-- | app-arch/unzip/unzip-5.52-r6.ebuild | 74 | ||||
-rw-r--r-- | app-arch/unzip/unzip-6.0-r3.ebuild | 94 |
17 files changed, 2638 insertions, 0 deletions
diff --git a/app-arch/unzip/Manifest b/app-arch/unzip/Manifest new file mode 100644 index 0000000..b3e5e92 --- /dev/null +++ b/app-arch/unzip/Manifest @@ -0,0 +1,18 @@ +AUX librcc-0.2.7.h 62364 RMD160 d0c2ac61cfd9b9cd9fd038e14d6b9a4d79dc39b9 SHA1 9ea2c8a2d5d0ba2aef5ddcebf193f7391bcbb842 SHA256 64505886d4d68aac32b07bb69734bc932cea7eb3bf858b2cd5d4609595f06e7e +AUX unzip-5.50-dotdot.patch 3195 RMD160 96b71d43c80ca9fb077c14184e416fa326bddf07 SHA1 2797603c3c749270b88786c9e4e10f119c2f83a1 SHA256 9b7e5cac2d23f840e3d9c9aff553649383c20acb0945d60dfca80b99c74a1666 +AUX unzip-5.52-CVE-2008-0888.patch 1075 RMD160 03d5ec7845ae9347a197c7d1484bb2d9ab96cb93 SHA1 a72e703048ddd2226d430b7375b531320997b98a SHA256 a93b927000ff5923c3e84fc4108a0f19d76a3a057a33556a2f761c18b270f87c +AUX unzip-5.52-ds-rusxmms.patch 4353 RMD160 a318c923afe145da5b7b8a0870fd4097851c1ada SHA1 a2f3679246b0b5fee2912b922c0e1d4df1268208 SHA256 a2c2e1344953a010d1d866830a1196cb03e14193fea2876da55e2633cb6f06b3 +AUX unzip-5.52-ds-rusxmms2.patch 4257 RMD160 920ebae51a59341e1716695dfd24cc442b446d31 SHA1 879ea5a08971d780f00dd34ea168f545cb168e23 SHA256 09569c72cbf4ba63c280d6dfe56c86eb94879d8eaca8c64e9ba4e907bc698175 +AUX unzip-5.52-no-exec-stack.patch 334 RMD160 81d73b5bb66fb54f8f71252c1fe6e2036d488de9 SHA1 0f318fecebd548e9feb2e93a32c56258d5c552b1 SHA256 8e165db2c138f9729020f3e60e9d8be58d504f4cf8eb7aae18b9432d2d751d4f +AUX unzip-6.0-no-exec-stack.patch 381 RMD160 c45c06fd6a4fc88ce051637b6d7f1f4b0e09fa48 SHA1 d26e9fb76d73d77c2651198a3b27ae8bfb06fb34 SHA256 ae62249dcf8bbc3c30468b07944df6c8777b565927d9ed6d1fdf7395899ea7c7 +AUX unzip-ds-lazyrcc.patch 4186 RMD160 627f00d0b27fff5d8489a4eada546c34a80f0170 SHA1 9b276df0666c6504f9811d083021568718e2c3b7 SHA256 e18d2dd4152ee50611e2d202d7387c3a8024eb7c88fad74a9cebe3fc6498f04a +AUX unzip-ds-rcc.patch 2963 RMD160 c37a70a7939126bcab671cb5e7cac855f2d6455e SHA1 4571d02ea694b50e44d9e8502a6b1b49068b1cc8 SHA256 6c53432de2e23639b0b2e4c22c6b0ba1492d76f0634e5b257dc9a5c8312dc9e4 +AUX unzip-ds-unixenc.patch 421 RMD160 048d9763d22007de209cefafde63cdec3e94d251 SHA1 274a2748b33660ddb7e413290c6c7a9a1877d15a SHA256 98b39ee3b6c63164b5b59d6d8c4b1a5fb6f311e2c91b76c44292dda86d0b2c63 +AUX unzip60-ds-isprint.patch 489 RMD160 e46154bea0bddf000e66f4d335d7c6a1ac9ecabb SHA1 7f2e6243646ce22d764f4554cb89142656b12f4f SHA256 30123645d9f06a054d16ee58749c3d1f01db66e99de21e8d822847b353366e2c +DIST unzip552.tar.gz 1140291 RMD160 b749b0923bc4cceaa6f937aef688e9713a84328c SHA1 1831bd59b9e607a69052f83b263384895e2d4a19 SHA256 145d95e2ef1ef9add2e3c97d1340907e33ab8749eb1235372e7f0b7af600a8e9 +DIST unzip60.tar.gz 1376845 RMD160 48af66606e9472e45fbb94bc4e285da23d1b89ba SHA1 abf7de8a4018a983590ed6f5cbd990d4740f8a22 SHA256 036d96991646d0449ed0aa952e4fbe21b476ce994abc276e49d30e686708bd37 +EBUILD unzip-5.52-r3.ebuild 1407 RMD160 641f924d8a7dee2fe6e36ec3dfcce26db7d79784 SHA1 ac4c72209e524e9fd28be2a5919e60f8cfea1d40 SHA256 0b3617449ec68f7d53448c3562d06ca74852ae98e308912e8719edd1b3a42b73 +EBUILD unzip-5.52-r4.ebuild 2022 RMD160 aa19e8ed6cc1812ed082f5e9e52d802b3c85cce9 SHA1 0efa28ec77f9208852e9b2941754aa6ea4721de5 SHA256 20995dcfc98f80f9ebcdaabc47347dd1958b2ec061cdb71172b965dec8824117 +EBUILD unzip-5.52-r5.ebuild 2143 RMD160 2565645ed72eeac299cb5ec9223d51618886eee9 SHA1 a6fb8f869c67ea95fe9684304fee7d0275e4031f SHA256 dd52ad8a2d966fccdc136bd24025d5096072035c6a49b7be8e99868d8b37a15b +EBUILD unzip-5.52-r6.ebuild 2144 RMD160 8bb960a3f85edf25286559c317f48fec7e07e06f SHA1 72b1fb98289aa8107961e3d36ac585892a792a56 SHA256 20076be2040d8387e00090efc6b3ec0dc3fdb30e0eb53ffe475f81550770db50 +EBUILD unzip-6.0-r3.ebuild 2483 RMD160 e1d57a618e2443ee951a2bc07dc84653df81c003 SHA1 12bc4e942384dfe0b360d68ff06039185c4554e6 SHA256 9356ab3f2c1fb594abd3f0d27f2bfd19645d460356b89cb58209cc9d984534e4 diff --git a/app-arch/unzip/files/librcc-0.2.7.h b/app-arch/unzip/files/librcc-0.2.7.h new file mode 100644 index 0000000..88cc802 --- /dev/null +++ b/app-arch/unzip/files/librcc-0.2.7.h @@ -0,0 +1,1544 @@ +#ifndef _LIBRCC_H +#define _LIBRCC_H + +#include <stdlib.h> + +/******************************************************************************* +***************************** Global Defines *********************************** +*******************************************************************************/ + +#define RCC_MAX_CHARSETS 16 +#define RCC_MAX_ENGINES 5 +#define RCC_MAX_LANGUAGES 64 +#define RCC_MAX_ALIASES 64 +#define RCC_MAX_CLASSES 16 + +/* ID's */ +/** + * Language ID. + * - 0 is default language + * - -1 is error + * - 1 usually represents "LibRCC off" language + * - >1 is some language + */ +typedef unsigned char rcc_language_id; +/** + * Alias ID + */ +typedef unsigned char rcc_alias_id; +/** + * Relation ID + */ +typedef unsigned char rcc_relation_id; +/** + * Charset ID. + * - 0 is default charset + * - -1 is error + * - >0 is some charset + */ +typedef unsigned char rcc_charset_id; +/** + * Autocharset ID. + * - -1 is error + * - >0 is some encoding + */ +typedef unsigned char rcc_autocharset_id; +/** + * Engine ID. + * - -1 is non configured (first available will be used if any) + * - 0 autodetection is switched off + * - >0 is some auto-engine + */ +typedef unsigned char rcc_engine_id; +/** + * Class ID. + */ +typedef int rcc_class_id; + +/* Opaque Pointer's */ +typedef struct rcc_context_t *rcc_context; /**< Current Working Context */ +/** + * Encoding Detection Engine Context. Containes considered information about + * engine, which can be extracted using API functions. + * @see rccEngineGetInternal + * @see rccEngineGetLanguage + * @see rccEngineGetRccContext + */ +typedef struct rcc_engine_context_t *rcc_engine_context; +/** + * Current Language Configuration: + * Information about current 'class encodings', and selected 'Encoding Detection + * Engine' + */ +typedef struct rcc_language_config_t *rcc_language_config; +typedef const struct rcc_class_t *rcc_class_ptr; + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Library Initialization function. Should be called prior to all + * any library manipulation. + */ +int rccInit(); + +/** + * Library Cleanup function. + */ +void rccFree(); + +/******************************************************************************* +**************************** Initialization ************************************ +*******************************************************************************/ +/** + * RCC context initialization flags + */ +typedef unsigned int rcc_init_flags; + +/** + * Do not load default language configuration + */ +#define RCC_FLAG_NO_DEFAULT_CONFIGURATION 1 + +/** + * Initialize working context. + * + * @param locale_variable is variable to get locale from (Default: LC_CTYPE). + * @param max_languages is maximal number of languages supported by context. (Default: detect) + * @param max_classes is maximal number of classes (Default: detect) + * @param defclasses is list of encoding classes (Default: will add later) + * @param flags is option flag (Default: nothing) + * @see RCC_FLAG_NO_DEFAULT_CONFIGURATION + * @return working context or NULL in case of error + */ +rcc_context rccCreateContext(const char *locale_variable, unsigned int max_languages, unsigned int max_classes, rcc_class_ptr defclasses, rcc_init_flags flags); +/** + * Initialize default working context (used then no context supplied). Previously + * opened default context will be freed. + * + * @param locale_variable is variable to get locale from (Default: LC_CTYPE). + * @param max_languages is maximal number of languages supported by context. (Default: detect) + * @param max_classes is maximal number of classes (Default: detect) + * @param defclasses is list of encoding classes (Default: will add later) + * @param flags is option flag (Default: nothing) + * @see RCC_FLAG_NO_DEFAULT_CONFIGURATION + * @return non-zero value in case of error + */ +int rccInitDefaultContext(const char *locale_variable, unsigned int max_languages, unsigned int max_classes, rcc_class_ptr defclasses, rcc_init_flags flags); + +/** + * Free all memory used by working context and destroy it. + * + * @param ctx is working context to be destroyed. + */ +void rccFreeContext(rcc_context ctx); + + +/** + * Berkeley DB initialization flags + */ +typedef unsigned int rcc_db4_flags; + +/** + * Enables Berkeley DB recodings caching for specified working context. + * + * @param ctx is working context + * @param name is database name (can be shared between different applications) + * @param flags are reserved for future. + * @return non-zero value in case of error + */ +int rccInitDb4(rcc_context ctx, const char *name, rcc_db4_flags flags); + +int rccLockConfiguration(rcc_context ctx, unsigned int lock_code); +int rccUnlockConfiguration(rcc_context ctx, unsigned int lock_code); + +/******************************************************************************* +******************* Altering Language Configuaration *************************** +*******************************************************************************/ +/** + * Encoding name. + */ +typedef const char *rcc_charset; +/** + * List of Encoding names + */ +typedef rcc_charset rcc_charset_list[RCC_MAX_CHARSETS+1]; + +/* Engines */ +/** + * Engine internal data + */ +typedef void *rcc_engine_internal; +/** + * Engine constructor function + * @param ctx is engine context + * @see rccEngineGetInternal + * @see rccEngineGetLanguage + * @see rccEngineGetRccContext + * @return pointer on desired internal data to be stored in engine_context. + */ +typedef rcc_engine_internal (*rcc_engine_init_function)(rcc_engine_context ctx); +/** + * Engine encoding detection function. + * @param ctx is engine context + * @param buf is string encoded in unknow encoding + * @param len is exact size of string or 0 (size will be detected with strlen) + * @return the #rcc_autocharset_id of the detected encoding or -1 in case of error + */ +typedef rcc_autocharset_id (*rcc_engine_function)(rcc_engine_context ctx, const char *buf, int len); +/** + * Engine destructor function + */ +typedef void (*rcc_engine_free_function)(rcc_engine_context ctx); + +/** + * Encoding detection engine description. Init and Free functions can be omited. + * 'func' should analyze string and return position in the encodings list + * coresponding to string encoding. + */ +struct rcc_engine_t { + const char *title; /**< Short title*/ + rcc_engine_init_function init_func; /**< Constructor function */ + rcc_engine_free_function free_func; /**< Destructor function */ + rcc_engine_function func; /**< Function performing encoding detection */ + rcc_charset_list charsets; /**< List of supported encodings */ +}; +typedef struct rcc_engine_t rcc_engine; +typedef rcc_engine *rcc_engine_ptr; +typedef rcc_engine_ptr rcc_engine_list[RCC_MAX_ENGINES+1]; + +/** + * Language description. + */ +struct rcc_language_t { + const char *sn; /**< Language ISO-639-1 (2 symbol) name */ + rcc_charset_list charsets; /**< List of language encodings */ + rcc_engine_list engines; /**< List of encoding detection engines supported by language */ +}; +typedef struct rcc_language_t rcc_language; +typedef rcc_language *rcc_language_ptr; +typedef rcc_language_ptr rcc_language_list[RCC_MAX_LANGUAGES+1]; + +/** + * Language Aliases. + * For example: ru_UA = uk, cs_SK = sk + */ +struct rcc_language_alias_t { + const char *alias; /**< Long locale name */ + const char *lang; /**< Coresponded language ISO-639-1 name */ +}; +typedef struct rcc_language_alias_t rcc_language_alias; +typedef rcc_language_alias *rcc_language_alias_ptr; +typedef rcc_language_alias_ptr rcc_language_alias_list[RCC_MAX_ALIASES+1]; + +/** + * Language relations. + * Meaning: sentence in considered language may contain words from all his parents. This + * knowledge will help Autodetection Engine to guess right language. + * + * For example: Russian is parent language for Ukrainian. This means it is possible + * to encounter russian words in ukrainian sentence. + * + * All languages by default are related to english language. + */ +struct rcc_language_relation_t { + const char *lang; /**< Coresponded language ISO-639-1 name */ + const char *parent; /**< Parent language */ +}; +typedef struct rcc_language_relation_t rcc_language_relation; + +/** + * Register new language in supplied working context + * @param ctx is working context ( or default one if NULL supplied ) + * @param language is pointer on language description (shouldn't be freed before library deinitialization). + * @return registered language id or -1 in case of a error. + */ +rcc_language_id rccRegisterLanguage(rcc_context ctx, rcc_language *language); +/** + * Register new encoding belonging to language in supplied working context + * @param language is language charset should be added to ( or default one if NULL supplied ) + * @param charset is pointer on charset name (shouldn't be freed before library deinitialization). + * @return registered charset id or -1 in case of a error. + */ +rcc_charset_id rccLanguageRegisterCharset(rcc_language *language, rcc_charset charset); +/** + * Register new Engine in supplied working context + * @param language is language charset should be added to ( or default one if NULL supplied ) + * @param engine is pointer on engine description (shouldn't be freed before library deinitialization). + * @return registered engine id or -1 in case of a error. + */ +rcc_engine_id rccLanguageRegisterEngine(rcc_language *language, rcc_engine *engine); +/** + * Register new language alias in supplied working context + * @param ctx is working context ( or default one if NULL supplied ) + * @param alias is pointer on alias description (shouldn't be freed before library deinitialization). + * @return registered alias id or -1 in case of a error. + */ +rcc_alias_id rccRegisterLanguageAlias(rcc_context ctx, rcc_language_alias *alias); +/** + * Register new language relation in supplied working context + * @param ctx is working context ( or default one if NULL supplied ) + * @param relation is pointer on relation description (shouldn't be freed before library deinitialization). + * @return registered relation id or -1 in case of a error. + */ +rcc_relation_id rccRegisterLanguageRelation(rcc_context ctx, rcc_language_relation *relation); + +/******************************************************************************* +************************ Altering Configuaration ******************************* +*******************************************************************************/ +/** + * Enumeration represents type of class. + */ +typedef enum rcc_class_type_t { + RCC_CLASS_INVALID = 0, /**< Invalid value */ + RCC_CLASS_STANDARD, /**< Standard class */ + RCC_CLASS_KNOWN, /**< Class encoding is known and no autodetection should be performed */ + RCC_CLASS_FS, /**< Class strings are representing file names */ + RCC_CLASS_TRANSLATE_LOCALE, /**< It is permited to translate class strings to current Locale Language in rccTo */ + RCC_CLASS_TRANSLATE_CURRENT,/**< It is permited to translate class strings to Current Language in rccTo */ + RCC_CLASS_TRANSLATE_FROM, /**< It is permited to translate class strings to Current Language in rccFrom */ +} rcc_class_type; + +/** + * Provides information about default encoding for specific language + */ +struct rcc_class_default_charset_t { + const char *lang; /**< Language */ + const char *charset; /**< Default encoding for #lang */ +}; +typedef const struct rcc_class_default_charset_t rcc_class_default_charset; + +/** Forbid change class value using Library API */ +#define RCC_CLASS_FLAG_CONST 0x01 +/** Forbid saving and loading of class value */ +#define RCC_CLASS_FLAG_SKIP_SAVELOAD 0x02 + +/** Encoding class description. Encoding classes are main concept of LibRCC library. + * The strings are recoded between different classes (for example in RusXMMS2 project + * ID3 titles are recoded between ID3 and Output classes). The current encoding of + * each class can be set using configuration file or API call, otherwise it will + * be detected automatically using current locale or default encoding. + * + * If the #defvalue is not NULL, it provides information about detection of + * the default encoding. The are following possibilities for that value: + * - Detect default encoding using specified locale variable (LC_CTYPE for example). + * . - The current encoding of the another class will be used instead of default encodings. Short name of considered class should be specified. + * - Just use specified multibyte encoding for all languages. + * In case of detection failure using all these methods, the #defcharset will + * be examined if default encoding for current language is available. If not, + * the first encoding in the list will be used as current. + * + * Additionaly it is possible to set special flags to prevent user from + * modifying class value. It is possible to protect class from changing + * ether using API, or configuration files. + * + * @see rcc_class_default_charset_t + * @see RCC_CLASS_FLAG_CONST + * @see RCC_CLASS_FLAG_SKIP_SAVELOAD + * + * The class type provides information for recoding functions about + * automatic detection of the class chrset. The encodings of the + * #RCC_CLASS_STANDARD classes will be detected using autoengine (if available + * for current language. The #RCC_CLASS_FS classes are associated with files + * and encoding will be guessed using find_file. + * + * @see rcc_class_type_t + * + */ +struct rcc_class_t { + const char *name; /**< Short class name */ + const rcc_class_type class_type; /**< specifies type of class (Standard, File System, Known) */ + const char *defvalue; /**< locale variable name or parent name or multibyte encoding name */ + rcc_class_default_charset *defcharset; /**< default class encodings. Should be specified on per-language basys */ + const char *fullname; /**< Full name of the class */ + const unsigned long flags; /**< Class flags. (CONST, SKIP_SAVELOAD) */ +}; +typedef const struct rcc_class_t rcc_class; +typedef rcc_class_ptr rcc_class_list[RCC_MAX_CLASSES+1]; + +/** + * Register additional class + * @param ctx is working context ( or default one if NULL supplied ) + * @param cl is pointer on the class description (shouldn't be freed before library deinitialization). + * @return registered class id or -1 in case of a error. + */ +rcc_class_id rccRegisterClass(rcc_context ctx, rcc_class *cl); +/** + * Register additional charsets for the current class. + * @param ctx is working context ( or default one if NULL supplied ) + * @param class_id is class id. + * @param charsets is NULL terminated list of classes. + * @return non zero value in the case of a error. + */ +int rccRegisterAdditionalCharsets(rcc_context ctx, rcc_class_id class_id, rcc_charset *charsets); +/** + * Register names of charsets disabled in the specified class. + * @param ctx is working context ( or default one if NULL supplied ) + * @param class_id is class id. + * @param charsets is NULL terminated list of classes ("unicode" / "nonunicode" specifies corespondent group of charsets). + * @return non zero value in the case of a error. + */ +int rccRegisterDisabledCharsets(rcc_context ctx, rcc_class_id class_id, rcc_charset *charsets); +/** + * Checks if charset is disabled for the specified class. + * @param ctx is working context ( or default one if NULL supplied ) + * @param class_id is class id. + * @param charset is charset name. + * @return 1 if charset is disabled, 0 if charset is enabled, -1 in the case of error. + */ +int rccIsDisabledCharsetName(rcc_context ctx, rcc_class_id class_id, const char *charset); + +/** + * Determines 'class type' of supplied class. + * @param ctx is working context ( or default one if NULL supplied ) + * @param class_id is class id + * @return class type or -1 in case of a error. + */ +rcc_class_type rccGetClassType(rcc_context ctx, rcc_class_id class_id); +/** + * Returns name of supplied class. + * @param ctx is working context ( or default one if NULL supplied ) + * @param class_id is class id + * @return class name or NULL in case of a error. + */ +const char *rccGetClassName(rcc_context ctx, rcc_class_id class_id); +/** + * Returns full name of supplied class. + * @param ctx is working context ( or default one if NULL supplied ) + * @param class_id is class id + * @return class full name or NULL in case of a error. + */ +const char *rccGetClassFullName(rcc_context ctx, rcc_class_id class_id); + +/******************************************************************************* +************************ Altering Configuaration ******************************* +*******************************************************************************/ +typedef int rcc_option_value; + +/** + * Use BerkeleyDB recodings cache for encoding detection + */ +#define RCC_OPTION_LEARNING_FLAG_USE 1 +/** + * Cache recodings in BerkeleyDB recoding cache for future use + */ +#define RCC_OPTION_LEARNING_FLAG_LEARN 2 + +typedef enum rcc_option_translate_t { + RCC_OPTION_TRANSLATE_OFF = 0, /**< Switch translation off. */ + RCC_OPTION_TRANSLATE_TRANSLITERATE, /**< Transliterate data. */ + RCC_OPTION_TRANSLATE_TO_ENGLISH, /**< Translate data to english language (Current language don't matter). */ + RCC_OPTION_TRANSLATE_SKIP_RELATED, /**< Skip translation of the text's between related languages. */ + RCC_OPTION_TRANSLATE_SKIP_PARENT, /**< Skip translation of the text's from parent languages (from english). */ + RCC_OPTION_TRANSLATE_FULL /**< Translate whole data to the current language */ +} rcc_option_translate; + +/** + * List of options available + */ +typedef enum rcc_option_t { + RCC_OPTION_LEARNING_MODE = 0, /**< Recoding Caching mode (OFF/ON/RELEARN/LEARN) */ + RCC_OPTION_AUTODETECT_FS_TITLES, /**< Detect titles of #RCC_CLASS_FS classes */ + RCC_OPTION_AUTODETECT_FS_NAMES, /**< Try to find encoding of #RCC_CLASS_FS by accessing fs */ + RCC_OPTION_CONFIGURED_LANGUAGES_ONLY, /**< Use only configured languages or languages with auto-engines */ + RCC_OPTION_AUTOENGINE_SET_CURRENT, /**< If enabled autodetection engine will set current charset */ + RCC_OPTION_AUTODETECT_LANGUAGE, /**< Enables language detection */ + RCC_OPTION_TRANSLATE, /**< Translate #rcc_string if it's language differs from current one */ + RCC_OPTION_TIMEOUT, /**< Recoding timeout. Currently it is only used to limit translation time */ + RCC_OPTION_OFFLINE, /**< Allows external module to finish it's job in offline after the main program is terminated */ + RCC_MAX_OPTIONS, + RCC_OPTION_ALL +} rcc_option; + +/** + * List of option types + */ +typedef enum rcc_option_type_t { + RCC_OPTION_TYPE_INVISIBLE = 0, /**< Invisible option. Wouldn't be represented in UI menu */ + RCC_OPTION_TYPE_STANDARD, /**< Standard option. */ + RCC_OPTION_TYPE_MAX +} rcc_option_type; + +/** + * Description of option values range type + */ +typedef enum rcc_option_range_type_t { + RCC_OPTION_RANGE_TYPE_BOOLEAN = 0, /**< Boolean option */ + RCC_OPTION_RANGE_TYPE_RANGE, /**< Range of integer values */ + RCC_OPTION_RANGE_TYPE_FLAGS, /**< Set of boolean flags */ + RCC_OPTION_RANGE_TYPE_MENU, /**< Enumeration */ + RCC_OPTION_RANGE_TYPE_MAX +} rcc_option_range_type; + +/** + * Descriptionm of value range + */ +typedef struct rcc_option_range_t { + rcc_option_range_type type; /**< Value range type */ + rcc_option_value min; /**< Minimal acceptable option value */ + rcc_option_value max; /**< Maximal acceptable option value */ + rcc_option_value step; /**< Preccision step */ +}rcc_option_range; + +/* lng.c */ + +/** + * Return number of configured languages + * + * @param ctx is working context ( or default one if NULL supplied ) + * @return number of configured languages or 0 in the case of error + */ +int rccGetLanguageNumber(rcc_context ctx); +/** + * Return number of configured classes + * + * @param ctx is working context ( or default one if NULL supplied ) + * @return number of configured classes or 0 in the case of error + */ +int rccGetClassNumber(rcc_context ctx); +/** + * Determines name of the supplied language. + * + * @param ctx is working context ( or default one if NULL supplied ) + * @param language_id is 'language id' of desired language. For default language the 'default' value will be returned. + * @return language name or NULL in case of a error. + */ +const char *rccGetLanguageName(rcc_context ctx, rcc_language_id language_id); +/** + * Finds language id by the supplied name. + * + * @param ctx is working context ( or default one if NULL supplied ) + * @param name is language name + * @return language id [0-n] or -1 if not found. + */ +rcc_language_id rccGetLanguageByName(rcc_context ctx, const char *name); +/** + * This function resolves default languages. If positive language id is supplied + * it will be returned back unchanged. The default language (0 is supplied as + * language id) will be resolved to some particular language. + * The following procedure will be used: + * - 1. Detect Language by locale + * - 2. Check if language intialized if RCC_OPTION_CONFIGURED_LANGUAGES_ONLY is set + * - 3. If one of the previous steps is failed, select first available language (id=1). Usually it should be 'LibRCC off'. + * + * @param ctx is working context ( or default one if NULL supplied ) + * @param language_id is language id + * @return resolved language id [1-n] or -1 in case of error. + */ +rcc_language_id rccGetRealLanguage(rcc_context ctx, rcc_language_id language_id); +/** + * Return considered language name, resolving default language if necessary. + * @see rccGetRealLanguage + * + * @param ctx is working context ( or default one if NULL supplied ) + * @param language_id is language id + * @return resolved language name or NULL in case of error. + */ +const char *rccGetRealLanguageName(rcc_context ctx, rcc_language_id language_id); +/** + * Return selected language id. + * + * @param ctx is working context ( or default one if NULL supplied ) + * @return selected language id [0-n] or -1 in case of error + */ +rcc_language_id rccGetSelectedLanguage(rcc_context ctx); +/** + * Return selected language name. + * @see rccGetSelectedLanguage + * + * @param ctx is working context ( or default one if NULL supplied ) + * @return selected language name or NULL in case of error. + */ +const char *rccGetSelectedLanguageName(rcc_context ctx); +/** + * Return current language id, resolving default language to particular one if necessary. + * See more details how default language is resolved: @see rccGetRealLanguage + * + * @param ctx is working context ( or default one if NULL supplied ) + * @return current language id [1-n] or -1 in case of error + */ +rcc_language_id rccGetCurrentLanguage(rcc_context ctx); +/** + * Return current language name. + # @see rccGetCurrentLanguage + * + * @param ctx is working context ( or default one if NULL supplied ) + * @return current language id [1-n] or -1 in case of error + */ +const char *rccGetCurrentLanguageName(rcc_context ctx); + + +/** + * Set current language. + * + * @param ctx is working context ( or default one if NULL supplied ) + * @param language_id is new language id [0-n]. Set to default state is Ok. + * @return non-zero value in case of error + */ +int rccSetLanguage(rcc_context ctx, rcc_language_id language_id); +/** + * Set current language by name. + * + * @param ctx is working context ( or default one if NULL supplied ) + * @param name is the short name of new language. + * @return non-zero value in case of error + */ +int rccSetLanguageByName(rcc_context ctx, const char *name); + +/* opt.c */ +/** + * Return option value. + * + * @param ctx is working context ( or default one if NULL supplied ) + * @param option is option + * @return current option value or -1 in case of error + */ +rcc_option_value rccGetOption(rcc_context ctx, rcc_option option); +/** + * Tests if option have unchanged default value. + * + * @param ctx is working context ( or default one if NULL supplied ) + * @param option is option + * @return current option value or -1 in case of error + */ +int rccOptionIsDefault(rcc_context ctx, rcc_option option); +/** + * Sets option to its default value. + * + * @param ctx is working context ( or default one if NULL supplied ) + * @param option is option + * @return non-zero value in case of error + */ +int rccOptionSetDefault(rcc_context ctx, rcc_option option); +/** + * Set option value. + * + * @param ctx is working context ( or default one if NULL supplied ) + * @param option is option + * @param value is option value + * @return non-zero value in case of erros + */ +int rccSetOption(rcc_context ctx, rcc_option option, rcc_option_value value); +/** + * Get current option type. + * + * @param ctx is working context ( or default one if NULL supplied ) + * @param option is option + * @return current option type or -1 in case of error + */ +rcc_option_type rccOptionGetType(rcc_context ctx, rcc_option option); +/** + * Return range description for specified option + * + * @param ctx is working context ( or default one if NULL supplied ) + * @param option is option + * @return option range or -1 in case of error + */ +rcc_option_range *rccOptionGetRange(rcc_context ctx, rcc_option option); + +/** + * Get short name of supplied option. + * + * @param option is option + * @return option range or NULL in case of error + */ +const char *rccGetOptionName(rcc_option option); + +/** + * Get short name of supplied option value. + * + * @param option is option + * @param value is value of #option + * @return option value name or NULL in case of error + */ +const char *rccGetOptionValueName(rcc_option option, rcc_option_value value); +/** + * Get option by short name. + * + * @param name is option name + * @return option or -1 in case of error + */ +rcc_option rccGetOptionByName(const char *name); +/** + * Get option value by short name. + * + * @param option is option + * @param name is value name + * @return option value or -1 in case of error + */ +rcc_option_value rccGetOptionValueByName(rcc_option option, const char *name); + + +/* lngconfig.c */ +/** + * Check if configuration is initialized for supplied language. + * + * @param ctx is working context ( or default one if NULL supplied ) + * @param language_id is concerned language id + * @return configuration context if: + * - language_id is particular language, not default one + * - language already intialized + * - language is not dummy (Disable LibRCC) language + * otherwise NULL is returned + */ +rcc_language_config rccCheckConfig(rcc_context ctx, rcc_language_id language_id); +/** + * Initializes language configuration if not yet configured and returns pointer on + * that configuration. If default language is supplied (language_id = 0), the + * language id will be resolved to particular language and config of that language + * will be returned. + * + * @param ctx is working context ( or default one if NULL supplied ) + * @param language_id is concerned language id + * @return configuration context. The NULL is returned in the case of errors or + * dummy (Disable LibRCC) language is selected. + */ +rcc_language_config rccGetConfig(rcc_context ctx, rcc_language_id language_id); +/** + * Checks if supplied language is usable. The usability of language is determined + * regarding #RCC_OPTION_CONFIGURED_LANGUAGES_ONLY option. Depending on that + * option there are several possibilities for language usability: + * Any non-dummy language is usable + * Any configured or AutoEngine enabled language is usable + * Only configured languages are usable + * + * Language configuration is initialized if not yet configured. And pointer on + * that configuration is returned. If default language is supplied (language_id = 0), the + * language id will be resolved to particular language and config of that language + * will be returned. + * + * @param ctx is working context ( or default one if NULL supplied ) + * @param language_id is concerned language id + * @return configuration context. The NULL is returned in the case of errors or + * if unusable language is supplied. + */ +rcc_language_config rccGetUsableConfig(rcc_context ctx, rcc_language_id language_id); +/** + * Initializes language configuration if not yet configured and returns pointer on + * that configuration. + * + * @param ctx is working context ( or default one if NULL supplied ) + * @param name is concerned language name + * @return configuration context or NULL in case of error + */ +rcc_language_config rccGetConfigByName(rcc_context ctx, const char *name); +/** + * Returns pointer on the current language configuration (Initializes it as well + * if required) + * + * @param ctx is working context ( or default one if NULL supplied ) + * @return configuration context or NULL in case of error + */ +rcc_language_config rccGetCurrentConfig(rcc_context ctx); + +/** + * Return language associated with supplied configuration. + * + * @param config is language configuration + */ +rcc_language_id rccConfigGetLanguage(rcc_language_config config); +/** + * Return name of the language associated with supplied configuration. + * + * @param config is language configuration + */ +const char *rccConfigGetLanguageName(rcc_language_config config); + +/** + * Return number of configured charsets + * + * @param config is language configuration + * @return number of charsets available in the configuration or 0 in the case of error + */ +int rccConfigGetCharsetNumber(rcc_language_config config); +/** + * Return number of configured charsets + * + * @param config is language configuration + * @param class_id is class id. + * @return number of charsets available in the configuration or 0 in the case of error + */ +int rccConfigGetClassCharsetNumber(rcc_language_config config, rcc_class_id class_id); +/** + * Return number of configured encoding auto-detection engines + * + * @param config is language configuration + * @return number of engines or 0 in the case of error + */ +int rccConfigGetEngineNumber(rcc_language_config config); + +/** + * Return supplied engine name + * + * @param config is language configuration + * @param engine_id is desired engine + * @return selected engine name or NULL in case of error. + */ +const char *rccConfigGetEngineName(rcc_language_config config, rcc_engine_id engine_id); +/** + * Return supplied encoding name + * + * @param config is language configuration + * @param charset_id is desired charset + * @return selected encoding name or NULL in case of error. + */ +const char *rccConfigGetCharsetName(rcc_language_config config, rcc_charset_id charset_id); +/** + * Return supplied encoding name + * + * @param config is language configuration + * @param class_id is charset encodings + * @param charset_id is desired charset + * @return selected encoding name or NULL in case of error. + */ +const char *rccConfigGetClassCharsetName(rcc_language_config config, rcc_class_id class_id, rcc_charset_id charset_id); + +/** + * Function finds engine id by the supplied name. + * + * @param config is language configuration + * @param name is engine name + * @return engine id [0-n] or -1 if not found + */ +rcc_engine_id rccConfigGetEngineByName(rcc_language_config config, const char *name); +/** + * Function finds encoding id by the supplied name. + * + * @param config is language configuration + * @param name is encoding name + * @return encoding id [0-n] or -1 if not found. + */ +rcc_charset_id rccConfigGetCharsetByName(rcc_language_config config, const char *name); +/** + * Function finds encoding id by the supplied name. + * + * @param config is language configuration + * @param class_id is encoding class + * @param name is encoding name + * @return encoding id [0-n] or -1 if not found. + */ +rcc_charset_id rccConfigGetClassCharsetByName(rcc_language_config config, rcc_class_id class_id, const char *name); +/** + * Checks if charset is disabled for the specified class. + * @param config is language configuration + * @param class_id is class id. + * @param charset_id is charset id. + * @return 1 if charset is disabled, 0 if charset is enabled, -1 in the case of error. + */ +int rccConfigIsDisabledCharset(rcc_language_config config, rcc_class_id class_id, rcc_charset_id charset_id); +/** + * Return selected engin id. + * + * @param config is language configuration + * @return selected engine id [-1-n] + * - -1 engine is not configured and first available will be used + * - 0 engines are disabled + * - >0 paticular engine id + */ +rcc_engine_id rccConfigGetSelectedEngine(rcc_language_config config); +/** + * Return selected engine name. + * @see rccConfigGetSelectedEngine + * + * @param config is language configuration + * @return selected engine name ('default' will be returned if engine not configured) or NULL in case of error. + */ +const char *rccConfigGetSelectedEngineName(rcc_language_config config); +/** + * Return current engine_id. The default value will be resolved to paticular engine id. Normally, + * the id of the first available engine will be returned. If no engines registered for supplied + * language the 0 will be returned, indicating id of dummy(disabled) engine. + * + * @param config is language configuration + * @return selected engine id [0-n] or -1 in case of error + * - 0 engines are disabled + * - >0 paticular engine id + */ +rcc_engine_id rccConfigGetCurrentEngine(rcc_language_config config); +/** + * Return current engine name. + * @see rccConfigGetCurrentEngine + * + * @param config is language configuration + * @return current engine name or NULL in case of error. + */ +const char *rccConfigGetCurrentEngineName(rcc_language_config config); + +/** + * Return selected encoding id. + * + * @param config is language configuration + * @param class_id is encoding class + * @return selected encoding id [0-n] or -1 in case of error + * - 0 default encoding + * - >0 paticular encoding id + */ +rcc_charset_id rccConfigGetSelectedCharset(rcc_language_config config, rcc_class_id class_id); +/** + * Return selected encoding name. + * @see rccConfigGetSelectedCharset + * + * @param config is language configuration + * @param class_id is charset encodings + * @return selected encodings name ('default' will be returned if engine not configured) or NULL in case of error. + */ +const char *rccConfigGetSelectedCharsetName(rcc_language_config config, rcc_class_id class_id); +/** + * Return current encoding_id. The default value will be resolved to paticular encoding id. + * The following procedure is used to detect default encoding: + * - If Unicode encoding selected for the same class english language. Return this encoding. + * - If the parent class is defined in #defcharset, - return current encoding of parent class. + * - If the locale variable is defined in #defcharset and either config language coincide with locale language or unciode encoding defined, use locale encoding. + * - If the default value for config language is defined in #defvalue return that default value. + * - If the default value for all languages is defined in #defvalue return that default value. + * - If either config language is coincide with locale language or unicode locale is used, return locale encoding. + * - Return first by the list non-dissabled encoding. + * + * @param config is language configuration + * @param class_id is encoding class + * @return selected charset id [1-n] or -1 in case of error + */ +rcc_charset_id rccConfigGetCurrentCharset(rcc_language_config config, rcc_class_id class_id); +/** + * Return current encoding name. + * @see rccConfigGetCurrentCharset + * + * @param config is language configuration + * @param class_id is encoding class + * @return current charset name or NULL in case of error. + */ +const char *rccConfigGetCurrentCharsetName(rcc_language_config config, rcc_class_id class_id); + +/** + * Set current engine. + * + * @param config is language configuration + * @param engine_id is new language id [-1-n]. If -1 supplied the engine will go in non-configured state. + * @return non-zero value in case of error + */ +int rccConfigSetEngine(rcc_language_config config, rcc_engine_id engine_id); +/** + * Set current encoding. + * + * @param config is language configuration + * @param class_id is encoding class + * @param charset_id is new charset id [0-n]. The 0 will switch charset to encoding state. + * @return non-zero value in case of error + */ +int rccConfigSetCharset(rcc_language_config config, rcc_class_id class_id, rcc_charset_id charset_id); +/** + * Set current engine by name. + * + * @param config is language configuration + * @param name is the short name of new engine ("default" is okey). + * @return non-zero value in case of error + */ +int rccConfigSetEngineByName(rcc_language_config config, const char *name); +/** + * Set current encoding by name. + * + * @param config is language configuration + * @param class_id is encoding class + * @param name is the short name of new encoding ("default" is okey). + * @return non-zero value in case of error + */ +int rccConfigSetCharsetByName(rcc_language_config config, rcc_class_id class_id, const char *name); + +/** + * Function will return encoding id of charset specified by locale configuration. + * + * @param config is language configuration + * @param locale_variable is locale variable (Default(NULL) is LC_CTYPE) + * @return encoding id + */ +rcc_charset_id rccConfigGetLocaleCharset(rcc_language_config config, const char *locale_variable); +/** + * Function will return encoding id of charset specified by locale configuration. + * + * @param config is language configuration + * @param class_id is encoding class + * @param locale_variable is locale variable (Default(NULL) is LC_CTYPE) + * @return encoding id + */ +rcc_charset_id rccConfigGetLocaleClassCharset(rcc_language_config config, rcc_class_id class_id, const char *locale_variable); + +/* curconfig.c */ +int rccGetCharsetNumber(rcc_context ctx); +int rccGetClassCharsetNumber(rcc_context ctx, rcc_class_id class_id); +int rccGetEngineNumber(rcc_context ctx); + +const char *rccGetEngineName(rcc_context ctx, rcc_engine_id engine_id); +const char *rccGetCharsetName(rcc_context ctx, rcc_charset_id charset_id); +const char *rccGetClassCharsetName(rcc_context ctx, rcc_class_id class_id, rcc_charset_id charset_id); + +rcc_engine_id rccGetEngineByName(rcc_context ctx, const char *name); +rcc_charset_id rccGetCharsetByName(rcc_context ctx, const char *name); +rcc_charset_id rccGetClassCharsetByName(rcc_context ctx, rcc_class_id class_id, const char *name); + +int rccIsDisabledCharset(rcc_context ctx, rcc_class_id class_id, rcc_charset_id charset_id); + +rcc_engine_id rccGetSelectedEngine(rcc_context ctx); +const char *rccGetSelectedEngineName(rcc_context ctx); +rcc_engine_id rccGetCurrentEngine(rcc_context ctx); +const char *rccGetCurrentEngineName(rcc_context ctx); +rcc_charset_id rccGetSelectedCharset(rcc_context ctx, rcc_class_id class_id); +const char *rccGetSelectedCharsetName(rcc_context ctx, rcc_class_id class_id); +rcc_charset_id rccGetCurrentCharset(rcc_context ctx, rcc_class_id class_id); +const char *rccGetCurrentCharsetName(rcc_context ctx, rcc_class_id class_id); + +int rccSetEngine(rcc_context ctx, rcc_engine_id engine_id); +int rccSetCharset(rcc_context ctx, rcc_class_id class_id, rcc_charset_id charset_id); +int rccSetEngineByName(rcc_context ctx, const char *name); +int rccSetCharsetByName(rcc_context ctx, rcc_class_id class_id, const char *name); + +rcc_charset_id rccGetLocaleCharset(rcc_context ctx, const char *locale_variable); +rcc_charset_id rccGetLocaleClassCharset(rcc_context ctx, rcc_class_id class_id, const char *locale_variable); + +rcc_autocharset_id rccDetectCharset(rcc_context ctx, rcc_class_id class_id, const char *buf, size_t len); + +/******************************************************************************* +************************ Language Configuaration ******************************* +*******************************************************************************/ + +/******************************************************************************* +************************ RCC_STRING Manipulations ****************************** +*******************************************************************************/ +/* string.c */ +/** + * Intermediate string format. RCC_string can be manipulated as standard NULL terminated string. + * However it contains small header with information about string language. All strings are + * encoded using UTF-8 encoding. + */ +typedef char *rcc_string; +/** + * Intermediate string format. RCC_string can be manipulated as standard NULL terminated string. + * However it contains small header with information about string language. All strings are + * encoded using UTF-8 encoding. + */ +typedef const char *rcc_const_string; + +/** + * Check string header and verify if it is really correct #rcc_string. + * + * @param str is verifying string + */ +size_t rccStringCheck(const char *str); +/** + * Check string header and verify if it is really correct #rcc_string. + * + * @param str is verifying string + * @param len is preciese size of str. + * @return size of string in bytes or -1 if check failed + */ +size_t rccStringSizedCheck(const char *str, size_t len); + +/** + * Extract language from #rcc_string. + * + * @param str is #rcc_string + * @return size of string in bytes or -1 if check failed + */ +rcc_language_id rccStringGetLanguage(rcc_const_string str); +/** + * Returns pointer on UTF-8 string kept inside of #rcc_string. + * + * @param str is #rcc_string + * @return pointer on constant string or NULL in the case of error + */ +const char *rccStringGetString(rcc_const_string str); +/** + * Extract UTF-8 string from #rcc_string. + * + * @param str is #rcc_string + * @return pointer on string or NULL in the case of error. The string should be freed by the caller. + */ +char *rccStringExtractString(rcc_const_string str); + +/** + * If str is #rcc_string function will return pointer on UTF-8 string kept inside, otherwise + * pointer on the passed string is returned. + * + * @param str is null-terminated string + * @return pointer on constant string + */ +const char *rccGetString(const char *str); +/** + * If str is #rcc_string function will return pointer on UTF-8 string kept inside, otherwise + * pointer on the passed string is returned. + * + * @param str is string (perhaps not zero terminated) + * @param len is exact length of string or 0 (in this case length will be computed using 'strlen' + * @return pointer on constant string + */ +const char *rccSizedGetString(const char *str, size_t len); + +int rccStringCmp(const char *str1, const char *str2); +int rccStringNCmp(const char *str1, const char *str2, size_t n); +int rccStringCaseCmp(const char *str1, const char *str2); +int rccStringNCaseCmp(const char *str1, const char *str2, size_t n); + +/******************************************************************************* +******************************** Recoding ************************************** +*******************************************************************************/ +/* rcciconv.c */ + +/** + * recoding context + */ +typedef struct rcc_iconv_t *rcc_iconv; + +/** + * Open recoding context. + * + * @param from is source encoding + * @param to is destination encoding + * @result + * - NULL if no recoding is required + * - Pointer on initialized context if successful + */ +rcc_iconv rccIConvOpen(const char *from, const char *to); +/** + * Close recoding context. + * + * @param icnv is recoding context */ +void rccIConvClose(rcc_iconv icnv); +/** + * Recodes chunk of data. + * + * @param icnv is recoding context + * @param buf is data for recoding + * @param len is size of the data + * @param rlen is size of recoded data + * @return recoded string or NULL in the case of error + */ +char *rccIConv(rcc_iconv icnv, const char *buf, size_t len, size_t *rlen); + +/* rcctranslate.c */ + +/** + * translating context + */ +typedef struct rcc_translate_t *rcc_translate; + +/** + * Open translating context. + * + * @param from is source language + * @param to is destination language + * @return + * - NULL if translation is not required or possible + * - Pointer on initialized context if successful + */ +rcc_translate rccTranslateOpen(const char *from, const char *to); +/** + * Close translating context. + * + * @param translate is translating context + */ +void rccTranslateClose(rcc_translate translate); + +/* + * Set translation timeout + * + * @param translate is translating context + * @param us is timeout in microseconds (0 - no timeout) + * @return non-zero value is returned in the case of errror + */ +int rccTranslateSetTimeout(rcc_translate translate, unsigned long us); + +/* + * Allows translation engine to perform pending task after the main program is + * being terminated + * + * @param translate is translating context + * @return non-zero value is returned in the case of errror + */ +int rccTranslateAllowOfflineMode(rcc_translate translate); + +/** + * Translate string. + * + * @param translate is translating context + * @param buf is UTF-8 encoded string for translating + * @return recoded string or NULL in the case of error + */ +char *rccTranslate(rcc_translate translate, const char *buf); + + +/* rccspell.c */ + +/** + * spelling context + */ +typedef struct rcc_speller_t *rcc_speller; + +/** + * result of spelling + */ +typedef enum rcc_speller_result_t { + RCC_SPELLER_INCORRECT = 0, /**< Word not found in dictionaries */ + RCC_SPELLER_ALMOST_PARENT, /**< Similliar word is found in parents dictionary */ + RCC_SPELLER_ALMOST_CORRECT, /**< Similliar word is found in dictionary */ + RCC_SPELLER_PARENT, /**< Word is found in parent dictionary */ + RCC_SPELLER_CORRECT /**< Word is found in dictionary */ +} rcc_speller_result; + +int rccSpellerResultIsOwn(rcc_speller_result res); +int rccSpellerResultIsPrecise(rcc_speller_result res); +int rccSpellerResultIsCorrect(rcc_speller_result res); + +/** + * Open spelling context. + * + * @param lang is language + * @return + * - NULL if language is not supported and in the case of error. + * - Pointer on initialized context if successful + */ +rcc_speller rccSpellerCreate(const char *lang); +/** + * Close spelling context. + * + * @param speller is spelling context + */ +void rccSpellerFree(rcc_speller speller); +/** + * Add parent to the spelling context. + * + * @param speller is spelling context + * @param parent is parent spelling context + * @return non-zero value in the case of error + */ +int rccSpellerAddParent(rcc_speller speller, rcc_speller parent); +/** + * Spell a word. + * + * @param speller is spelling context + * @param word is UTF-8 encoded word for spelling + * @return FALSE if word is not found in dictionary + */ +rcc_speller_result rccSpeller(rcc_speller speller, const char *word); + +/* recode.c */ + +/** + * Tries to detect language of string + * @param ctx is working context ( or default one if NULL supplied ) + * @param class_id is encoding class + * @param buf is original string (perhaps not zero terminated) + * @param len is exact size of string or 0. In the last case the size is determined using 'strlen' function. + * @result is language_id or -1 if autodetection is failed + */ +rcc_language_id rccDetectLanguage(rcc_context ctx, rcc_class_id class_id, const char *buf, size_t len); + +/** + * Tries to detect charset of string + * @param config is language configuration + * @param class_id is encoding class + * @param buf is original string (perhaps not zero terminated) + * @param len is exact size of string or 0. In the last case the size is determined using 'strlen' function. + * @result is auto_charset_id or -1 if autodetection is failed + */ +rcc_autocharset_id rccConfigDetectCharset(rcc_language_config config, rcc_class_id class_id, const char *buf, size_t len); + +/** + * Recode string from specified encoding class to #rcc_string. Encoding detection engines and + * recoding cache are used (if possible) to detect original 'buf' encoding. Otherwise the + * preconfigured encoding of class is assumed. + * + * @param ctx is working context ( or default one if NULL supplied ) + * @param class_id is encoding class + * @param buf is original string (perhaps not zero terminated) + * @param len is exact size of string or 0. In the last case the size is determined using 'strlen' function. + * @result is recoded string or NULL if recoding is not required or failed. It is up to the caller to free memory. + */ +rcc_string rccSizedFrom(rcc_context ctx, rcc_class_id class_id, const char *buf, size_t len); +/** + * Recode string from #rcc_string to specified encoding class. If encoding class is of + * 'File System' type, the autoprobing for file names can be performed. In the other cases + * the rcc_string will be recoded in preconfigured class encoding. + * + * @param ctx is working context ( or default one if NULL supplied ) + * @param class_id is encoding class + * @param buf is original zero terminated string + * @param rlen in rlen the size of recoded string will be returned. + * @result is recoded string or NULL if recoding is not required or failed. It is up to the caller to free memory. + */ +char *rccSizedTo(rcc_context ctx, rcc_class_id class_id, rcc_const_string buf, size_t *rlen); +/** + * Recode string between different encoding classes. The conversion is relays on rccSizedFrom + * and rccSizedTo functions. + * @see rccSizedFrom + * @see rccSizedTo + * + * @param ctx is working context ( or default one if NULL supplied ) + * @param from is source encoding class + * @param to is destination encoding class + * @param buf is original string (perhaps not zero terminated) + * @param len is exact size of string or 0. In the last case the size is determined using 'strlen' function. + * @param rlen in rlen the size of recoded string will be returned. + * @result is recoded string or NULL if recoding is not required or failed. It is up to the caller to free memory. + */ +char *rccSizedRecode(rcc_context ctx, rcc_class_id from, rcc_class_id to, const char *buf, size_t len, size_t *rlen); +/** + * Recode file name between different encoding classes. Normally, should be used to convert + * string from the file list to real file system names. The autoprobing of names is enabled + * depending on the output encoding class configuration and current options. + * @see rcc_class_t + * @see rcc_class_type_t + * @see rcc_option_t + + * The conversion is partly relays on rccSizedFrom. + * @see rccSizedFrom + * + * @param ctx is working context ( or default one if NULL supplied ) + * @param from is source encoding class + * @param to is destination encoding class + * @param fspath is path to the filesystem where file are located. + * @param path is file path + * @param filename is file name + * @result is recoded file name or NULL if recoding is not required or failed. It is up to the caller to free memory. + */ +char *rccFS(rcc_context ctx, rcc_class_id from, rcc_class_id to, const char *fspath, const char *path, const char *filename); + +/** + * Recode string from specified encoding to #rcc_string. + * + * @param ctx is working context ( or default one if NULL supplied ) + * @param charset is source encoding + * @param buf is original string (perhaps not zero terminated) + * @param len is exact size of string or 0. In the last case the size is determined using 'strlen' function. + * @result is recoded string or NULL if recoding is not required or failed. It is up to the caller to free memory. + */ +rcc_string rccSizedFromCharset(rcc_context ctx, const char *charset, const char *buf, size_t len); +/** + * Recode string from #rcc_string to specified encoding. + * + * @param ctx is working context ( or default one if NULL supplied ) + * @param charset is destination encoding + * @param buf is original zero terminated string + * @param rlen in rlen the size of recoded string will be returned. + * @result is recoded string or NULL if recoding is not required or failed. It is up to the caller to free memory. + */ +char *rccSizedToCharset(rcc_context ctx, const char *charset, rcc_const_string buf, size_t *rlen); +/** + * Recode string between specified encoding class and encoding. + * + * The conversion is partly relays on rccSizedFrom. + * @see rccSizedFrom + * + * @param ctx is working context ( or default one if NULL supplied ) + * @param class_id is source encoding class + * @param charset is destination encoding + * @param buf is original string (perhaps not zero terminated) + * @param len is exact size of string or 0. In the last case the size is determined using 'strlen' function. + * @param rlen in rlen the size of recoded string will be returned. + * @result is recoded string or NULL if recoding is not required or failed. It is up to the caller to free memory. + */ +char *rccSizedRecodeToCharset(rcc_context ctx, rcc_class_id class_id, const char *charset, rcc_const_string buf, size_t len, size_t *rlen); +/** + * Recode string between specified encoding and encoding class. + * + * The conversion is partly relays on rccSizedTo + * @see rccSizedTo + * + * @param ctx is working context ( or default one if NULL supplied ) + * @param class_id is destination encoding class + * @param charset is source encoding + * @param buf is original string (perhaps not zero terminated) + * @param len is exact size of string or 0. In the last case the size is determined using 'strlen' function. + * @param rlen in rlen the size of recoded string will be returned. + * @result is recoded string or NULL if recoding is not required or failed. It is up to the caller to free memory. + */ +rcc_string rccSizedRecodeFromCharset(rcc_context ctx, rcc_class_id class_id, const char *charset, const char *buf, size_t len, size_t *rlen); +/** + * Recode string between specified encodings. + * + * @param ctx is working context ( or default one if NULL supplied ) + * @param from is source encoding + * @param to is destination encoding + * @param buf is original string (perhaps not zero terminated) + * @param len is exact size of string or 0. In the last case the size is determined using 'strlen' function. + * @param rlen in rlen the size of recoded string will be returned. + * @result is recoded string or NULL if recoding is not required or failed. It is up to the caller to free memory. + */ +char *rccSizedRecodeCharsets(rcc_context ctx, const char *from, const char *to, const char *buf, size_t len, size_t *rlen); + + +/** + * Recode string from specified encoding class to #rcc_string. Encoding detection engines and + * recoding cache are used (if possible) to detect original 'buf' encoding. Otherwise the + * preconfigured encoding of class is assumed. + * + * @param config is language configuration + * @param class_id is encoding class + * @param buf is original string (perhaps not zero terminated) + * @param len is exact size of string or 0. In the last case the size is determined using 'strlen' function. + * @result is recoded string or NULL if recoding is not required or failed. It is up to the caller to free memory. + */ +rcc_string rccConfigSizedFrom(rcc_language_config config, rcc_class_id class_id, const char *buf, size_t len); +/** + * Recode string from #rcc_string to specified encoding class. If encoding class is of + * 'File System' type, the autoprobing for file names can be performed. In the other cases + * the rcc_string will be recoded in preconfigured class encoding. + * + * @param config is language configuration + * @param class_id is encoding class + * @param buf is original zero terminated string + * @param rlen in rlen the size of recoded string will be returned. + * @result is recoded string or NULL if recoding is not required or failed. It is up to the caller to free memory. + */ +char *rccConfigSizedTo(rcc_language_config config, rcc_class_id class_id, rcc_const_string buf, size_t *rlen); +/** + * Recode string between different encoding classes. The conversion is relays on rccConfigSizedFrom + * and rccConfigSizedTo functions. + * @see rccConfigSizedFrom + * @see rccConfigSizedTo + * + * @param config is language configuration + * @param from is source encoding class + * @param to is destination encoding class + * @param buf is original string (perhaps not zero terminated) + * @param len is exact size of string or 0. In the last case the size is determined using 'strlen' function. + * @param rlen in rlen the size of recoded string will be returned. + * @result is recoded string or NULL if recoding is not required or failed. It is up to the caller to free memory. + */ +char *rccConfigSizedRecode(rcc_language_config config, rcc_class_id from, rcc_class_id to, const char *buf, size_t len, size_t *rlen); +/** + * Recode string from specified encoding to #rcc_string. + * + * @param config is language configuration + * @param class_id is encoding class + * @param charset is source encoding + * @param buf is original string (perhaps not zero terminated) + * @param len is exact size of string or 0. In the last case the size is determined using 'strlen' function. + * @param rlen in rlen the size of recoded string will be returned. + * @result is recoded string or NULL if recoding is not required or failed. It is up to the caller to free memory. + */ +rcc_string rccConfigSizedRecodeFromCharset(rcc_language_config config, rcc_class_id class_id, const char *charset, const char *buf, size_t len, size_t *rlen); +/** + * Recode string from #rcc_string to specified encoding. + * + * @param config is language configuration + * @param class_id is encoding class + * @param charset is destination encoding + * @param buf is original zero terminated string + * @param len is exact size of string or 0. In the last case the size is determined using 'strlen' function. + * @param rlen in rlen the size of recoded string will be returned. + * @result is recoded string or NULL if recoding is not required or failed. It is up to the caller to free memory. + */ +char *rccConfigSizedRecodeToCharset(rcc_language_config config, rcc_class_id class_id, const char *charset, rcc_const_string buf, size_t len, size_t *rlen); + + +#define rccFrom(ctx, class_id, buf) rccSizedFrom(ctx, class_id, buf, 0) +#define rccTo(ctx, class_id, buf) rccSizedTo(ctx, class_id, buf, NULL) +#define rccRecode(ctx, from, to, buf) rccSizedRecode(ctx, from, to, buf, 0, NULL) + +#define rccFromCharset(ctx, charset, buf) rccSizedFromCharset(ctx, charset, buf, 0) +#define rccToCharset(ctx, charset, buf) rccSizedToCharset(ctx, charset, buf, NULL) +#define rccRecodeToCharset(ctx, class_id, charset, buf) rccSizedRecodeToCharset(ctx, class_id, charset, buf, 0, NULL) +#define rccRecodeFromCharset(ctx, class_id, charset, buf) rccSizedRecodeFromCharset(ctx, class_id, charset, buf, 0, NULL) +#define rccRecodeCharsets(ctx, from, to, buf) rccSizedRecodeCharsets(ctx, from, to, buf, 0, NULL) + +#define rccConfigFrom(ctx, class_id, buf) rccConfigSizedFrom(ctx, class_id, buf, 0) +#define rccConfigTo(ctx, class_id, buf) rccConfigSizedTo(ctx, class_id, buf, NULL) +#define rccConfigRecode(ctx, from, to, buf) rccConfigSizedRecode(ctx, from, to, buf, 0, NULL) +#define rccConfigRecodeToCharset(ctx, class_id, charset, buf) rccConfigSizedRecodeToCharset(ctx, class_id, charset, buf, 0, NULL) +#define rccConfigRecodeFromCharset(ctx, class_id, charset, buf) rccConfigSizedRecodeFromCharset(ctx, class_id, charset, buf, 0, NULL) + +/******************************************************************************* +******************************** Options *************************************** +*******************************************************************************/ + +/* xml.c */ +typedef void *rcc_config; +rcc_config rccGetConfiguration(); + +/** + * Save Configuration. + * + * @param ctx is working context ( or default one if NULL supplied ) + * @param name is configuration file name ( can be shared between multiple applications! ) + * @return non-zero in the case of errors. + */ +int rccSave(rcc_context ctx, const char *name); +/** + * Load Configuration. + * + * @param ctx is working context ( or default one if NULL supplied ) + * @param name is configuration file name ( can be shared between multiple applications! ) + * @return non-zero in the case of errors. + */ +int rccLoad(rcc_context ctx, const char *name); + +/******************************************************************************* +**************************** Engine Plugins ************************************ +*******************************************************************************/ + +typedef rcc_engine *(*rcc_plugin_engine_info_function)(const char *lang); + +rcc_engine_internal rccEngineGetInternal(rcc_engine_context ctx); +rcc_language *rccEngineGetLanguage(rcc_engine_context ctx); +rcc_context rccEngineGetRccContext(rcc_engine_context ctx); +rcc_engine *rccEngineGetInfo(rcc_engine_context ctx); +rcc_autocharset_id rccEngineGetAutoCharsetByName(rcc_engine_context ctx, const char *name); + + +/******************************************************************************* +**************************** Configuration ************************************* +*******************************************************************************/ + +/** + * The Berkley DB support is compiled in + */ +#define RCC_CC_FLAG_HAVE_BERKLEY_DB 0x01 +/** + * The dynamic engine plugins support is compiled in + */ +#define RCC_CC_FLAG_HAVE_DYNAMIC_ENGINES 0x02 +/** + * Enca engine is compiled in + */ +#define RCC_CC_FLAG_HAVE_ENCA 0x04 +/** + * LibRCD engine is compiled in + */ +#define RCC_CC_FLAG_HAVE_RCD 0x08 +/** + * Libtranslate translation engine compiled in + */ +#define RCC_CC_FLAG_HAVE_LIBTRANSLATE 0x10 + +/** + * The library build environment is represented by this structure + */ +struct rcc_compiled_configuration_t { + unsigned long flags; /**< compilation flags */ +}; +typedef struct rcc_compiled_configuration_t rcc_compiled_configuration_s; +typedef const struct rcc_compiled_configuration_t *rcc_compiled_configuration; + +/** + * Get information about library compilation environment + */ +rcc_compiled_configuration rccGetCompiledConfiguration(); + +int rccLocaleGetClassByName(const char *locale); +int rccLocaleGetLanguage(char *result, const char *lv, unsigned int n); +int rccLocaleGetCharset(char *result, const char *lv, unsigned int n); + + +/** + * For compatibilty reasons + */ +#define RCC_OPTION_TRANSLATE_SKIP_PARRENT RCC_OPTION_TRANSLATE_SKIP_PARENT +#define RCC_SPELLER_ALMOST_PARRENT RCC_SPELLER_ALMOST_PARENT +#define RCC_SPELLER_PARRENT RCC_SPELLER_PARENT +#define rccSpellerAddParrent rccSpellerAddParent + +#ifdef __cplusplus +} +#endif + +#endif /* _LIBRCC_H */ diff --git a/app-arch/unzip/files/unzip-5.50-dotdot.patch b/app-arch/unzip/files/unzip-5.50-dotdot.patch new file mode 100644 index 0000000..962a302 --- /dev/null +++ b/app-arch/unzip/files/unzip-5.50-dotdot.patch @@ -0,0 +1,84 @@ +Only in unzip-5.50-lhh/: cscope.files +Only in unzip-5.50-lhh/: cscope.out +diff -ur unzip-5.50/unix/unix.c unzip-5.50-lhh/unix/unix.c +--- unzip-5.50/unix/unix.c 2002-01-21 17:54:42.000000000 -0500 ++++ unzip-5.50-lhh/unix/unix.c 2003-06-11 18:35:38.000000000 -0400 +@@ -421,7 +421,8 @@ + */ + { + char pathcomp[FILNAMSIZ]; /* path-component buffer */ +- char *pp, *cp=(char *)NULL; /* character pointers */ ++ char *pp, *cp=(char *)NULL, /* character pointers */ ++ *dp=(char *)NULL; + char *lastsemi=(char *)NULL; /* pointer to last semi-colon in pathcomp */ + #ifdef ACORN_FTYPE_NFS + char *lastcomma=(char *)NULL; /* pointer to last comma in pathcomp */ +@@ -429,6 +430,7 @@ + #endif + int quote = FALSE; /* flags */ + int killed_ddot = FALSE; /* is set when skipping "../" pathcomp */ ++ int snarf_ddot = FALSE; /* Is set while scanning for "../" */ + int error = MPN_OK; + register unsigned workch; /* hold the character being tested */ + +@@ -467,6 +469,9 @@ + while ((workch = (uch)*cp++) != 0) { + + if (quote) { /* if character quoted, */ ++ if ((pp == pathcomp) && (workch == '.')) ++ /* Oh no you don't... */ ++ goto ddot_hack; + *pp++ = (char)workch; /* include it literally */ + quote = FALSE; + } else +@@ -481,15 +486,44 @@ + break; + + case '.': +- if (pp == pathcomp) { /* nothing appended yet... */ ++ if (pp == pathcomp) { ++ddot_hack: ++ /* nothing appended yet... */ + if (*cp == '/') { /* don't bother appending "./" to */ + ++cp; /* the path: skip behind the '/' */ + break; +- } else if (!uO.ddotflag && *cp == '.' && cp[1] == '/') { +- /* "../" dir traversal detected */ +- cp += 2; /* skip over behind the '/' */ +- killed_ddot = TRUE; /* set "show message" flag */ +- break; ++ } else if (!uO.ddotflag) { ++ ++ /* ++ * SECURITY: Skip past control characters if the user ++ * didn't OK use of absolute pathnames. lhh - this is ++ * a very quick, ugly, inefficient fix. ++ */ ++ dp = cp; ++ do { ++ workch = (uch)(*dp); ++ if (workch == '/' && snarf_ddot) { ++ /* "../" dir traversal detected */ ++ cp = dp + 1; /* skip past the '/' */ ++ killed_ddot = TRUE; /* set "show msg" flag */ ++ break; ++ } else if (workch == '.' && !snarf_ddot) { ++ snarf_ddot = TRUE; ++ } else if (isprint(workch) || ++ ((workch > 127) && (workch <= 254))) { ++ /* ++ * Since we found a printable, non-ctrl char, ++ * we can stop looking for '../', the amount ++ * in ../! ++ */ ++ break; ++ } ++ ++ dp++; ++ } while (*dp != 0); ++ ++ if (killed_ddot) ++ break; + } + } + *pp++ = '.'; diff --git a/app-arch/unzip/files/unzip-5.52-CVE-2008-0888.patch b/app-arch/unzip/files/unzip-5.52-CVE-2008-0888.patch new file mode 100644 index 0000000..368b3ee --- /dev/null +++ b/app-arch/unzip/files/unzip-5.52-CVE-2008-0888.patch @@ -0,0 +1,35 @@ +http://bugs.gentoo.org/213761 + +fix for CVE-2008-0888 + +--- inflate.c ++++ inflate.c +@@ -983,6 +983,7 @@ + unsigned l; /* last length */ + unsigned m; /* mask for bit lengths table */ + unsigned n; /* number of lengths to get */ ++ struct huft *tlp; + struct huft *tl; /* literal/length code table */ + struct huft *td; /* distance code table */ + unsigned bl; /* lookup bits for tl */ +@@ -996,6 +997,8 @@ + int retval = 0; /* error code returned: initialized to "no error" */ + + ++ td = tlp = tl = (struct huft *)NULL; ++ + /* make local bit buffer */ + Trace((stderr, "\ndynamic block")); + b = G.bb; +@@ -1047,9 +1050,9 @@ + while (i < n) + { + NEEDBITS(bl) +- j = (td = tl + ((unsigned)b & m))->b; ++ j = (tlp = tl + ((unsigned)b & m))->b; + DUMPBITS(j) +- j = td->v.n; ++ j = tlp->v.n; + if (j < 16) /* length of code in bits (0..15) */ + ll[i++] = l = j; /* save last length in l */ + else if (j == 16) /* repeat last length 3 to 6 times */ diff --git a/app-arch/unzip/files/unzip-5.52-ds-rusxmms.patch b/app-arch/unzip/files/unzip-5.52-ds-rusxmms.patch new file mode 100644 index 0000000..8d55b94 --- /dev/null +++ b/app-arch/unzip/files/unzip-5.52-ds-rusxmms.patch @@ -0,0 +1,150 @@ +diff -dPNur unzip-5.52/fileio.c unzip-5.52-ds/fileio.c +--- unzip-5.52/fileio.c 2005-02-27 03:10:12.000000000 +0100 ++++ unzip-5.52-ds/fileio.c 2008-04-11 22:25:31.000000000 +0200 +@@ -78,7 +78,7 @@ + # endif + #endif + #include "ebcdic.h" /* definition/initialization of ebcdic[] */ +- ++#include "dsrecode.h" + + /* + Note: Under Windows, the maximum size of the buffer that can be used +diff -dPNur unzip-5.52/unzpriv.h unzip-5.52-ds/unzpriv.h +--- unzip-5.52/unzpriv.h 2005-02-04 00:26:42.000000000 +0100 ++++ unzip-5.52-ds/unzpriv.h 2008-04-11 22:25:31.000000000 +0200 +@@ -2564,9 +2564,9 @@ + ((hostver) == 25 || (hostver) == 26 || (hostver) == 40))) || \ + (hostnum) == FS_HPFS_ || \ + ((hostnum) == FS_NTFS_ && (hostver) == 50)) { \ +- _OEM_INTERN((string)); \ ++ _DS_OEM_INTERN((string)); \ + } else { \ +- _ISO_INTERN((string)); \ ++ _DS_ISO_INTERN((string)); \ + } + #endif + +diff -dPNur unzip-5.52/dsrecode.h unzip-5.52-ds/dsrecode.h +--- unzip-5.52/dsrecode.h 1970-01-01 01:00:00.000000000 +0100 ++++ unzip-5.52-ds/dsrecode.h 2008-04-11 22:24:24.000000000 +0200 +@@ -0,0 +1,119 @@ ++#include "librcc.h" ++ ++static rcc_class_default_charset default_oem[] = { ++ { "ru", "IBM866" }, ++ { NULL, NULL } ++}; ++ ++static rcc_class_default_charset default_iso[] = { ++ { "ru", "CP1251" }, ++ { NULL, NULL } ++}; ++ ++#define OEM_CLASS 0 ++#define ISO_CLASS 1 ++#define OUT_CLASS 2 ++static rcc_class classes[] = { ++ { "oem", RCC_CLASS_STANDARD, NULL, default_oem, "OEM_INTERN", 0 }, ++ { "iso", RCC_CLASS_STANDARD, NULL, default_iso, "ISO_INTERN", 0 }, ++ { "out", RCC_CLASS_STANDARD, "LC_CTYPE", NULL, "Output", 0 }, ++ { NULL } ++}; ++ ++int initialized = 0; ++ ++#ifdef RCC_LAZY ++#include <dlfcn.h> ++# define RCC_LIBRARY "librcc.so.0" ++int (*rccInit2)(); ++int (*rccFree2)(); ++int (*rccInitDefaultContext2)(const char *locale_variable, unsigned int max_languages, unsigned int max_classes, rcc_class_ptr defclasses, rcc_init_flags flags); ++int (*rccInitDb42)(rcc_context ctx, const char *name, rcc_db4_flags flags); ++char* (*rccSizedRecode2)(rcc_context ctx, rcc_class_id from, rcc_class_id to, const char *buf, size_t len, size_t *rlen); ++int (*rccLoad2)(rcc_context ctx, const char *name); ++ ++ ++static char *rccRecode2(rcc_context ctx, rcc_class_id from, rcc_class_id to, const char *buf) { ++ return rccSizedRecode2(ctx, from, to, buf, 0, NULL); ++} ++ ++void *rcc_handle; ++#else /* RCC_LAZY */ ++#define rccInit2 rccInit ++#define rccFree2 rccFree ++#define rccInitDefaultContext2 rccInitDefaultContext ++#define rccInitDb42 rccInitDb4 ++#define rccRecode2 rccRecode ++#define rccLoad2 rccLoad ++#endif /* RCC_LAZY */ ++ ++static void rccUnzipFree() { ++ if (initialized > 0) { ++ rccFree2(); ++#ifdef RCC_LAZY ++ dlclose(rcc_handle); ++#endif /* RCC_LAZY */ ++ initialized = 0; ++ } ++} ++ ++ ++static int rccUnzipInit() { ++ if (initialized) return 0; ++ ++#ifdef RCC_LAZY ++ rcc_handle = dlopen("/usr/lib/" RCC_LIBRARY, RTLD_NOW); ++ if (!rcc_handle) rcc_handle = dlopen("/usr/local/lib/" RCC_LIBRARY, RTLD_NOW); ++ if (!rcc_handle) { ++ initialized = -1; ++ return 1; ++ } ++ ++ rccInit2 = dlsym(rcc_handle, "rccInit"); ++ rccFree2 = dlsym(rcc_handle, "rccFree"); ++ rccInitDefaultContext2 = dlsym(rcc_handle, "rccInitDefaultContext"); ++ rccInitDb42 = dlsym(rcc_handle, "rccInitDb4"); ++ rccSizedRecode2 = dlsym(rcc_handle, "rccSizedRecode"); ++ rccLoad2 = dlsym(rcc_handle, "rccLoad"); ++ ++ if ((!rccInit2)||(!rccFree2)||(!rccInitDefaultContext2)||(!rccInitDb42)||(!rccSizedRecode2)||(!rccLoad2)) { ++ dlclose(rcc_handle); ++ initialized = -1; ++ return 1; ++ } ++#endif /* RCC_LAZY */ ++ ++ rccInit2(); ++ rccInitDefaultContext2(NULL, 0, 0, classes, 0); ++ rccLoad2(NULL, "zip"); ++ rccInitDb42(NULL, NULL, 0); ++ atexit(rccUnzipFree); ++ initialized = 1; ++ return 0; ++} ++ ++ ++ ++void _DS_OEM_INTERN(char *string) { ++ char *str; ++ rccUnzipInit(); ++ if (initialized>0) { ++ str = rccRecode2(NULL, OEM_CLASS, OUT_CLASS, string); ++ if (str) { ++ strncpy(string,str,FILNAMSIZ); ++ free(str); ++ } ++ } ++} ++ ++void _DS_ISO_INTERN(char *string) { ++ char *str; ++ rccUnzipInit(); ++ if (initialized>0) { ++ str = rccRecode2(NULL, ISO_CLASS, OUT_CLASS, string); ++ if (str) { ++ strncpy(string,str,FILNAMSIZ); ++ free(str); ++ } ++ } ++} diff --git a/app-arch/unzip/files/unzip-5.52-ds-rusxmms2.patch b/app-arch/unzip/files/unzip-5.52-ds-rusxmms2.patch new file mode 100644 index 0000000..6670a10 --- /dev/null +++ b/app-arch/unzip/files/unzip-5.52-ds-rusxmms2.patch @@ -0,0 +1,149 @@ +diff -dPNur unzip-5.52/fileio.c unzip-5.52-ds/fileio.c +--- unzip-5.52/fileio.c 2005-02-27 03:10:12.000000000 +0100 ++++ unzip-5.52-ds/fileio.c 2008-04-11 22:25:31.000000000 +0200 +@@ -78,7 +78,7 @@ + # endif + #endif + #include "ebcdic.h" /* definition/initialization of ebcdic[] */ +- ++#include "dsrecode.h" + + /* + Note: Under Windows, the maximum size of the buffer that can be used +diff -dPNur unzip-5.52/unzpriv.h unzip-5.52-ds/unzpriv.h +--- unzip-5.52/unzpriv.h 2005-02-04 00:26:42.000000000 +0100 ++++ unzip-5.52-ds/unzpriv.h 2008-04-11 22:25:31.000000000 +0200 +@@ -2564,9 +2564,9 @@ + ((hostver) == 25 || (hostver) == 26 || (hostver) == 40))) || \ + (hostnum) == FS_HPFS_ || \ + ((hostnum) == FS_NTFS_ && (hostver) == 50)) { \ +- _OEM_INTERN((string)); \ ++ _DS_OEM_INTERN((string)); \ + } else { \ +- _ISO_INTERN((string)); \ ++ _DS_ISO_INTERN((string)); \ + } + #endif + +diff -dPNur unzip-5.52/dsrecode.h unzip-5.52-ds/dsrecode.h +--- unzip-5.52/dsrecode.h 1970-01-01 01:00:00.000000000 +0100 ++++ unzip-5.52-ds/dsrecode.h 2008-04-11 22:24:24.000000000 +0200 +@@ -0,0 +1,118 @@ ++#include "librcc.h" ++ ++static rcc_class_default_charset default_oem[] = { ++ { "ru", "IBM866" }, ++ { NULL, NULL } ++}; ++ ++static rcc_class_default_charset default_iso[] = { ++ { "ru", "CP1251" }, ++ { NULL, NULL } ++}; ++ ++#define OEM_CLASS 0 ++#define ISO_CLASS 1 ++#define OUT_CLASS 2 ++static rcc_class classes[] = { ++ { "oem", RCC_CLASS_STANDARD, NULL, default_oem, "OEM_INTERN", 0 }, ++ { "iso", RCC_CLASS_STANDARD, NULL, default_iso, "ISO_INTERN", 0 }, ++ { "out", RCC_CLASS_STANDARD, "LC_CTYPE", NULL, "Output", 0 }, ++ { NULL } ++}; ++ ++int initialized = 0; ++ ++#ifdef RCC_LAZY ++#include <dlfcn.h> ++# define RCC_LIBRARY "librcc.so.0" ++int (*rccInit2)(); ++int (*rccFree2)(); ++int (*rccInitDefaultContext2)(const char *locale_variable, unsigned int max_languages, unsigned int max_classes, rcc_class_ptr defclasses, rcc_init_flags flags); ++int (*rccInitDb42)(rcc_context ctx, const char *name, rcc_db4_flags flags); ++char* (*rccSizedRecode2)(rcc_context ctx, rcc_class_id from, rcc_class_id to, const char *buf, size_t len, size_t *rlen); ++int (*rccLoad2)(rcc_context ctx, const char *name); ++ ++ ++static char *rccRecode2(rcc_context ctx, rcc_class_id from, rcc_class_id to, const char *buf) { ++ return rccSizedRecode2(ctx, from, to, buf, 0, NULL); ++} ++ ++void *rcc_handle; ++#else /* RCC_LAZY */ ++#define rccInit2 rccInit ++#define rccFree2 rccFree ++#define rccInitDefaultContext2 rccInitDefaultContext ++#define rccInitDb42 rccInitDb4 ++#define rccRecode2 rccRecode ++#define rccLoad2 rccLoad ++#endif /* RCC_LAZY */ ++ ++static void rccUnzipFree() { ++ if (initialized > 0) { ++ rccFree2(); ++#ifdef RCC_LAZY ++ dlclose(rcc_handle); ++#endif /* RCC_LAZY */ ++ initialized = 0; ++ } ++} ++ ++ ++static int rccUnzipInit() { ++ if (initialized) return 0; ++ ++#ifdef RCC_LAZY ++ rcc_handle = dlopen(RCC_LIBRARY, RTLD_NOW); ++ if (!rcc_handle) { ++ initialized = -1; ++ return 1; ++ } ++ ++ rccInit2 = dlsym(rcc_handle, "rccInit"); ++ rccFree2 = dlsym(rcc_handle, "rccFree"); ++ rccInitDefaultContext2 = dlsym(rcc_handle, "rccInitDefaultContext"); ++ rccInitDb42 = dlsym(rcc_handle, "rccInitDb4"); ++ rccSizedRecode2 = dlsym(rcc_handle, "rccSizedRecode"); ++ rccLoad2 = dlsym(rcc_handle, "rccLoad"); ++ ++ if ((!rccInit2)||(!rccFree2)||(!rccInitDefaultContext2)||(!rccInitDb42)||(!rccSizedRecode2)||(!rccLoad2)) { ++ dlclose(rcc_handle); ++ initialized = -1; ++ return 1; ++ } ++#endif /* RCC_LAZY */ ++ ++ rccInit2(); ++ rccInitDefaultContext2(NULL, 0, 0, classes, 0); ++ rccLoad2(NULL, "zip"); ++ rccInitDb42(NULL, NULL, 0); ++ atexit(rccUnzipFree); ++ initialized = 1; ++ return 0; ++} ++ ++ ++ ++void _DS_OEM_INTERN(char *string) { ++ char *str; ++ rccUnzipInit(); ++ if (initialized>0) { ++ str = rccRecode2(NULL, OEM_CLASS, OUT_CLASS, string); ++ if (str) { ++ strncpy(string,str,FILNAMSIZ); ++ free(str); ++ } ++ } ++} ++ ++void _DS_ISO_INTERN(char *string) { ++ char *str; ++ rccUnzipInit(); ++ if (initialized>0) { ++ str = rccRecode2(NULL, ISO_CLASS, OUT_CLASS, string); ++ if (str) { ++ strncpy(string,str,FILNAMSIZ); ++ free(str); ++ } ++ } ++} diff --git a/app-arch/unzip/files/unzip-5.52-no-exec-stack.patch b/app-arch/unzip/files/unzip-5.52-no-exec-stack.patch new file mode 100644 index 0000000..e2869bf --- /dev/null +++ b/app-arch/unzip/files/unzip-5.52-no-exec-stack.patch @@ -0,0 +1,13 @@ +Make sure that the asm files don't incorrectly trigger an executable +stack marking in the final shared library. That's bad, mmmkay. + +--- unzip/crc_i386.S ++++ unzip/crc_i386.S +@@ -238,3 +238,7 @@ + #endif /* i386 || _i386 || _I386 || __i386 */ + + #endif /* !USE_ZLIB */ ++ ++#ifdef __ELF__ ++.section .note.GNU-stack,"",%progbits ++#endif diff --git a/app-arch/unzip/files/unzip-6.0-no-exec-stack.patch b/app-arch/unzip/files/unzip-6.0-no-exec-stack.patch new file mode 100644 index 0000000..7973378 --- /dev/null +++ b/app-arch/unzip/files/unzip-6.0-no-exec-stack.patch @@ -0,0 +1,13 @@ +Make sure that the asm files don't incorrectly trigger an executable +stack marking in the final shared library. That's bad, mmmkay. + +--- unzip/crc_i386.S ++++ unzip/crc_i386.S +@@ -302,3 +302,7 @@ + #endif /* i386 || _i386 || _I386 || __i386 */ + + #endif /* !USE_ZLIB && !CRC_TABLE_ONLY */ ++ ++#if defined(__linux__) && defined(__ELF__) ++.section .note.GNU-stack,"",%progbits ++#endif diff --git a/app-arch/unzip/files/unzip-ds-lazyrcc.patch b/app-arch/unzip/files/unzip-ds-lazyrcc.patch new file mode 100644 index 0000000..e2fbfa7 --- /dev/null +++ b/app-arch/unzip/files/unzip-ds-lazyrcc.patch @@ -0,0 +1,146 @@ +diff -dPNur unzip-5.52/dsrecode.h unzip-5.52-new/dsrecode.h +--- unzip-5.52/dsrecode.h 1970-01-01 01:00:00.000000000 +0100 ++++ unzip-5.52-new/dsrecode.h 2007-04-04 21:20:31.000000000 +0200 +@@ -0,0 +1,115 @@ ++#include <librcc.h> ++ ++static rcc_class_default_charset default_oem[] = { ++ { "ru", "IBM866" }, ++ { NULL, NULL } ++}; ++ ++static rcc_class_default_charset default_iso[] = { ++ { "ru", "CP1251" }, ++ { NULL, NULL } ++}; ++ ++#define OEM_CLASS 0 ++#define ISO_CLASS 1 ++#define OUT_CLASS 2 ++static rcc_class classes[] = { ++ { "oem", RCC_CLASS_STANDARD, NULL, default_oem, "OEM_INTERN", 0 }, ++ { "iso", RCC_CLASS_STANDARD, NULL, default_iso, "ISO_INTERN", 0 }, ++ { "out", RCC_CLASS_STANDARD, "LC_CTYPE", NULL, "Output", 0 }, ++ { NULL } ++}; ++ ++int initialized = 0; ++ ++#ifdef RCC_LAZY ++#include <dlfcn.h> ++# define RCC_LIBRARY "librcc.so.0" ++int (*rccInit2)(); ++int (*rccFree2)(); ++int (*rccInitDefaultContext2)(const char *locale_variable, unsigned int max_languages, unsigned int max_classes, rcc_class_ptr defclasses, rcc_init_flags flags); ++int (*rccInitDb42)(rcc_context ctx, const char *name, rcc_db4_flags flags); ++char* (*rccSizedRecode2)(rcc_context ctx, rcc_class_id from, rcc_class_id to, const char *buf, size_t len, size_t *rlen); ++ ++static char *rccRecode2(rcc_context ctx, rcc_class_id from, rcc_class_id to, const char *buf) { ++ rccSizedRecode2(ctx, from, to, buf, 0, NULL); ++} ++ ++void *rcc_handle; ++#else /* RCC_LAZY */ ++#define rccInit2 rccInit ++#define rccFree2 rccFree ++#define rccInitDefaultContext2 rccInitDefaultContext ++#define rccInitDb42 rccInitDb4 ++#define rccRecode2 rccRecode ++ ++#endif /* RCC_LAZY */ ++ ++static void rccUnzipFree() { ++ if (initialized > 0) { ++ rccFree2(); ++#ifdef RCC_LAZY ++ dlclose(rcc_handle); ++#endif /* RCC_LAZY */ ++ initialized = 0; ++ } ++} ++ ++ ++static int rccUnzipInit() { ++ if (initialized) return 0; ++ ++#ifdef RCC_LAZY ++ rcc_handle = dlopen("/usr/lib/" RCC_LIBRARY, RTLD_NOW); ++ if (!rcc_handle) rcc_handle = dlopen("/usr/local/lib/" RCC_LIBRARY, RTLD_NOW); ++ if (!rcc_handle) { ++ initialized = -1; ++ return 1; ++ } ++ ++ rccInit2 = dlsym(rcc_handle, "rccInit"); ++ rccFree2 = dlsym(rcc_handle, "rccFree"); ++ rccInitDefaultContext2 = dlsym(rcc_handle, "rccInitDefaultContext"); ++ rccInitDb42 = dlsym(rcc_handle, "rccInitDb4"); ++ rccSizedRecode2 = dlsym(rcc_handle, "rccSizedRecode"); ++ ++ if ((!rccInit2)||(!rccFree2)||(!rccInitDefaultContext2)||(!rccInitDb42)||(!rccSizedRecode2)) { ++ dlclose(rcc_handle); ++ initialized = -1; ++ return 1; ++ } ++#endif /* RCC_LAZY */ ++ ++ rccInit2(); ++ rccInitDefaultContext2(NULL, 0, 0, classes, 0); ++ rccInitDb42(NULL, NULL, 0); ++ atexit(rccUnzipFree); ++ initialized = 1; ++ return 0; ++} ++ ++ ++ ++void _DS_OEM_INTERN(char *string) { ++ char *str; ++ rccUnzipInit(); ++ if (initialized>0) { ++ str = rccRecode2(NULL, OEM_CLASS, OUT_CLASS, string); ++ if (str) { ++ strncpy(string,str,FILNAMSIZ); ++ free(str); ++ } ++ } ++} ++ ++void _DS_ISO_INTERN(char *string) { ++ char *str; ++ rccUnzipInit(); ++ if (initialized>0) { ++ str = rccRecode2(NULL, ISO_CLASS, OUT_CLASS, string); ++ if (str) { ++ strncpy(string,str,FILNAMSIZ); ++ free(str); ++ } ++ } ++} +diff -dPNur unzip-5.52/fileio.c unzip-5.52-new/fileio.c +--- unzip-5.52/fileio.c 2005-02-27 03:10:12.000000000 +0100 ++++ unzip-5.52-new/fileio.c 2007-04-04 21:16:58.000000000 +0200 +@@ -78,7 +78,7 @@ + # endif + #endif + #include "ebcdic.h" /* definition/initialization of ebcdic[] */ +- ++#include "dsrecode.h" + + /* + Note: Under Windows, the maximum size of the buffer that can be used +diff -dPNur unzip-5.52/unzpriv.h unzip-5.52-new/unzpriv.h +--- unzip-5.52/unzpriv.h 2005-02-04 00:26:42.000000000 +0100 ++++ unzip-5.52-new/unzpriv.h 2007-04-04 21:16:58.000000000 +0200 +@@ -2564,9 +2564,9 @@ + ((hostver) == 25 || (hostver) == 26 || (hostver) == 40))) || \ + (hostnum) == FS_HPFS_ || \ + ((hostnum) == FS_NTFS_ && (hostver) == 50)) { \ +- _OEM_INTERN((string)); \ ++ _DS_OEM_INTERN((string)); \ + } else { \ +- _ISO_INTERN((string)); \ ++ _DS_ISO_INTERN((string)); \ + } + #endif + diff --git a/app-arch/unzip/files/unzip-ds-rcc.patch b/app-arch/unzip/files/unzip-ds-rcc.patch new file mode 100644 index 0000000..6b70685 --- /dev/null +++ b/app-arch/unzip/files/unzip-ds-rcc.patch @@ -0,0 +1,105 @@ +diff -dPNur unzip-5.51/dsrecode.h unzip-5.51-new/dsrecode.h +--- unzip-5.51/dsrecode.h 1970-01-01 01:00:00.000000000 +0100 ++++ unzip-5.51-new/dsrecode.h 2005-07-19 05:03:50.000000000 +0200 +@@ -0,0 +1,62 @@ ++#include <librcc.h> ++ ++static rcc_class_default_charset default_oem[] = { ++ { "ru", "IBM866" }, ++ { NULL, NULL } ++}; ++ ++static rcc_class_default_charset default_iso[] = { ++ { "ru", "CP1251" }, ++ { NULL, NULL } ++}; ++ ++#define OEM_CLASS 0 ++#define ISO_CLASS 1 ++#define OUT_CLASS 2 ++static rcc_class classes[] = { ++ { "oem", RCC_CLASS_STANDARD, NULL, default_oem, "OEM_INTERN", 0 }, ++ { "iso", RCC_CLASS_STANDARD, NULL, default_iso, "ISO_INTERN", 0 }, ++ { "out", RCC_CLASS_STANDARD, "LC_CTYPE", NULL, "Output", 0 }, ++ { NULL } ++}; ++ ++int initialized = 0; ++ ++static void rccUnzipFree() { ++ if (initialized) { ++ rccFree(); ++ initialized = 0; ++ } ++} ++ ++static int rccUnzipInit() { ++ if (initialized) return 0; ++ rccInit(); ++ rccInitDefaultContext(NULL, 0, 0, classes, 0); ++ rccInitDb4(NULL, NULL, 0); ++ atexit(rccUnzipFree); ++ initialized = 1; ++ return 0; ++} ++ ++ ++ ++void _DS_OEM_INTERN(char *string) { ++ char *str; ++ rccUnzipInit(); ++ str = rccRecode(NULL, OEM_CLASS, OUT_CLASS, string); ++ if (str) { ++ strncpy(string,str,FILNAMSIZ); ++ free(str); ++ } ++} ++ ++void _DS_ISO_INTERN(char *string) { ++ char *str; ++ rccUnzipInit(); ++ str = rccRecode(NULL, ISO_CLASS, OUT_CLASS, string); ++ if (str) { ++ strncpy(string,str,FILNAMSIZ); ++ free(str); ++ } ++} +diff -dPNur unzip-5.51/fileio.c unzip-5.51-new/fileio.c +--- unzip-5.51/fileio.c 2004-05-23 03:01:20.000000000 +0200 ++++ unzip-5.51-new/fileio.c 2005-04-19 17:19:25.000000000 +0200 +@@ -78,7 +78,7 @@ + # endif + #endif + #include "ebcdic.h" /* definition/initialization of ebcdic[] */ +- ++#include "dsrecode.h" + + /* + Note: Under Windows, the maximum size of the buffer that can be used +diff -dPNur unzip-5.51/unix/Makefile unzip-5.51-new/unix/Makefile +--- unzip-5.51/unix/Makefile 2004-03-01 18:37:24.000000000 +0100 ++++ unzip-5.51-new/unix/Makefile 2005-07-19 04:03:11.000000000 +0200 +@@ -43,7 +43,7 @@ + + # UnZip flags + CC = cc# try using "gcc" target rather than changing this (CC and LD +-LD = $(CC)# must match, else "unresolved symbol: ___main" is possible) ++LD = $(CC) -lrcc# must match, else "unresolved symbol: ___main" is possible) + AS = as + LOC = $(LOCAL_UNZIP) + AF = $(LOC) +diff -dPNur unzip-5.51/unzpriv.h unzip-5.51-new/unzpriv.h +--- unzip-5.51/unzpriv.h 2004-03-01 19:09:04.000000000 +0100 ++++ unzip-5.51-new/unzpriv.h 2005-04-19 17:19:25.000000000 +0200 +@@ -2521,9 +2521,9 @@ + ((hostver) == 25 || (hostver) == 26 || (hostver) == 40))) || \ + (hostnum) == FS_HPFS_ || \ + ((hostnum) == FS_NTFS_ && (hostver) == 50)) { \ +- _OEM_INTERN((string)); \ ++ _DS_OEM_INTERN((string)); \ + } else { \ +- _ISO_INTERN((string)); \ ++ _DS_ISO_INTERN((string)); \ + } + #endif + diff --git a/app-arch/unzip/files/unzip-ds-unixenc.patch b/app-arch/unzip/files/unzip-ds-unixenc.patch new file mode 100644 index 0000000..e33e6ba --- /dev/null +++ b/app-arch/unzip/files/unzip-ds-unixenc.patch @@ -0,0 +1,9 @@ +diff -dPNur unzip-5.50/unzpriv.h unzip-5.50-new/unzpriv.h +--- unzip-5.50/unzpriv.h Sun Feb 17 21:01:48 2002 ++++ unzip-5.50-new/unzpriv.h Tue Jun 10 07:16:23 2003 +@@ -2424,4 +2424,5 @@ + !(((islochdr) || (isuxatt)) && \ + ((hostver) == 25 || (hostver) == 26 || (hostver) == 40))) || \ + (hostnum) == FS_HPFS_ || \ ++ (hostnum) == UNIX_ || \ + ((hostnum) == FS_NTFS_ && (hostver) == 50)) { \ diff --git a/app-arch/unzip/files/unzip60-ds-isprint.patch b/app-arch/unzip/files/unzip60-ds-isprint.patch new file mode 100644 index 0000000..64ea1ee --- /dev/null +++ b/app-arch/unzip/files/unzip60-ds-isprint.patch @@ -0,0 +1,12 @@ +diff -dPNur unzip60/extract.c unzip60-ds/extract.c +--- unzip60/extract.c 2009-03-14 02:32:52.000000000 +0100 ++++ unzip60-ds/extract.c 2010-07-06 16:34:09.000000000 +0200 +@@ -2596,7 +2596,7 @@ + */ + # define UZ_FNFILTER_REPLACECHAR '?' + # endif +- if (!isprint(*r)) { ++ if (*r < 32) { //(!isprint(*r)) { + if (*r < 32) { + /* ASCII control codes are escaped as "^{letter}". */ + if (se != NULL && (s > (space + (size-4)))) { diff --git a/app-arch/unzip/unzip-5.52-r3.ebuild b/app-arch/unzip/unzip-5.52-r3.ebuild new file mode 100644 index 0000000..e5b581e --- /dev/null +++ b/app-arch/unzip/unzip-5.52-r3.ebuild @@ -0,0 +1,51 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-arch/unzip/unzip-5.52.ebuild,v 1.2 2005/05/31 15:18:54 swegener Exp $ + +inherit eutils toolchain-funcs + +DESCRIPTION="Unzipper for pkzip-compressed files" +HOMEPAGE="ftp://ftp.info-zip.org/pub/infozip/UnZip.html" +SRC_URI="ftp://ftp.info-zip.org/pub/infozip/src/${PN}${PV/.}.tar.gz" + +LICENSE="Info-ZIP" +SLOT="0" +KEYWORDS="~alpha amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc x86" +IUSE="rcc" + +DEPEND="rcc? ( app-i18n/librcc )" + +src_unpack() { + unpack ${A} + cd "${S}" + use rcc && ( epatch ${FILESDIR}/${PN}-ds-lazyrcc.patch || die ) + use rcc && ( epatch ${FILESDIR}/${PN}-ds-unixenc.patch || die ) + + ld_opts="" +# use rcc && ld_opts="-lrcc" + use rcc && ld_opts="-ldl" + use rcc && cc_opts="-DRCC_LAZY=1" + + sed -i \ + -e "s:-O3:${CFLAGS}:" \ + -e "s:CC=gcc :CC=\"$(tc-getCC) ${cc_opts}\" :" \ + -e "s:LD=gcc :LD=\"$(tc-getCC) ${ld_opts}\" :" \ + -e "s:-O :${CFLAGS} :" \ + -e "s:LF2 = -s:LF2 = :" \ + unix/Makefile \ + || die "sed unix/Makefile failed" +} + +src_compile() { + use x86 \ + && TARGET=linux \ + || TARGET=linux_noasm + emake -f unix/Makefile ${TARGET} || die "emake failed" +} + +src_install() { + dobin unzip funzip unzipsfx unix/zipgrep || die "dobin failed" + dosym unzip /usr/bin/zipinfo + doman man/*.1 + dodoc BUGS History* README ToDo WHERE +} diff --git a/app-arch/unzip/unzip-5.52-r4.ebuild b/app-arch/unzip/unzip-5.52-r4.ebuild new file mode 100644 index 0000000..fe8d65e --- /dev/null +++ b/app-arch/unzip/unzip-5.52-r4.ebuild @@ -0,0 +1,67 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-arch/unzip/unzip-5.52-r2.ebuild,v 1.6 2008/03/29 16:57:06 jer Exp $ + +inherit eutils toolchain-funcs flag-o-matic + +DESCRIPTION="unzipper for pkzip-compressed files" +HOMEPAGE="http://www.info-zip.org/" +SRC_URI="mirror://gentoo/${PN}${PV/.}.tar.gz" + +LICENSE="Info-ZIP" +SLOT="0" +KEYWORDS="alpha amd64 ~arm hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc ~sparc-fbsd x86 ~x86-fbsd" +IUSE="rcc" + +DEPEND="rcc? ( app-i18n/librcc )" + +src_unpack() { + unpack ${A} + cd "${S}" + epatch "${FILESDIR}"/${P}-no-exec-stack.patch + epatch "${FILESDIR}"/${P}-CVE-2008-0888.patch #213761 +#SDS + use rcc && ( epatch ${FILESDIR}/${P}-ds-rusxmms.patch || die ) + use rcc && ( epatch ${FILESDIR}/${PN}-ds-unixenc.patch || die ) + + ld_opts="" +# use rcc && ld_opts="-lrcc" + use rcc && ld_opts="-ldl" + use rcc && cc_opts="-DRCC_LAZY=1" +#EDS + + sed -i \ + -e 's:-O3:$(CFLAGS) $(CPPFLAGS):' \ + -e 's:-O :$(CFLAGS) $(CPPFLAGS) :' \ + -e "s:CC=gcc :CC=\"$(tc-getCC) ${cc_opts}\" :" \ + -e "s:LD=gcc :LD=\"$(tc-getCC) ${ld_opts}\" :" \ + -e 's:LF2 = -s:LF2 = :' \ + -e 's:LF = :LF = $(LDFLAGS) :' \ + -e 's:SL = :SL = $(LDFLAGS) :' \ + -e 's:FL = :FL = $(LDFLAGS) :' \ + unix/Makefile \ + || die "sed unix/Makefile failed" +} + +src_compile() { + local TARGET + case ${CHOST} in + i?86*-linux*) TARGET=linux_asm ;; + *-linux*) TARGET=linux_noasm ;; + i?86*-freebsd* | i?86*-dragonfly* | i?86*-openbsd* | i?86*-netbsd*) + TARGET=freebsd ;; # mislabelled bsd with x86 asm + *-freebsd* | *-dragonfly* | *-openbsd* | *-netbsd*) + TARGET=bsd ;; + *-darwin*) TARGET=macosx ;; + *) die "Unknown target, you suck" ;; + esac + append-lfs-flags #104315 + emake -f unix/Makefile ${TARGET} || die "emake failed" +} + +src_install() { + dobin unzip funzip unzipsfx unix/zipgrep || die "dobin failed" + dosym unzip /usr/bin/zipinfo || die + doman man/*.1 + dodoc BUGS History* README ToDo WHERE +} diff --git a/app-arch/unzip/unzip-5.52-r5.ebuild b/app-arch/unzip/unzip-5.52-r5.ebuild new file mode 100644 index 0000000..81f9392 --- /dev/null +++ b/app-arch/unzip/unzip-5.52-r5.ebuild @@ -0,0 +1,74 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-arch/unzip/unzip-5.52-r2.ebuild,v 1.6 2008/03/29 16:57:06 jer Exp $ + +inherit eutils toolchain-funcs flag-o-matic + +DESCRIPTION="unzipper for pkzip-compressed files" +HOMEPAGE="http://www.info-zip.org/" +SRC_URI="mirror://gentoo/${PN}${PV/.}.tar.gz" + +LICENSE="Info-ZIP" +SLOT="0" +KEYWORDS="alpha amd64 ~arm hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc ~sparc-fbsd x86 ~x86-fbsd" +IUSE="rcc" + +#To overcome circular dependencies +PDEPEND="rcc? ( app-i18n/librcc )" + +src_unpack() { + unpack ${A} + cd "${S}" + epatch "${FILESDIR}"/${P}-no-exec-stack.patch + epatch "${FILESDIR}"/${P}-CVE-2008-0888.patch #213761 + +#SDS + use rcc && ( + epatch ${FILESDIR}/${P}-ds-rusxmms.patch || die + epatch ${FILESDIR}/${PN}-ds-unixenc.patch || die + if [ ! -a /usr/include/librcc.h ]; then + cp "${FILESDIR}"/librcc-0.2.7.h librcc.h || die + fi + ) + + ld_opts="" + cc_opts="" + use rcc && ld_opts="-ldl" + use rcc && cc_opts="-DRCC_LAZY=1" +#EDS + + sed -i \ + -e 's:-O3:$(CFLAGS) $(CPPFLAGS):' \ + -e 's:-O :$(CFLAGS) $(CPPFLAGS) :' \ + -e "s:CC=gcc :CC=\"$(tc-getCC) ${cc_opts}\" :" \ + -e "s:LD=gcc :LD=\"$(tc-getCC) ${ld_opts}\" :" \ + -e 's:LF2 = -s:LF2 = :' \ + -e 's:LF = :LF = $(LDFLAGS) :' \ + -e 's:SL = :SL = $(LDFLAGS) :' \ + -e 's:FL = :FL = $(LDFLAGS) :' \ + unix/Makefile \ + || die "sed unix/Makefile failed" +} + +src_compile() { + local TARGET + case ${CHOST} in + i?86*-linux*) TARGET=linux_asm ;; + *-linux*) TARGET=linux_noasm ;; + i?86*-freebsd* | i?86*-dragonfly* | i?86*-openbsd* | i?86*-netbsd*) + TARGET=freebsd ;; # mislabelled bsd with x86 asm + *-freebsd* | *-dragonfly* | *-openbsd* | *-netbsd*) + TARGET=bsd ;; + *-darwin*) TARGET=macosx ;; + *) die "Unknown target, you suck" ;; + esac + append-lfs-flags #104315 + emake -f unix/Makefile ${TARGET} || die "emake failed" +} + +src_install() { + dobin unzip funzip unzipsfx unix/zipgrep || die "dobin failed" + dosym unzip /usr/bin/zipinfo || die + doman man/*.1 + dodoc BUGS History* README ToDo WHERE +} diff --git a/app-arch/unzip/unzip-5.52-r6.ebuild b/app-arch/unzip/unzip-5.52-r6.ebuild new file mode 100644 index 0000000..b8dedcc --- /dev/null +++ b/app-arch/unzip/unzip-5.52-r6.ebuild @@ -0,0 +1,74 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-arch/unzip/unzip-5.52-r2.ebuild,v 1.6 2008/03/29 16:57:06 jer Exp $ + +inherit eutils toolchain-funcs flag-o-matic + +DESCRIPTION="unzipper for pkzip-compressed files" +HOMEPAGE="http://www.info-zip.org/" +SRC_URI="mirror://gentoo/${PN}${PV/.}.tar.gz" + +LICENSE="Info-ZIP" +SLOT="0" +KEYWORDS="alpha amd64 ~arm hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc ~sparc-fbsd x86 ~x86-fbsd" +IUSE="rcc" + +#To overcome circular dependencies +PDEPEND="rcc? ( app-i18n/librcc )" + +src_unpack() { + unpack ${A} + cd "${S}" + epatch "${FILESDIR}"/${P}-no-exec-stack.patch + epatch "${FILESDIR}"/${P}-CVE-2008-0888.patch #213761 + +#SDS + use rcc && ( + epatch ${FILESDIR}/${P}-ds-rusxmms2.patch || die + epatch ${FILESDIR}/${PN}-ds-unixenc.patch || die + if [ ! -a /usr/include/librcc.h ]; then + cp "${FILESDIR}"/librcc-0.2.7.h librcc.h || die + fi + ) + + ld_opts="" + cc_opts="" + use rcc && ld_opts="-ldl" + use rcc && cc_opts="-DRCC_LAZY=1" +#EDS + + sed -i \ + -e 's:-O3:$(CFLAGS) $(CPPFLAGS):' \ + -e 's:-O :$(CFLAGS) $(CPPFLAGS) :' \ + -e "s:CC=gcc :CC=\"$(tc-getCC) ${cc_opts}\" :" \ + -e "s:LD=gcc :LD=\"$(tc-getCC) ${ld_opts}\" :" \ + -e 's:LF2 = -s:LF2 = :' \ + -e 's:LF = :LF = $(LDFLAGS) :' \ + -e 's:SL = :SL = $(LDFLAGS) :' \ + -e 's:FL = :FL = $(LDFLAGS) :' \ + unix/Makefile \ + || die "sed unix/Makefile failed" +} + +src_compile() { + local TARGET + case ${CHOST} in + i?86*-linux*) TARGET=linux_asm ;; + *-linux*) TARGET=linux_noasm ;; + i?86*-freebsd* | i?86*-dragonfly* | i?86*-openbsd* | i?86*-netbsd*) + TARGET=freebsd ;; # mislabelled bsd with x86 asm + *-freebsd* | *-dragonfly* | *-openbsd* | *-netbsd*) + TARGET=bsd ;; + *-darwin*) TARGET=macosx ;; + *) die "Unknown target, you suck" ;; + esac + append-lfs-flags #104315 + emake -f unix/Makefile ${TARGET} || die "emake failed" +} + +src_install() { + dobin unzip funzip unzipsfx unix/zipgrep || die "dobin failed" + dosym unzip /usr/bin/zipinfo || die + doman man/*.1 + dodoc BUGS History* README ToDo WHERE +} diff --git a/app-arch/unzip/unzip-6.0-r3.ebuild b/app-arch/unzip/unzip-6.0-r3.ebuild new file mode 100644 index 0000000..d2176aa --- /dev/null +++ b/app-arch/unzip/unzip-6.0-r3.ebuild @@ -0,0 +1,94 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-arch/unzip/unzip-6.0-r1.ebuild,v 1.10 2010/01/10 00:28:54 jer Exp $ + +inherit eutils toolchain-funcs flag-o-matic + +MY_P="${PN}${PV/.}" + +DESCRIPTION="unzipper for pkzip-compressed files" +HOMEPAGE="http://www.info-zip.org/" +SRC_URI="mirror://sourceforge/infozip/${MY_P}.tar.gz" + +LICENSE="Info-ZIP" +SLOT="0" +KEYWORDS="~alpha amd64 arm hppa ~ia64 m68k ~ppc ppc64 s390 sh ~sparc x86" +#SDS +IUSE="bzip2 unicode rcc" +#To overcome circular dependencies +PDEPEND="rcc? ( app-i18n/librcc )" +#EDS + +DEPEND="bzip2? ( app-arch/bzip2 )" +RDEPEND="${DEPEND}" + +S="${WORKDIR}/${MY_P}" + + +src_unpack() { + unpack ${A} + cd "${S}" + epatch "${FILESDIR}"/${P}-no-exec-stack.patch + + +#SDS + use rcc && ( + epatch ${FILESDIR}/${PN}60-ds-isprint.patch || die + epatch ${FILESDIR}/${PN}-5.52-ds-rusxmms2.patch || die + epatch ${FILESDIR}/${PN}-ds-unixenc.patch || die + if [ ! -a /usr/include/librcc.h ]; then + cp "${FILESDIR}"/librcc-0.2.7.h librcc.h || die + fi + ) + + ld_opts="" + use rcc && ld_opts="-ldl" +#EDS + + sed -i \ + -e '/^CFLAGS/d' \ + -e '/CFLAGS/s:-O[0-9]\?:$(CFLAGS) $(CPPFLAGS):' \ + -e '/^STRIP/s:=.*:=true:' \ + -e "s:CC=gcc :CC=$(tc-getCC) :" \ + -e "s:LD=gcc :LD=$(tc-getCC) :" \ + -e "s:AS=gcc :AS=$(tc-getCC) :" \ + -e "s:LF2 = -s:LF2 = ${ld_opts} :" \ + -e 's:LF = :LF = $(LDFLAGS) :' \ + -e 's:SL = :SL = $(LDFLAGS) :' \ + -e 's:FL = :FL = $(LDFLAGS) :' \ + -e "/^#L_BZ2/s:^$(use bzip2 && echo .)::" \ + unix/Makefile \ + || die "sed unix/Makefile failed" +} + +src_compile() { + local TARGET + case ${CHOST} in + i?86*-*linux*) TARGET=linux_asm ;; + *linux*) TARGET=linux_noasm ;; + i?86*-*bsd* | \ + i?86*-dragonfly*) TARGET=freebsd ;; # mislabelled bsd with x86 asm + *bsd* | *dragonfly*) TARGET=bsd ;; + *-darwin*) TARGET=macosx ;; + *) die "Unknown target, you suck" ;; + esac + + [[ ${CHOST} == *linux* ]] && append-cppflags -DNO_LCHMOD + use bzip2 && append-cppflags -DUSE_BZIP2 + use unicode && append-cppflags -DUNICODE_SUPPORT -DUNICODE_WCHAR -DUTF8_MAYBE_NATIVE + append-cppflags -DLARGE_FILE_SUPPORT #281473 +#SDS + use rcc && append-cppflags -DRCC_LAZY=1 +#EDS + + emake \ + -f unix/Makefile \ + ${TARGET} || die "emake failed" +} + +src_install() { + dobin unzip funzip unzipsfx unix/zipgrep || die "dobin failed" + dosym unzip /usr/bin/zipinfo || die + doman man/*.1 + dodoc BUGS History* README ToDo WHERE +} |