"insmod caches the symbolname in a variable before modifying it and uses
[oweals/busybox.git] / miscutils / strings.c
index ace4bed15f5aba57d24a104d7d91697998a81cac..1231a93bd05f8999fb25560fae17e7bc1d272a4f 100644 (file)
@@ -21,7 +21,7 @@
  *
  * Original copyright notice is retained at the end of this file.
  *
- * Modified for BusyBox by Erik Andersen <andersee@debian.org>
+ * Modified for BusyBox by Erik Andersen <andersen@codepoet.org>
  * Badly hacked by Tito Ragusa <farmatito@tiscali.it>
  */
 
@@ -54,10 +54,10 @@ int strings_main(int argc, char **argv)
                                opt+=2;
                                break;
                        case 'n':
-                               n = bb_xgetlarg(optarg, 1, LONG_MAX, 10);
+                               n = bb_xgetlarg(optarg, 10, 1, INT_MAX);
                                break;
                        default:
-                               show_usage();
+                               bb_show_usage();
                }
 
        argc -= optind;
@@ -82,8 +82,7 @@ int strings_main(int argc, char **argv)
 pipe:
 
                        count=0;
-                       do
-                       {
+                       do{
                                c=fgetc(file);
                                if(ISSTR(c))
                                {
@@ -106,19 +105,17 @@ pipe:
                                else
                                {
                                        if(i>n)
-                                               puts("");
+                                               putchar('\n');
                                        i=0;
                                }
                                count++;
-                       }
-                       while(c!=EOF);
+                       }while(c!=EOF);
 
-                       if(file!=stdin)
-                               fclose(file);
+                       bb_fclose_nonstdin(file);
                }
                else
                {
-                       perror_msg("%s",argv[a]);
+                       bb_perror_msg("%s",argv[a]);
                        status=EXIT_FAILURE;
                }
        }