|
|
@ -1,4 +1,5 @@
|
|
|
|
#include "system_cmd_quotas.h"
|
|
|
|
#include "system_cmd_quotas.h"
|
|
|
|
|
|
|
|
#include "my_type.h"
|
|
|
|
|
|
|
|
|
|
|
|
namespace Quotas_sys {
|
|
|
|
namespace Quotas_sys {
|
|
|
|
Quotas_sys::Quotas_sys() {
|
|
|
|
Quotas_sys::Quotas_sys() {
|
|
|
@ -158,31 +159,75 @@ bool Quotas_sys::off_quota_system(string partition, string quota_hw, string quot
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Quotas_sys::pars_data(string cmd) {
|
|
|
|
vector<data_all_quotas> Quotas_sys::pars_data(string cmd) {
|
|
|
|
string start_pars = "------\n";
|
|
|
|
string start_pars = "------\n";
|
|
|
|
string response = obj_process_call.call_all_sections(cmd);
|
|
|
|
string response = obj_process_call.call_all_sections(cmd);
|
|
|
|
size_t index_start = response.find(start_pars);
|
|
|
|
size_t index_start = response.find(start_pars);
|
|
|
|
string line_pars = "";
|
|
|
|
string line_pars = "";
|
|
|
|
|
|
|
|
struct data_all_quotas struct_data;
|
|
|
|
|
|
|
|
vector<data_all_quotas> vec_struct_data;
|
|
|
|
int index = 0;
|
|
|
|
int index = 0;
|
|
|
|
int old_index = index;
|
|
|
|
int old_index = index;
|
|
|
|
if (index_start!=string::npos) {
|
|
|
|
if (index_start != string::npos) {
|
|
|
|
response = response.substr(index_start+start_pars.length(), response.length());
|
|
|
|
response = response.substr(index_start+start_pars.length(), response.length());
|
|
|
|
vector<int> vec_index_sep = Utils::find_all(response, "\n");
|
|
|
|
vector<int> 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++) {
|
|
|
|
for (size_t i = 0; i < vec_index_sep.size(); i++) {
|
|
|
|
old_index = index;
|
|
|
|
old_index = index;
|
|
|
|
index = vec_index_sep[i];
|
|
|
|
index = vec_index_sep[i];
|
|
|
|
if (index-1 == old_index) {
|
|
|
|
if (index-1 == old_index) {
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
line_pars = line_pars.substr(old_index, index);
|
|
|
|
line_pars = response.substr(old_index, index);
|
|
|
|
part_quotas_line(line_pars);
|
|
|
|
struct_data = part_quotas_line(line_pars);
|
|
|
|
|
|
|
|
vec_struct_data.push_back(struct_data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
struct status_quotas part_quotas_line(string line) {
|
|
|
|
|
|
|
|
vector<int> vec_index_sep = Utils::find_all(response, "\t");
|
|
|
|
struct data_all_quotas Quotas_sys::part_quotas_line(string line) {
|
|
|
|
cout << vec_index_sep.size() << endl;
|
|
|
|
struct data_all_quotas struct_data;
|
|
|
|
|
|
|
|
vector<int> vec_index_sep = Utils::find_all(line, " ");
|
|
|
|
|
|
|
|
int old_index = 0;
|
|
|
|
|
|
|
|
string buff = "";
|
|
|
|
|
|
|
|
int index_data = 0;
|
|
|
|
|
|
|
|
for (int& index: vec_index_sep) {
|
|
|
|
|
|
|
|
if ((index - old_index) >= 2) {
|
|
|
|
|
|
|
|
buff = line.substr(old_index, index - old_index);
|
|
|
|
|
|
|
|
if (index_data == 0) {
|
|
|
|
|
|
|
|
struct_data.username = buff;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (index_data == 1) {
|
|
|
|
|
|
|
|
struct_data.status = buff;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (index_data == 2) {
|
|
|
|
|
|
|
|
struct_data.block_used = buff;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (index_data == 3) {
|
|
|
|
|
|
|
|
struct_data.block_soft = buff;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (index_data == 4) {
|
|
|
|
|
|
|
|
struct_data.block_hard = buff;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (index_data == 5) {
|
|
|
|
|
|
|
|
struct_data.block_grace = buff;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (index_data == 6) {
|
|
|
|
|
|
|
|
struct_data.file_used = buff;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (index_data == 7) {
|
|
|
|
|
|
|
|
struct_data.file_soft = buff;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (index_data == 8) {
|
|
|
|
|
|
|
|
struct_data.file_hard = buff;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (index == 9) {
|
|
|
|
|
|
|
|
struct_data.file_grace = buff;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
index_data += 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
old_index = index;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return struct_data;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|