static int save_one_area(const char *dbf_dir_name, const char *area_name, command_t *cmd) { char dir_name_area[PATH_MAX]; debug_info_t *db_info; int i; db_info = find_debug_area(area_name); if (db_info == NULL) { fprintf(cmd->efp, "Debug log '%s' not found!\n", area_name); return -1; } sprintf(dir_name_area, "%s/%s", dbf_dir_name, area_name); if (mkdir(dir_name_area, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0) { fprintf(cmd->efp, "Could not create directory: %s (%s)\n", dir_name_area, strerror(errno)); return -1; } for (i = 0; i < DEBUG_MAX_VIEWS; i++) { if (db_info->views[i] == NULL) continue; if (!find_lcrash_debug_view(db_info->views[i]->name)) continue; save_one_view(dbf_dir_name, area_name, db_info->views[i]->name, cmd); } return 0; }
static int save_one_view(const char *dbf_dir_name, const char *area_name, const char *view_name, command_t *cmd) { char path_view[PATH_MAX]; debug_info_t *db_info; debug_view_t *db_view; FILE *view_fh; db_info = find_debug_area(area_name); if (db_info == NULL) { fprintf(cmd->efp, "Debug log '%s' not found!\n", area_name); return -1; } db_info = get_debug_info(db_info->addr, 1); db_view = find_lcrash_debug_view(view_name); if (db_view == NULL) { fprintf(cmd->efp, "View '%s' not registered!\n", view_name); return -1; } sprintf(path_view, "%s/%s/%s", dbf_dir_name, area_name, view_name); view_fh = fopen(path_view, "w"); if (view_fh == NULL) { fprintf(cmd->efp, "Could not create file: %s (%s)\n", path_view, strerror(errno)); return -1; } debug_write_output(db_info, db_view, view_fh); fclose(view_fh); return 0; }
static int list_one_area(const char *area_name, command_t * cmd) { debug_info_t *db_info; int i; if ((db_info = find_debug_area(area_name)) == NULL) { fprintf(cmd->efp, "Debug log '%s' not found!\n", area_name); return -1; } fprintf(cmd->ofp, "INSTALLED VIEWS FOR '%s':\n", area_name); fprintf(cmd->ofp, "================================================" "==============================\n"); for (i = 0; i < DEBUG_MAX_VIEWS; i++) { if (db_info->views[i] != NULL) { fprintf(cmd->ofp, " - %s ", db_info->views[i]->name); if (find_lcrash_debug_view(db_info->views[i]->name)) fprintf(cmd->ofp, "(available)\n"); else fprintf(cmd->ofp, "(not available)\n"); } } fprintf(cmd->ofp, "=================================================" "=============================\n"); return 0; }
static int list_one_view(char *area_name, char *view_name, command_t * cmd) { debug_info_t *db_info; debug_view_t *db_view; if ((db_info = find_debug_area(area_name)) == NULL) { fprintf(cmd->efp, "Debug log '%s' not found!\n", area_name); return -1; } db_info = get_debug_info(db_info->addr,1); if ((db_view = find_lcrash_debug_view(view_name)) == NULL) { fprintf(cmd->efp, "View '%s' not registered!\n", view_name); return -1; } if(dbf_version == DBF_VERSION_V1){ debug_format_output_v1(db_info, db_view, cmd->ofp); free_debug_info_v1(db_info); } else { debug_format_output_v2(db_info, db_view, cmd->ofp); free_debug_info_v2(db_info); } return 0; }
static int list_one_view(char *area_name, char *view_name, command_t * cmd) { debug_info_t *db_info; debug_view_t *db_view; if ((db_info = find_debug_area(area_name)) == NULL) { fprintf(cmd->efp, "Debug log '%s' not found!\n", area_name); return -1; } db_info = get_debug_info(db_info->addr,1); if ((db_view = find_lcrash_debug_view(view_name)) == NULL) { fprintf(cmd->efp, "View '%s' not registered!\n", view_name); return -1; } debug_write_output(db_info, db_view, cmd->ofp); return 0; }