From 61a401c9e99b2c39fc34af5cafdad7eb7104c483 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Fri, 14 Apr 2023 17:58:44 +0600 Subject: [PATCH] fix --- source/CMakeLists.txt | 1 - source/global_var.h | 3 --- source/load.cc | 2 +- source/my_plug.h | 1 - source/my_type.h | 2 ++ source/system_cmd_quotas.cc | 27 +++++++++++++++++++++++++++ source/system_cmd_quotas.h | 3 +++ source/ubl-settings-diskquota.cc | 1 + source/ubl-settings-diskquota.h | 1 - 9 files changed, 34 insertions(+), 7 deletions(-) delete mode 100644 source/global_var.h diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 47b4319..6f07a84 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -21,7 +21,6 @@ set(SOURCE_FILES system_cmd_quotas.cc system_cmd_quotas.h controler.h - global_var.h controler.cc my_device.h my_device.cc diff --git a/source/global_var.h b/source/global_var.h deleted file mode 100644 index 22f6316..0000000 --- a/source/global_var.h +++ /dev/null @@ -1,3 +0,0 @@ - -#include "project_lib.h" -#include "my_type.h" diff --git a/source/load.cc b/source/load.cc index e8a361b..200c4b3 100644 --- a/source/load.cc +++ b/source/load.cc @@ -36,4 +36,4 @@ namespace Lib_Load{ return process.get_count_error(); } -} \ No newline at end of file +} diff --git a/source/my_plug.h b/source/my_plug.h index 20a0916..5d9a3d1 100644 --- a/source/my_plug.h +++ b/source/my_plug.h @@ -1,6 +1,5 @@ #include "project_lib.h" #include "ubl-settings-diskquota.h" -#include "global_var.h" class CmdArgParser : public Glib::OptionGroup { public: diff --git a/source/my_type.h b/source/my_type.h index cbf21fa..e4b0b7b 100644 --- a/source/my_type.h +++ b/source/my_type.h @@ -45,6 +45,8 @@ struct status_quotas { bool project; bool status; }; + + typedef struct users_grups USER_GRUPS; typedef map map_str_str; typedef map * map_s_s_ptr; diff --git a/source/system_cmd_quotas.cc b/source/system_cmd_quotas.cc index c4da725..e7cf0c3 100644 --- a/source/system_cmd_quotas.cc +++ b/source/system_cmd_quotas.cc @@ -158,4 +158,31 @@ bool Quotas_sys::off_quota_system(string partition, string quota_hw, string quot } +void Quotas_sys::pars_data(string cmd) { + string start_pars = "------\n"; + string response = obj_process_call.call_all_sections(cmd); + size_t index_start = response.find(start_pars); + string line_pars = ""; + int index = 0; + int old_index = index; + if (index_start!=string::npos) { + response = response.substr(index_start+start_pars.length(), response.length()); + vector vec_index_sep = Utils::find_all(response, "\n"); + cout << response.substr(0, vec_index_sep[0]) << endl; + for (size_t i = 0; i < vec_index_sep.size(); i++) { + old_index = index; + index = vec_index_sep[i]; + if (index-1 == old_index) { + break; + } + line_pars = line_pars.substr(old_index, index); + part_quotas_line(line_pars); + } + } +} +struct status_quotas part_quotas_line(string line) { + vector vec_index_sep = Utils::find_all(response, "\t"); + cout << vec_index_sep.size() << endl; +} + } \ No newline at end of file diff --git a/source/system_cmd_quotas.h b/source/system_cmd_quotas.h index a75b458..f0df3aa 100644 --- a/source/system_cmd_quotas.h +++ b/source/system_cmd_quotas.h @@ -24,6 +24,9 @@ class Quotas_sys { struct status_quotas check_on_quotas_system_2_hw(string params); bool on_quota_hw(string partition, string cmd_hw, string cmd_sw); bool on_quota_sw(string partition, int mode); + void pars_data(string cmd); + protected: + struct status_quotas part_quotas_line(string line); }; } #endif \ No newline at end of file diff --git a/source/ubl-settings-diskquota.cc b/source/ubl-settings-diskquota.cc index ded33a9..2dcdcaa 100755 --- a/source/ubl-settings-diskquota.cc +++ b/source/ubl-settings-diskquota.cc @@ -59,6 +59,7 @@ void MainWindow::settings() { this->load_system_cfg(); this->load_global_cfg(); this->event(); + obj_quotas_sys.pars_data("repquota -pu /mnt/ext4"); } else { boxFuncs->set_sensitive(false); diff --git a/source/ubl-settings-diskquota.h b/source/ubl-settings-diskquota.h index d28e77e..9a2307d 100644 --- a/source/ubl-settings-diskquota.h +++ b/source/ubl-settings-diskquota.h @@ -8,7 +8,6 @@ #include "my_type.h" #include "my_device.h" #include "controler.h" -#include "global_var.h" using namespace std;