/* * This function handles the '@' expansion. We allow recursive * expansion; an @ expression can contain further '@' and '%' * expressions. */ static _INLINE_ void expand_at_expression(FILE *f, e2fsck_t ctx, char ch, struct problem_context *pctx, int *first, int recurse) { const char **cpp, *str; /* Search for the abbreviation */ for (cpp = abbrevs; *cpp; cpp++) { if (ch == *cpp[0]) break; } if (*cpp && recurse < 10) { str = _(*cpp) + 1; if (*first && islower(*str)) { *first = 0; fputc(toupper(*str++), f); } print_e2fsck_message(f, ctx, str, pctx, *first, recurse+1); } else fprintf(f, "@%c", ch); }
/* * This function handles the '@' expansion. We allow recursive * expansion; an @ expression can contain further '@' and '%' * expressions. */ static _INLINE_ void expand_at_expression(e2fsck_t ctx, char ch, struct problem_context *pctx, int *first) { const char **cpp, *str; /* Search for the abbreviation */ for (cpp = abbrevs; *cpp; cpp++) { if (ch == *cpp[0]) break; } if (*cpp) { str = (*cpp) + 1; if (*first && islower(*str)) { *first = 0; fputc(toupper(*str++), stdout); } print_e2fsck_message(ctx, _(str), pctx, *first); } else printf("@%c", ch); }
int fix_problem(e2fsck_t ctx, problem_t code, struct problem_context *pctx) { ext2_filsys fs = ctx->fs; const struct e2fsck_problem *ptr; struct latch_descr *ldesc = 0; const char *message; int def_yn, answer, ans; int print_answer = 0; int suppress = 0; ptr = find_problem(code); if (!ptr) { printf(_("Unhandled error code (%d)!\n"), code); return 0; } def_yn = 1; if ((ptr->flags & PR_NO_DEFAULT) || ((ptr->flags & PR_PREEN_NO) && (ctx->options & E2F_OPT_PREEN)) || (ctx->options & E2F_OPT_NO)) def_yn= 0; /* * Do special latch processing. This is where we ask the * latch question, if it exists */ if (ptr->flags & PR_LATCH_MASK) { ldesc = find_latch(ptr->flags & PR_LATCH_MASK); if (ldesc->question && !(ldesc->flags & PRL_LATCHED)) { ans = fix_problem(ctx, ldesc->question, pctx); if (ans == 1) ldesc->flags |= PRL_YES; if (ans == 0) ldesc->flags |= PRL_NO; ldesc->flags |= PRL_LATCHED; } if (ldesc->flags & PRL_SUPPRESS) suppress++; } if ((ptr->flags & PR_PREEN_NOMSG) && (ctx->options & E2F_OPT_PREEN)) suppress++; if ((ptr->flags & PR_NO_NOMSG) && (ctx->options & E2F_OPT_NO)) suppress++; if (!suppress) { message = ptr->e2p_description; if (ctx->options & E2F_OPT_PREEN) { printf("%s: ", ctx->device_name); #if 0 if (ptr->e2p_preen_msg) message = ptr->e2p_preen_msg; #endif } print_e2fsck_message(ctx, _(message), pctx, 1); } if (!(ptr->flags & PR_PREEN_OK) && (ptr->prompt != PROMPT_NONE)) preenhalt(ctx); if (ptr->flags & PR_FATAL) fatal_error(ctx, 0); if (ptr->prompt == PROMPT_NONE) { if (ptr->flags & PR_NOCOLLATE) answer = -1; else answer = def_yn; } else { if (ctx->options & E2F_OPT_PREEN) { answer = def_yn; if (!(ptr->flags & PR_PREEN_NOMSG)) print_answer = 1; } else if ((ptr->flags & PR_LATCH_MASK) && (ldesc->flags & (PRL_YES | PRL_NO))) { if (!suppress) print_answer = 1; if (ldesc->flags & PRL_YES) answer = 1; else answer = 0; } else answer = ask(ctx, _(prompt[(int) ptr->prompt]), def_yn); if (!answer && !(ptr->flags & PR_NO_OK)) ext2fs_unmark_valid(fs); if (print_answer) printf("%s.\n", answer ? _(preen_msg[(int) ptr->prompt]) : _("IGNORED")); } if ((ptr->prompt == PROMPT_ABORT) && answer) fatal_error(ctx, 0); if (ptr->flags & PR_AFTER_CODE) answer = fix_problem(ctx, ptr->second_code, pctx); return answer; }