| 4907 | */ |
| 4908 | |
| 4909 | void do_diff_files(struct st_command *command) |
| 4910 | { |
| 4911 | int error= 0; |
| 4912 | static DYNAMIC_STRING ds_filename; |
| 4913 | static DYNAMIC_STRING ds_filename2; |
| 4914 | const struct command_arg diff_file_args[] = { |
| 4915 | { "file1", ARG_STRING, TRUE, &ds_filename, "First file to diff" }, |
| 4916 | { "file2", ARG_STRING, TRUE, &ds_filename2, "Second file to diff" } |
| 4917 | }; |
| 4918 | DBUG_ENTER("do_diff_files"); |
| 4919 | |
| 4920 | check_command_args(command, |
| 4921 | command->first_argument, |
| 4922 | diff_file_args, |
| 4923 | sizeof(diff_file_args)/sizeof(struct command_arg), |
| 4924 | ' '); |
| 4925 | |
| 4926 | if (access(ds_filename.str, F_OK) != 0) |
| 4927 | die("command \"diff_files\" failed, file '%s' does not exist", |
| 4928 | ds_filename.str); |
| 4929 | |
| 4930 | if (access(ds_filename2.str, F_OK) != 0) |
| 4931 | die("command \"diff_files\" failed, file '%s' does not exist", |
| 4932 | ds_filename2.str); |
| 4933 | |
| 4934 | if ((error= compare_files(ds_filename.str, ds_filename2.str)) && |
| 4935 | match_expected_error(command, error, NULL) < 0) |
| 4936 | { |
| 4937 | /* |
| 4938 | Compare of the two files failed, append them to output |
| 4939 | so the failure can be analyzed, but only if it was not |
| 4940 | expected to fail. |
| 4941 | */ |
| 4942 | show_diff(&ds_res, ds_filename.str, ds_filename2.str); |
| 4943 | log_file.write(&ds_res); |
| 4944 | log_file.flush(); |
| 4945 | dynstr_set(&ds_res, 0); |
| 4946 | } |
| 4947 | |
| 4948 | dynstr_free(&ds_filename); |
| 4949 | dynstr_free(&ds_filename2); |
| 4950 | handle_command_error(command, error, -1); |
| 4951 | DBUG_VOID_RETURN; |
| 4952 | } |
| 4953 | |
| 4954 | |
| 4955 | struct st_connection * find_connection_by_name(const char *name) |
no test coverage detected