Ignore:
Timestamp:
Jan 1, 2014, 12:47:38 AM (7 years ago)
Author:
Bruno Cornec
Message:
  • Update mindi-busybox to 1.21.1
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.2/mindi-busybox/miscutils/man.c

    r2725 r3232  
    33 * Licensed under GPLv2, see file LICENSE in this source tree.
    44 */
     5
     6//usage:#define man_trivial_usage
     7//usage:       "[-aw] [MANPAGE]..."
     8//usage:#define man_full_usage "\n\n"
     9//usage:       "Format and display manual page\n"
     10//usage:     "\n    -a  Display all pages"
     11//usage:     "\n    -w  Show page locations"
    512
    613#include "libbb.h"
     
    2330
    2431*/
    25 
    26 #if ENABLE_FEATURE_SEAMLESS_LZMA
    27 #define Z_SUFFIX ".lzma"
    28 #elif ENABLE_FEATURE_SEAMLESS_BZ2
    29 #define Z_SUFFIX ".bz2"
    30 #elif ENABLE_FEATURE_SEAMLESS_GZ
    31 #define Z_SUFFIX ".gz"
    32 #else
    33 #define Z_SUFFIX ""
    34 #endif
    3532
    3633static int show_manpage(const char *pager, char *man_filename, int man, int level);
     
    9693        /* Links do not have .gz extensions, even if manpage
    9794         * is compressed */
    98         man_filename = xasprintf("%s/%s" Z_SUFFIX, man_filename, linkname);
     95        man_filename = xasprintf("%s/%s", man_filename, linkname);
    9996        free(line);
    10097        /* Note: we leak "new" man_filename string as well... */
     
    118115}
    119116
    120 /* man_filename is of the form "/dir/dir/dir/name.s" Z_SUFFIX */
     117/* man_filename is of the form "/dir/dir/dir/name.s" */
    121118static int show_manpage(const char *pager, char *man_filename, int man, int level)
    122119{
     120#if SEAMLESS_COMPRESSION
     121    /* We leak this allocation... */
     122    char *filename_with_zext = xasprintf("%s.lzma", man_filename);
     123    char *ext = strrchr(filename_with_zext, '.') + 1;
     124#endif
     125
    123126#if ENABLE_FEATURE_SEAMLESS_LZMA
    124     if (run_pipe(pager, man_filename, man, level))
    125         return 1;
    126 #endif
    127 
     127    if (run_pipe(pager, filename_with_zext, man, level))
     128        return 1;
     129#endif
     130#if ENABLE_FEATURE_SEAMLESS_XZ
     131    strcpy(ext, "xz");
     132    if (run_pipe(pager, filename_with_zext, man, level))
     133        return 1;
     134#endif
    128135#if ENABLE_FEATURE_SEAMLESS_BZ2
    129 #if ENABLE_FEATURE_SEAMLESS_LZMA
    130     strcpy(strrchr(man_filename, '.') + 1, "bz2");
    131 #endif
    132     if (run_pipe(pager, man_filename, man, level))
    133         return 1;
    134 #endif
    135 
     136    strcpy(ext, "bz2");
     137    if (run_pipe(pager, filename_with_zext, man, level))
     138        return 1;
     139#endif
    136140#if ENABLE_FEATURE_SEAMLESS_GZ
    137 #if ENABLE_FEATURE_SEAMLESS_LZMA || ENABLE_FEATURE_SEAMLESS_BZ2
    138     strcpy(strrchr(man_filename, '.') + 1, "gz");
    139 #endif
    140     if (run_pipe(pager, man_filename, man, level))
    141         return 1;
    142 #endif
    143 
    144 #if ENABLE_FEATURE_SEAMLESS_LZMA || ENABLE_FEATURE_SEAMLESS_BZ2 || ENABLE_FEATURE_SEAMLESS_GZ
    145     *strrchr(man_filename, '.') = '\0';
    146 #endif
    147     if (run_pipe(pager, man_filename, man, level))
    148         return 1;
    149 
    150     return 0;
     141    strcpy(ext, "gz");
     142    if (run_pipe(pager, filename_with_zext, man, level))
     143        return 1;
     144#endif
     145
     146    return run_pipe(pager, man_filename, man, level);
    151147}
    152148
     
    256252                while (cat0man1 < 2) {
    257253                    int found_here;
    258                     man_filename = xasprintf("%s/%s%.*s/%s.%.*s" Z_SUFFIX,
     254                    man_filename = xasprintf("%s/%s%.*s/%s.%.*s",
    259255                            cur_path,
    260256                            "cat\0man" + (cat0man1 * 4),
Note: See TracChangeset for help on using the changeset viewer.