Magellan Linux

Diff of /trunk/mkinitrd-magellan/busybox/miscutils/strings.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 983 by niro, Fri Apr 24 18:33:46 2009 UTC revision 984 by niro, Sun May 30 11:32:42 2010 UTC
# Line 2  Line 2 
2  /*  /*
3   * strings implementation for busybox   * strings implementation for busybox
4   *   *
5   * Copyright Tito Ragusa <farmatito@tiscali.it>   * Copyright 2003 Tito Ragusa <farmatito@tiscali.it>
6   *   *
7   * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.   * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
8   */   */
# Line 18  int strings_main(int argc, char **argv) Line 18  int strings_main(int argc, char **argv)
18  int strings_main(int argc UNUSED_PARAM, char **argv)  int strings_main(int argc UNUSED_PARAM, char **argv)
19  {  {
20   int n, c, status = EXIT_SUCCESS;   int n, c, status = EXIT_SUCCESS;
  unsigned opt;  
21   unsigned count;   unsigned count;
22   off_t offset;   off_t offset;
23   FILE *file;   FILE *file;
# Line 26  int strings_main(int argc UNUSED_PARAM, Line 25  int strings_main(int argc UNUSED_PARAM,
25   const char *fmt = "%s: ";   const char *fmt = "%s: ";
26   const char *n_arg = "4";   const char *n_arg = "4";
27    
28   opt = getopt32(argv, "afon:", &n_arg);   getopt32(argv, "afon:", &n_arg);
29   /* -a is our default behaviour */   /* -a is our default behaviour */
30   /*argc -= optind;*/   /*argc -= optind;*/
31   argv += optind;   argv += optind;
# Line 50  int strings_main(int argc UNUSED_PARAM, Line 49  int strings_main(int argc UNUSED_PARAM,
49   count = 0;   count = 0;
50   do {   do {
51   c = fgetc(file);   c = fgetc(file);
52   if (isprint(c) || c == '\t') {   if (isprint_asciionly(c) || c == '\t') {
53   if (count > n) {   if (count > n) {
54   bb_putchar(c);   bb_putchar(c);
55   } else {   } else {
56   string[count] = c;   string[count] = c;
57   if (count == n) {   if (count == n) {
58   if (opt & PRINT_NAME) {   if (option_mask32 & PRINT_NAME) {
59   printf(fmt, *argv);   printf(fmt, *argv);
60   }   }
61   if (opt & PRINT_OFFSET) {   if (option_mask32 & PRINT_OFFSET) {
62   printf("%7"OFF_FMT"o ", offset - n);   printf("%7"OFF_FMT"o ", offset - n);
63   }   }
64   fputs(string, stdout);   fputs(string, stdout);

Legend:
Removed from v.983  
changed lines
  Added in v.984