diff --git a/edit/src/main.cpp b/edit/src/main.cpp index 9c2a6fa..9486a79 100644 --- a/edit/src/main.cpp +++ b/edit/src/main.cpp @@ -20,7 +20,7 @@ int main(int argc, char* argv[]) { string program_author = "rail5"; - string helpstring = program_name + " " + program_version + "\nCopyright (C) 2023 " + program_author + "\n\nThis is free software (GNU GPL 3), and you are welcome to redistribute it under certain conditions.\n\nUsage: " + program_name + " -i filename -a \"{INSTRUCTION}\"\n\nOptions:\n -i\n --input\n Specify input file to edit\n\n -a\n --add-instruction\n Instruct the program on how to edit your file\n Example instructions:\n REPLACE 5 hello world\n (Replaces text, starting from byte #5, with \"hello world\")\n INSERT 7 salut a tous\n (Inserts \"salut a tous\" at byte #7, shifting the rest of the file without replacing it)\n REMOVE 9 15\n (Removes bytes #9 to #15 from the file)\n\n -s\n --add-instruction-set\n Provide a set of multiple instructions for editing the file\n Each instruction in the set should be on its own line, as in the following example:\n --add-instruction-set \"REPLACE 20 hello world\n INSERT 50 hello again\n REMOVE 70 75\"\n\n -c\n --special-chars\n Interpret escaped character sequences (\\n, \\t and \\\\)\n\n -f\n --follow-logic\n Adjust the positions given by the instruction set as we go along\n For example, in this set:\n REMOVE 5 5\n REPLACE 10 hello world\n After \"Remove 5 5\", which removes the 5th byte from the file, \"Replace 10 hello world\" will be adjusted to \"Replace 9 hello world\", since removing an earlier byte caused the text which was originally at position #10 to move to position #9\n\n -b\n --block-size\n Specify the amount of data from the file we're willing to load into memory at any given time\n Example:\n -b 10M\n -b 200K\n (Default 1 kilobyte)\n\n -h\n --help\n Display this message\n\nExample:\n " + program_name + " --input ./file.txt --add-instruction \"REPLACE 20 hello \\n world\" --add-instruction \"REMOVE 10 12\" --block-size 10K --special-chars\n"; + string helpstring = program_name + " " + program_version + "\nCopyright (C) 2023 " + program_author + "\n\nThis is free software (GNU GPL 3), and you are welcome to redistribute it under certain conditions.\n\nUsage: " + program_name + " -i filename -a \"{INSTRUCTION}\"\n\nOptions:\n -i\n --input\n Specify input file to edit\n\n -a\n --add-instruction\n Instruct the program on how to edit your file\n Example instructions:\n REPLACE 5 hello world\n (Replaces text, starting from byte #5, with \"hello world\")\n INSERT 7 salut a tous\n (Inserts \"salut a tous\" at byte #7, shifting the rest of the file without replacing it)\n REMOVE 9 15\n (Removes bytes #9 to #15 from the file)\n\n -s\n --add-instruction-set\n Provide a set of multiple instructions for editing the file\n Each instruction in the set should be on its own line, as in the following example:\n --add-instruction-set \"REPLACE 20 hello world\n INSERT 50 hello again\n REMOVE 70 75\"\n\n -c\n --special-chars\n Interpret escaped character sequences (\\n, \\t and \\\\)\n\n -b\n --block-size\n Specify the amount of data from the file we're willing to load into memory at any given time\n Example:\n -b 10M\n -b 200K\n (Default 1 kilobyte)\n\n -h\n --help\n Display this message\n\nExample:\n " + program_name + " --input ./file.txt --add-instruction \"REPLACE 20 hello \\n world\" --add-instruction \"REMOVE 10 12\" --block-size 10K --special-chars\n"; /* @@ -30,7 +30,6 @@ int main(int argc, char* argv[]) { vector instructions_to_add; int block_size = 1024; bool interpret_special_chars = false; - bool follow_position_logic = false; /* temp_instruction_set vector @@ -59,12 +58,11 @@ int main(int argc, char* argv[]) { {"block-size", required_argument, 0, 'b'}, {"special-chars", no_argument, 0, 'c'}, - {"follow-logic", no_argument, 0, 'f'}, {"help", no_argument, 0, 'h'} }; - while ((c = getopt_long(argc, argv, "i:s:a:b:cfh", long_options, &option_index)) != -1) { + while ((c = getopt_long(argc, argv, "i:s:a:b:ch", long_options, &option_index)) != -1) { switch(c) { case 'i': file_to_edit = optarg; @@ -91,10 +89,6 @@ int main(int argc, char* argv[]) { interpret_special_chars = true; break; - case 'f': - follow_position_logic = true; - break; - case 'h': cout << helpstring; return 0; diff --git a/edit/src/namespace_editor.h b/edit/src/namespace_editor.h index 19ab4af..7a70f35 100644 --- a/edit/src/namespace_editor.h +++ b/edit/src/namespace_editor.h @@ -70,7 +70,6 @@ namespace editor { vector instruction_set; long long int file_length_after_last_instruction = 0; - bool follow_position_logic = false; string error_message = ""; public: