]> Kevux Git Server - fll/commitdiff
Update: redesign parameters for fss write functions to be more consistent with fss...
authorKevin Day <kevin@kevux.org>
Sat, 31 Mar 2012 23:38:04 +0000 (18:38 -0500)
committerKevin Day <kevin@kevux.org>
Sat, 31 Mar 2012 23:38:04 +0000 (18:38 -0500)
The fss read functions all take -o or --object to signify that an object is being processed.
Do the same with the write functions.

level_3/fss_basic_list_write/c/fss_basic_list_write.c
level_3/fss_basic_list_write/c/fss_basic_list_write.h
level_3/fss_basic_write/c/fss_basic_write.c
level_3/fss_basic_write/c/fss_basic_write.h
level_3/fss_extended_write/c/fss_extended_write.c
level_3/fss_extended_write/c/fss_extended_write.h

index 19a29c1a980f43968c66659b051aa97edc5b105c..d87790c0fff877820bd25432bffa910bfdb26fc8 100644 (file)
@@ -62,18 +62,18 @@ extern "C"{
 
     printf("\n");
     printf("\n  %s", f_console_symbol_short_enable);
-    fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_basic_list_write_short_type);
+    fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_basic_list_write_short_object);
 
     printf(", %s", f_console_symbol_long_enable);
-    fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_basic_list_write_long_type);
-    printf("    Specify a what to write: object or content.");
+    fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_basic_list_write_long_object);
+    printf("  Write an object instead of content.");
 
     printf("\n  %s", f_console_symbol_short_enable);
-    fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_basic_list_write_short_output);
+    fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_basic_list_write_short_file);
 
     printf(", %s", f_console_symbol_long_enable);
-    fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_basic_list_write_long_output);
-    printf("  Specify a file to send output to.");
+    fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_basic_list_write_long_file);
+    printf("    Specify a file to send output to.");
 
     printf("\n  %s", f_console_symbol_short_enable);
     fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_basic_list_write_short_string);
