Log size has been added to log view window

pull/95/head
Ivan Yartsev 2 years ago
parent 876f7cc8bf
commit 6874b297c0

@ -2614,7 +2614,16 @@ void on_log_edit(GtkWidget *self,main_window *widgets){
temp_paths=NULL;
for (int i=0;i<sz;i++){
if (!access(parsed_paths[i],F_OK))
yon_char_unite(temp_paths ? yon_char_append(temp_paths," ") : "",parsed_paths[i],NULL);
temp_paths = yon_char_unite(temp_paths ? yon_char_append(temp_paths," ") : "",parsed_paths[i],NULL);
else {
int mask_size=0;
char *mask = yon_char_new(parsed_paths[i]);
char *path_mask = yon_char_divide(mask,yon_char_find_last(mask,'/'));
config_str mask_found = yon_dir_get_by_mask(path_mask,mask,&mask_size);
for (int l=0;l<mask_size;l++){
temp_paths = yon_char_unite(temp_paths ? yon_char_append(temp_paths," ") : "",path_mask,"/",mask_found[l],NULL);
}
}
}
if (!yon_char_is_empty(temp_paths)){
config_str logsize = yon_config_load(logrotate_size_command(temp_paths),&sz);

@ -208,6 +208,7 @@
#define CONTROL_LABEL _("Control:")
#define LOG_FILE_LABEL _("Log file")
#define NAME_LABEL _("Name:")
#define TOTAL_LOG_SIZE_LABEL _("Log size:")
//ubl-settings-logging-rules.glade
#define OWNER_LABEL _("Owner rules")

@ -877,6 +877,41 @@ config_str yon_dir_get_contents(char *dir_path, int *size){
return dir;
}
config_str yon_dir_get_by_mask(char *path, char *mask, int *size){
(*size)=0;
if (yon_char_find_count(mask,"*")<=1){
char *lpart;
char *rpart=yon_char_new(mask);
lpart = yon_char_divide_search(rpart,"*",-1);
config_str files = NULL;
int found_size;
config_str found_files = yon_dir_get_contents(path,&found_size);
int found = 1;
int rfound = 0;
for (int i=0;i<found_size;i++){
found = 1;
int c;
for (c=0;c<strlen(found_files[i]);c++){
if (found_files[i][c]!=lpart[c]){
found=0;
break;
}
if (c==strlen(lpart)-1) break;
}
if (found){
for (int l=c;l<strlen(found_files[i]);l++){
if (found_files[i][l]==rpart[rfound]) rfound++;
else rfound=0;
}
if (rfound==strlen(rpart)) {
yon_char_parsed_add_or_create_if_exists(files,size,found_files[i]);
}
}
}
return files;
}
}
//config functions
typedef struct yon_config_parameter

@ -581,6 +581,8 @@ int yon_file_create_full_path(char *path, int rules);
*/
config_str yon_dir_get_contents(char *dir_path, int *size);
config_str yon_dir_get_by_mask(char *path, char *mask, int *size);
//config functions
#define ubconfig_save_command "ubconfig"

Loading…
Cancel
Save