Ignore:
Timestamp:
Feb 25, 2011, 9:26:54 PM (13 years ago)
Author:
Bruno Cornec
Message:
  • Update mindi-busybox to 1.18.3 to avoid problems with the tar command which is now failing on recent versions with busybox 1.7.3
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.9/mindi-busybox/miscutils/strings.c

    r1765 r2725  
    33 * strings implementation for busybox
    44 *
    5  * Copyright Tito Ragusa <farmatito@tiscali.it>
     5 * Copyright 2003 Tito Ragusa <farmatito@tiscali.it>
    66 *
    7  * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
     7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
    88 */
    9 
    10 #include <getopt.h>
    119
    1210#include "libbb.h"
    1311
    14 #define WHOLE_FILE      1
    15 #define PRINT_NAME      2
    16 #define PRINT_OFFSET    4
    17 #define SIZE            8
     12#define WHOLE_FILE    1
     13#define PRINT_NAME    2
     14#define PRINT_OFFSET  4
     15#define SIZE          8
    1816
    19 int strings_main(int argc, char **argv);
    20 int strings_main(int argc, char **argv)
     17int strings_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
     18int strings_main(int argc UNUSED_PARAM, char **argv)
    2119{
    2220    int n, c, status = EXIT_SUCCESS;
    23     unsigned opt;
    2421    unsigned count;
    2522    off_t offset;
    26     FILE *file = stdin;
     23    FILE *file;
    2724    char *string;
    2825    const char *fmt = "%s: ";
    2926    const char *n_arg = "4";
    3027
    31     opt = getopt32(argv, "afon:", &n_arg);
     28    getopt32(argv, "afon:", &n_arg);
    3229    /* -a is our default behaviour */
    3330    /*argc -= optind;*/
     
    4138        fmt = "{%s}: ";
    4239        *--argv = (char *)bb_msg_standard_input;
    43         goto PIPE;
    4440    }
    4541
    4642    do {
    47         file = fopen_or_warn(*argv, "r");
     43        file = fopen_or_warn_stdin(*argv);
    4844        if (!file) {
    4945            status = EXIT_FAILURE;
    5046            continue;
    5147        }
    52  PIPE:
    5348        offset = 0;
    5449        count = 0;
    5550        do {
    5651            c = fgetc(file);
    57             if (isprint(c) || c == '\t') {
     52            if (isprint_asciionly(c) || c == '\t') {
    5853                if (count > n) {
    59                     putchar(c);
     54                    bb_putchar(c);
    6055                } else {
    6156                    string[count] = c;
    6257                    if (count == n) {
    63                         if (opt & PRINT_NAME) {
     58                        if (option_mask32 & PRINT_NAME) {
    6459                            printf(fmt, *argv);
    6560                        }
    66                         if (opt & PRINT_OFFSET) {
     61                        if (option_mask32 & PRINT_OFFSET) {
    6762                            printf("%7"OFF_FMT"o ", offset - n);
    6863                        }
     
    7368            } else {
    7469                if (count > n) {
    75                     putchar('\n');
     70                    bb_putchar('\n');
    7671                }
    7772                count = 0;
Note: See TracChangeset for help on using the changeset viewer.