Removed the -f option.
[selector.git] / selector.c
index fa0589c..e3c0b33 100644 (file)
@@ -3,7 +3,7 @@
  *  selector is a simple command line utility for selection of strings
  *  with a dynamic pattern-matching.
  *
- *  Copyright (c) 2009 Francois Fleuret
+ *  Copyright (c) 2009, 2010 Francois Fleuret
  *  Written by Francois Fleuret <francois@fleuret.org>
  *
  *  This file is part of selector.
@@ -44,7 +44,7 @@
 #include <locale.h>
 #include <getopt.h>
 
-#define VERSION "1.0.1"
+#define VERSION "1.1"
 
 #define BUFFER_SIZE 4096
 
@@ -117,7 +117,6 @@ int string_to_positive_integer(char *string) {
   int result = 0;
   char *s;
 
-  printf("string_to_positive_integer string=\"%s\"\n", string);
   if(*string) {
     for(s = string; *s && *s != ','; s++) {
       if(*s >= '0' && *s <= '9') {
@@ -785,7 +784,6 @@ static struct option long_options[] = {
   { "add-control-qs", no_argument, 0, 'w' },
   { "monochrome", no_argument, 0, 'm' },
   { "no-beep", no_argument, 0, 'q' },
-  { "input-file", 1, 0, 'f' },
   { "revert-order", no_argument, 0, 'i' },
   { "remove-bash-prefix", no_argument, 0, 'b' },
   { "remove-zsh-prefix", no_argument, 0, 'z' },
@@ -802,10 +800,10 @@ static struct option long_options[] = {
 
 int main(int argc, char **argv) {
 
-  char input_filename[BUFFER_SIZE], output_filename[BUFFER_SIZE];
-  char c, *s;
+  char output_filename[BUFFER_SIZE];
+  char *s;
   char pattern[BUFFER_SIZE];
-  int k, l, n;
+  int c, k, l, n;
   int cursor_position;
   int error = 0, show_help = 0;
   int rest_are_files = 0;
@@ -831,7 +829,6 @@ int main(int argc, char **argv) {
 
   setlocale(LC_ALL, "");
 
-  strcpy(input_filename, "");
   strcpy(output_filename, "");
 
   while (!rest_are_files &&
@@ -868,10 +865,6 @@ int main(int argc, char **argv) {
       error_flash = 1;
       break;
 
-    case 'f':
-      strncpy(input_filename, optarg, BUFFER_SIZE);
-      break;
-
     case 'i':
       inverse_order = 1;
       break;
@@ -951,12 +944,6 @@ int main(int argc, char **argv) {
     hash_table = 0;
   }
 
-  if(input_filename[0]) {
-    read_file(hash_table,
-              input_filename,
-              nb_lines_max, &nb_lines, lines);
-  }
-
   while(optind < argc) {
     read_file(hash_table,
               argv[optind],