@@ -145,19 +145,13 @@ extern "C"{
       fss_basic_list_write_print_help(*data);
     } else if (data->parameters[fss_basic_list_write_parameter_version].result == f_console_result_found) {
       fss_basic_list_write_print_version(*data);
-    } else if (data->parameters[fss_basic_list_write_parameter_type].result == f_console_result_additional) {
+    } else {
       f_array_length counter = f_array_length_initialize;
-      f_max_u_short  type    = 0;
+      f_bool         object  = (data->parameters[fss_basic_list_write_parameter_object].result == f_console_result_found);
 
       f_dynamic_string  buffer   = f_dynamic_string_initialize;
       f_string_location location = f_string_location_initialize;
 
-      if (strncmp("object", argv[data->parameters[fss_basic_list_write_parameter_type].additional.array[0]], 7) == 0) {
-        type = fss_basic_list_write_type_object;
-      } else if (strncmp("content", argv[data->parameters[fss_basic_list_write_parameter_type].additional.array[0]], 8) == 0) {
-        type = fss_basic_list_write_type_content;
-      }
-
       if (data->process_pipe) {
         f_file           file  = f_file_initialize;
         f_dynamic_string input = f_dynamic_string_initialize;
@@ -187,13 +181,13 @@ extern "C"{
         location.start = 0;
         location.stop = input.used - 1;
 
-        if (type == fss_basic_list_write_type_object) {
+        if (object) {
           status = fl_fss_basic_list_object_write(input, &location, &buffer);
 
           if (f_macro_test_for_no_data_errors(status)) {
             return status;
           }
-        } else if (type == fss_basic_list_write_type_content) {
+        } else {
           status = fl_fss_basic_list_content_write(input, &location, &buffer);
 
           if (f_macro_test_for_no_data_errors(status)) {
@@ -211,13 +205,13 @@ extern "C"{
         location.start = 0;
         location.stop = input.used - 1;
 
-        if (type == fss_basic_list_write_type_object) {
+        if (object) {
           status = fl_fss_basic_list_object_write(input, &location, &buffer);
 
           if (f_macro_test_for_no_data_errors(status)) {
             return status;
           }
-        } else if (type == fss_basic_list_write_type_content) {
+        } else {
           status = fl_fss_basic_list_content_write(input, &location, &buffer);
 
           if (f_macro_test_for_no_data_errors(status)) {
@@ -228,11 +222,11 @@ extern "C"{
         status = f_none;
       }
 
-      if (data->parameters[fss_basic_list_write_parameter_output].result == f_console_result_additional) {
+      if (data->parameters[fss_basic_list_write_parameter_file].result == f_console_result_additional) {
         f_file output = f_file_initialize;
 
         output.mode = f_file_write_append;
-        status = f_file_open(&output, argv[data->parameters[fss_basic_list_write_parameter_output].additional.array[0]]);
+        status = f_file_open(&output, argv[data->parameters[fss_basic_list_write_parameter_file].additional.array[0]]);
 
         if (status != f_none) {
           f_file_close(&output);
@@ -240,11 +234,11 @@ extern "C"{
           if (status == f_invalid_parameter) {
             fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling f_file_open()");
           } else if (status == f_file_not_found) {
-            fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: Unable to find the file '%s'", argv[data->parameters[fss_basic_list_write_parameter_output].additional.array[0]]);
+            fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: Unable to find the file '%s'", argv[data->parameters[fss_basic_list_write_parameter_file].additional.array[0]]);
           } else if (status == f_file_open_error) {
-            fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: Unable to open the file '%s'", argv[data->parameters[fss_basic_list_write_parameter_output].additional.array[0]]);
+            fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: Unable to open the file '%s'", argv[data->parameters[fss_basic_list_write_parameter_file].additional.array[0]]);
           } else if (status == f_file_descriptor_error) {
-            fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: File descriptor error while trying to open the file '%s'", argv[data->parameters[fss_basic_list_write_parameter_output].additional.array[0]]);
+            fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: File descriptor error while trying to open the file '%s'", argv[data->parameters[fss_basic_list_write_parameter_file].additional.array[0]]);
           } else {
             fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling f_file_open()", status);
           }
@@ -260,7 +254,7 @@ extern "C"{
           if (status == f_invalid_parameter) {
             fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling fl_file_write()");
           } else if (status == f_file_write_error) {
-            fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: Unable to write to the file '%s'", argv[data->parameters[fss_basic_list_write_parameter_output].additional.array[0]]);
+            fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: Unable to write to the file '%s'", argv[data->parameters[fss_basic_list_write_parameter_file].additional.array[0]]);
           } else {
             fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling fl_file_write()", status);
           }
@@ -271,9 +265,6 @@ extern "C"{
       } else {
         f_print_dynamic_string(f_standard_output, buffer);
       }
-    } else {
-      fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: you must specify the type to write: object, content, or both.");
-      status = f_invalid_parameter;
     }
 
     fss_basic_list_write_delete_data(data);
index 91605d6484a310b5d66eb0ea7921fdc032e9656c..2274b7ef89ce49d89c94e5e7b7739993bf306586 100644 (file)
@@ -48,12 +48,12 @@ extern "C"{
 #endif // _di_fss_basic_list_write_name_
 
 #ifndef _di_fss_basic_list_write_defines_
-  #define fss_basic_list_write_short_type   "t"
-  #define fss_basic_list_write_short_output "o"
+  #define fss_basic_list_write_short_object "o"
+  #define fss_basic_list_write_short_file   "f"
   #define fss_basic_list_write_short_string "s"
 
-  #define fss_basic_list_write_long_type   "type"
-  #define fss_basic_list_write_long_output "output"
+  #define fss_basic_list_write_long_object "object"
+  #define fss_basic_list_write_long_file   "file"
   #define fss_basic_list_write_long_string "string"
 
   enum {
@@ -62,24 +62,19 @@ extern "C"{
     fss_basic_list_write_parameter_no_color,
     fss_basic_list_write_parameter_version,
 
-    fss_basic_list_write_parameter_type,
-    fss_basic_list_write_parameter_output,
+    fss_basic_list_write_parameter_object,
+    fss_basic_list_write_parameter_file,
     fss_basic_list_write_parameter_string,
   };
 
-  enum {
-    fss_basic_list_write_type_object = 1,
-    fss_basic_list_write_type_content,
-  };
-
   #define f_console_parameter_initialize_fss_basic_list_write \
     { \
       f_console_parameter_initialize(f_console_standard_short_help, f_console_standard_long_help, 0, 0, f_false, f_console_type_normal, 0), \
       f_console_parameter_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, 0, f_false, f_console_type_inverse, 0), \
       f_console_parameter_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, 0, f_false, f_console_type_inverse, 0), \
       f_console_parameter_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, 0, f_false, f_console_type_normal, 0), \
-      f_console_parameter_initialize(fss_basic_list_write_short_type, fss_basic_list_write_long_type, 0, 0, f_true, f_console_type_normal, 0), \
-      f_console_parameter_initialize(fss_basic_list_write_short_output, fss_basic_list_write_long_output, 0, 0, f_true, f_console_type_normal, 0), \
+      f_console_parameter_initialize(fss_basic_list_write_short_object, fss_basic_list_write_long_object, 0, 0, f_false, f_console_type_normal, 0), \
+      f_console_parameter_initialize(fss_basic_list_write_short_file, fss_basic_list_write_long_file, 0, 0, f_true, f_console_type_normal, 0), \
       f_console_parameter_initialize(fss_basic_list_write_short_string, fss_basic_list_write_long_string, 0, 0, f_true, f_console_type_normal, 0), \
     }
 
index b420d949ee32311494c2064c81006120841b86a5..28aabf6a501ff85e18e41b3a27d61ddce104df47 100644 (file)
@@ -62,18 +62,18 @@ extern "C"{
 
     printf("\n");
     printf("\n  %s", f_console_symbol_short_enable);
-    fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_basic_write_short_type);
+    fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_basic_write_short_object);
 
     printf(", %s", f_console_symbol_long_enable);
-    fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_basic_write_long_type);
-    printf("    Specify a what to write: object or content.");
+    fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_basic_write_long_object);
+    printf("  Write an object instead of content.");
 
     printf("\n  %s", f_console_symbol_short_enable);
-    fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_basic_write_short_output);
+    fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_basic_write_short_file);
 
     printf(", %s", f_console_symbol_long_enable);
-    fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_basic_write_long_output);
-    printf("  Specify a file to send output to.");
+    fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_basic_write_long_file);
+    printf("    Specify a file to send output to.");
 
     printf("\n  %s", f_console_symbol_short_enable);
     fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_basic_write_short_string);
@@ -145,19 +145,13 @@ extern "C"{
       fss_basic_write_print_help(*data);
     } else if (data->parameters[fss_basic_write_parameter_version].result == f_console_result_found) {
       fss_basic_write_print_version(*data);
-    } else if (data->parameters[fss_basic_write_parameter_type].result == f_console_result_additional) {
+    } else {
       f_array_length counter = f_array_length_initialize;
-      f_max_u_short  type    = 0;
+      f_bool         object  = (data->parameters[fss_basic_write_parameter_object].result == f_console_result_found);
 
       f_dynamic_string  buffer   = f_dynamic_string_initialize;
       f_string_location location = f_string_location_initialize;
 
-      if (strncmp("object", argv[data->parameters[fss_basic_write_parameter_type].additional.array[0]], 7) == 0) {
-        type = fss_basic_write_type_object;
-      } else if (strncmp("content", argv[data->parameters[fss_basic_write_parameter_type].additional.array[0]], 8) == 0) {
-        type = fss_basic_write_type_content;
-      }
-
       if (data->process_pipe) {
         f_file           file  = f_file_initialize;
         f_dynamic_string input = f_dynamic_string_initialize;
@@ -187,13 +181,13 @@ extern "C"{
         location.start = 0;
         location.stop = input.used - 1;
 
-        if (type == fss_basic_write_type_object) {
+        if (object) {
           status = fl_fss_basic_object_write(input, &location, &buffer);
 
           if (f_macro_test_for_no_data_errors(status)) {
             return status;
           }
-        } else if (type == fss_basic_write_type_content) {
+        } else {
           status = fl_fss_basic_content_write(input, &location, &buffer);
 
           if (f_macro_test_for_no_data_errors(status)) {
@@ -211,13 +205,13 @@ extern "C"{
         location.start = 0;
         location.stop = input.used - 1;
 
-        if (type == fss_basic_write_type_object) {
+        if (object) {
           status = fl_fss_basic_object_write(input, &location, &buffer);
 
           if (f_macro_test_for_no_data_errors(status)) {
             return status;
           }
-        } else if (type == fss_basic_write_type_content) {
+        } else {
           status = fl_fss_basic_content_write(input, &location, &buffer);
 
           if (f_macro_test_for_no_data_errors(status)) {
@@ -228,11 +222,11 @@ extern "C"{
         status = f_none;
       }
 
-      if (data->parameters[fss_basic_write_parameter_output].result == f_console_result_additional) {
+      if (data->parameters[fss_basic_write_parameter_file].result == f_console_result_additional) {
         f_file output = f_file_initialize;
 
         output.mode = f_file_write_append;
-        status = f_file_open(&output, argv[data->parameters[fss_basic_write_parameter_output].additional.array[0]]);
+        status = f_file_open(&output, argv[data->parameters[fss_basic_write_parameter_file].additional.array[0]]);
 
         if (status != f_none) {
           f_file_close(&output);
@@ -240,11 +234,11 @@ extern "C"{
           if (status == f_invalid_parameter) {
             fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling f_file_open()");
           } else if (status == f_file_not_found) {
-            fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: Unable to find the file '%s'", argv[data->parameters[fss_basic_write_parameter_output].additional.array[0]]);
+            fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: Unable to find the file '%s'", argv[data->parameters[fss_basic_write_parameter_file].additional.array[0]]);
           } else if (status == f_file_open_error) {
-            fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: Unable to open the file '%s'", argv[data->parameters[fss_basic_write_parameter_output].additional.array[0]]);
+            fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: Unable to open the file '%s'", argv[data->parameters[fss_basic_write_parameter_file].additional.array[0]]);
           } else if (status == f_file_descriptor_error) {
-            fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: File descriptor error while trying to open the file '%s'", argv[data->parameters[fss_basic_write_parameter_output].additional.array[0]]);
+            fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: File descriptor error while trying to open the file '%s'", argv[data->parameters[fss_basic_write_parameter_file].additional.array[0]]);
           } else {
             fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling f_file_open()", status);
           }
@@ -260,7 +254,7 @@ extern "C"{
           if (status == f_invalid_parameter) {
             fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling fl_file_write()");
           } else if (status == f_file_write_error) {
-            fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: Unable to write to the file '%s'", argv[data->parameters[fss_basic_write_parameter_output].additional.array[0]]);
+            fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: Unable to write to the file '%s'", argv[data->parameters[fss_basic_write_parameter_file].additional.array[0]]);
           } else {
             fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling fl_file_write()", status);
           }
@@ -271,9 +265,6 @@ extern "C"{
       } else {
         f_print_dynamic_string(f_standard_output, buffer);
       }
-    } else {
-      fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: you must specify the type to write: object, content, or both.");
-      status = f_invalid_parameter;
     }
 
     fss_basic_write_delete_data(data);
index 705f6f5e77c6c07d2158cd23691daf445b3fb4c2..9c5402faef6863ca11e22e90db294b870ba442ad 100644 (file)
@@ -48,12 +48,12 @@ extern "C"{
 #endif // _di_fss_basic_write_name_
 
 #ifndef _di_fss_basic_write_defines_
-  #define fss_basic_write_short_type   "t"
-  #define fss_basic_write_short_output "o"
+  #define fss_basic_write_short_object "o"
+  #define fss_basic_write_short_file   "f"
   #define fss_basic_write_short_string "s"
 
-  #define fss_basic_write_long_type   "type"
-  #define fss_basic_write_long_output "output"
+  #define fss_basic_write_long_object "object"
+  #define fss_basic_write_long_file   "file"
   #define fss_basic_write_long_string "string"
 
   enum {
@@ -62,24 +62,19 @@ extern "C"{
     fss_basic_write_parameter_no_color,
     fss_basic_write_parameter_version,
 
-    fss_basic_write_parameter_type,
-    fss_basic_write_parameter_output,
+    fss_basic_write_parameter_object,
+    fss_basic_write_parameter_file,
     fss_basic_write_parameter_string,
   };
 
-  enum {
-    fss_basic_write_type_object = 1,
-    fss_basic_write_type_content,
-  };
-
   #define f_console_parameter_initialize_fss_basic_write \
     { \
       f_console_parameter_initialize(f_console_standard_short_help, f_console_standard_long_help, 0, 0, f_false, f_console_type_normal, 0), \
       f_console_parameter_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, 0, f_false, f_console_type_inverse, 0), \
       f_console_parameter_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, 0, f_false, f_console_type_inverse, 0), \
       f_console_parameter_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, 0, f_false, f_console_type_normal, 0), \
-      f_console_parameter_initialize(fss_basic_write_short_type, fss_basic_write_long_type, 0, 0, f_true, f_console_type_normal, 0), \
-      f_console_parameter_initialize(fss_basic_write_short_output, fss_basic_write_long_output, 0, 0, f_true, f_console_type_normal, 0), \
+      f_console_parameter_initialize(fss_basic_write_short_object, fss_basic_write_long_object, 0, 0, f_false, f_console_type_normal, 0), \
+      f_console_parameter_initialize(fss_basic_write_short_file, fss_basic_write_long_file, 0, 0, f_true, f_console_type_normal, 0), \
       f_console_parameter_initialize(fss_basic_write_short_string, fss_basic_write_long_string, 0, 0, f_true, f_console_type_normal, 0), \
     }
 
index c0ab863908c8f4350329996ac21c9eabe677d1a1..5d020349830bde0953f488d08e384f351f6ddf89 100644 (file)
@@ -62,18 +62,18 @@ extern "C"{
 
     printf("\n");
     printf("\n  %s", f_console_symbol_short_enable);
-    fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_extended_write_short_type);
+    fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_extended_write_short_object);
 
     printf(", %s", f_console_symbol_long_enable);
-    fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_extended_write_long_type);
-    printf("     Specify a what to write: object or content.");
+    fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_extended_write_long_object);
+    printf("   Write an object instead of content.");
 
     printf("\n  %s", f_console_symbol_short_enable);
-    fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_extended_write_short_output);
+    fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_extended_write_short_file);
 
     printf(", %s", f_console_symbol_long_enable);
-    fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_extended_write_long_output);
-    printf("   Specify a file to send output to.");
+    fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_extended_write_long_file);
+    printf("     Specify a file to send output to.");
 
     printf("\n  %s", f_console_symbol_short_enable);
     fl_print_color(f_standard_output, data.context.standout, data.context.reset, fss_extended_write_short_string);
@@ -152,19 +152,13 @@ extern "C"{
       fss_extended_write_print_help(*data);
     } else if (data->parameters[fss_extended_write_parameter_version].result == f_console_result_found) {
       fss_extended_write_print_version(*data);
-    } else if (data->parameters[fss_extended_write_parameter_type].result == f_console_result_additional) {
+    } else {
       f_array_length counter = f_array_length_initialize;
-      f_max_u_short  type    = 0;
+      f_bool         object  = (data->parameters[fss_extended_write_parameter_object].result == f_console_result_found);
 
       f_dynamic_string  buffer   = f_dynamic_string_initialize;
       f_string_location location = f_string_location_initialize;
 
-      if (strncmp("object", argv[data->parameters[fss_extended_write_parameter_type].additional.array[0]], 7) == 0) {
-        type = fss_extended_write_type_object;
-      } else if (strncmp("content", argv[data->parameters[fss_extended_write_parameter_type].additional.array[0]], 8) == 0) {
-        type = fss_extended_write_type_content;
-      }
-
       if (data->process_pipe) {
         f_file           file  = f_file_initialize;
         f_dynamic_string input = f_dynamic_string_initialize;
@@ -194,13 +188,13 @@ extern "C"{
         location.start = 0;
         location.stop = input.used - 1;
 
-        if (type == fss_extended_write_type_object) {
+        if (object) {
           status = fl_fss_extended_object_write(input, &location, &buffer);
 
           if (f_macro_test_for_no_data_errors(status)) {
             return status;
           }
-        } else if (type == fss_extended_write_type_content) {
+        } else {
           status = fl_fss_extended_content_write(input, &location, &buffer);
 
           if (f_macro_test_for_no_data_errors(status)) {
@@ -225,7 +219,7 @@ extern "C"{
       } else if (data->parameters[fss_extended_write_parameter_string].result == f_console_result_additional) {
         f_dynamic_string input = f_dynamic_string_initialize;
 
-        if (type == fss_extended_write_type_object) {
+        if (object) {
           input.string = argv[data->parameters[fss_extended_write_parameter_string].additional.array[0]];
           input.used = strlen(input.string);
 
@@ -237,7 +231,7 @@ extern "C"{
           if (f_macro_test_for_no_data_errors(status)) {
             return status;
           }
-        } else if (type == fss_extended_write_type_content) {
+        } else {
           f_string_length i = 0;
 
           while (i < data->parameters[fss_extended_write_parameter_string].additional.used) {
@@ -273,11 +267,11 @@ extern "C"{
         status = f_none;
       }
 
-      if (data->parameters[fss_extended_write_parameter_output].result == f_console_result_additional) {
+      if (data->parameters[fss_extended_write_parameter_file].result == f_console_result_additional) {
         f_file output = f_file_initialize;
 
         output.mode = f_file_write_append;
-        status = f_file_open(&output, argv[data->parameters[fss_extended_write_parameter_output].additional.array[0]]);
+        status = f_file_open(&output, argv[data->parameters[fss_extended_write_parameter_file].additional.array[0]]);
 
         if (status != f_none) {
           f_file_close(&output);
@@ -285,11 +279,11 @@ extern "C"{
           if (status == f_invalid_parameter) {
             fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling f_file_open()");
           } else if (status == f_file_not_found) {
-            fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: Unable to find the file '%s'", argv[data->parameters[fss_extended_write_parameter_output].additional.array[0]]);
+            fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: Unable to find the file '%s'", argv[data->parameters[fss_extended_write_parameter_file].additional.array[0]]);
           } else if (status == f_file_open_error) {
-            fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: Unable to open the file '%s'", argv[data->parameters[fss_extended_write_parameter_output].additional.array[0]]);
+            fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: Unable to open the file '%s'", argv[data->parameters[fss_extended_write_parameter_file].additional.array[0]]);
           } else if (status == f_file_descriptor_error) {
-            fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: File descriptor error while trying to open the file '%s'", argv[data->parameters[fss_extended_write_parameter_output].additional.array[0]]);
+            fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: File descriptor error while trying to open the file '%s'", argv[data->parameters[fss_extended_write_parameter_file].additional.array[0]]);
           } else {
             fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling f_file_open()", status);
           }
@@ -305,7 +299,7 @@ extern "C"{
           if (status == f_invalid_parameter) {
             fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: Invalid parameter when calling fl_file_write()");
           } else if (status == f_file_write_error) {
-            fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: Unable to write to the file '%s'", argv[data->parameters[fss_extended_write_parameter_output].additional.array[0]]);
+            fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: Unable to write to the file '%s'", argv[data->parameters[fss_extended_write_parameter_file].additional.array[0]]);
           } else {
             fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling fl_file_write()", status);
           }
@@ -316,9 +310,6 @@ extern "C"{
       } else {
         f_print_dynamic_string(f_standard_output, buffer);
       }
-    } else {
-      fl_print_color_line(f_standard_error, data->context.error, data->context.reset, "ERROR: you must specify the type to write: object, content, or both.");
-      status = f_invalid_parameter;
     }
 
     fss_extended_write_delete_data(data);
index 5c9adeed54ab8a5098ec62ceee33c79fa0cd3627..ea14489e2419a737ddf11bf93299973e2e5b2156 100644 (file)
@@ -48,13 +48,13 @@ extern "C"{
 #endif // _di_fss_extended_write_name_
 
 #ifndef _di_fss_extended_write_defines_
-  #define fss_extended_write_short_type    "t"
-  #define fss_extended_write_short_output  "o"
+  #define fss_extended_write_short_object  "o"
+  #define fss_extended_write_short_file    "f"
   #define fss_extended_write_short_string  "s"
   #define fss_extended_write_short_partial "p"
 
-  #define fss_extended_write_long_type    "type"
-  #define fss_extended_write_long_output  "output"
+  #define fss_extended_write_long_object  "object"
+  #define fss_extended_write_long_file    "file"
   #define fss_extended_write_long_string  "string"
   #define fss_extended_write_long_partial "partial"
 
@@ -64,25 +64,20 @@ extern "C"{
     fss_extended_write_parameter_no_color,
     fss_extended_write_parameter_version,
 
-    fss_extended_write_parameter_type,
-    fss_extended_write_parameter_output,
+    fss_extended_write_parameter_object,
+    fss_extended_write_parameter_file,
     fss_extended_write_parameter_string,
     fss_extended_write_parameter_partial,
   };
 
-  enum {
-    fss_extended_write_type_object = 1,
-    fss_extended_write_type_content,
-  };
-
   #define f_console_parameter_initialize_fss_extended_write \
     { \
       f_console_parameter_initialize(f_console_standard_short_help, f_console_standard_long_help, 0, 0, f_false, f_console_type_normal, 0), \
       f_console_parameter_initialize(f_console_standard_short_light, f_console_standard_long_light, 0, 0, f_false, f_console_type_inverse, 0), \
       f_console_parameter_initialize(f_console_standard_short_no_color, f_console_standard_long_no_color, 0, 0, f_false, f_console_type_inverse, 0), \
       f_console_parameter_initialize(f_console_standard_short_version, f_console_standard_long_version, 0, 0, f_false, f_console_type_normal, 0), \
-      f_console_parameter_initialize(fss_extended_write_short_type, fss_extended_write_long_type, 0, 0, f_true, f_console_type_normal, 0), \
-      f_console_parameter_initialize(fss_extended_write_short_output, fss_extended_write_long_output, 0, 0, f_true, f_console_type_normal, 0), \
+      f_console_parameter_initialize(fss_extended_write_short_object, fss_extended_write_long_object, 0, 0, f_false, f_console_type_normal, 0), \
+      f_console_parameter_initialize(fss_extended_write_short_file, fss_extended_write_long_file, 0, 0, f_true, f_console_type_normal, 0), \
       f_console_parameter_initialize(fss_extended_write_short_string, fss_extended_write_long_string, 0, 0, f_true, f_console_type_normal, 0), \
       f_console_parameter_initialize(fss_extended_write_short_partial, fss_extended_write_long_partial, 0, 0, f_false, f_console_type_normal, 0), \
     }