usage.c: remove reference to busybox.h
[oweals/busybox.git] / coreutils / wc.c
index ebae5f69f21ed4fcdf3a6c2cfeaa981da2f60c81..04112c194ef8637505ff2583334b8828619e9a48 100644 (file)
  * for which 'wc -c' should output '0'.
  */
 
-#include "busybox.h"
+#include "libbb.h"
 
 #ifdef CONFIG_LOCALE_SUPPORT
-#include <locale.h>
-#include <ctype.h>
 #define isspace_given_isprint(c) isspace(c)
 #else
 #undef isspace
@@ -70,6 +68,7 @@ enum {
        WC_LENGTH       = 3
 };
 
+int wc_main(int argc, char **argv);
 int wc_main(int argc, char **argv)
 {
        FILE *fp;
@@ -83,8 +82,8 @@ int wc_main(int argc, char **argv)
        unsigned u;
        int num_files = 0;
        int c;
-       char status = EXIT_SUCCESS;
-       char in_word;
+       smallint status = EXIT_SUCCESS;
+       smallint in_word;
        unsigned print_type;
 
        print_type = getopt32(argc, argv, "lwcL");
@@ -107,7 +106,7 @@ int wc_main(int argc, char **argv)
 
        while ((arg = *argv++) != 0) {
                ++num_files;
-               fp = bb_wfopen_input(arg);
+               fp = fopen_or_warn_stdin(arg);
                if (!fp) {
                        status = EXIT_FAILURE;
                        continue;
@@ -172,7 +171,7 @@ int wc_main(int argc, char **argv)
                }
                totals[WC_LENGTH] -= counts[WC_LENGTH];
 
-               bb_fclose_nonstdin(fp);
+               fclose_if_not_stdin(fp);
 
        OUTPUT:
                /* coreutils wc tries hard to print pretty columns