diff --git a/top/top.c b/top/top.c index 49582b0e..46ec92c8 100644 --- a/top/top.c +++ b/top/top.c @@ -86,6 +86,7 @@ static sigset_t Sigwinch_set; static char Rc_name [OURPATHSZ]; static RCF_t Rc = DEF_RCFILE; static int Rc_questions; +static int Rc_compatibilty; /* The run-time acquired page stuff */ static unsigned Pg2K_shft = 0; @@ -4027,6 +4028,10 @@ static const char *configs_file (FILE *fp, const char *name, float *delay) { if (Rc.zero_suppress < 0 || Rc.zero_suppress > 1) Rc.zero_suppress = 0; + // prepare to warn that older top can no longer read rcfile ... + if (Rc.id != RCF_VERSION_ID) + Rc_compatibilty = 1; + // lastly, let's process any optional glob(s) ... // (darn, must do osel 1st even though alphabetically 2nd) fbuf[0] = '\0'; @@ -5049,6 +5054,12 @@ static void write_rcfile (void) { return; Rc_questions = 0; } + if (Rc_compatibilty) { + show_pmt(N_txt(XTRA_warnold_txt)); + if ('y' != tolower(iokey(1))) + return; + Rc_compatibilty = 0; + } if (!(fp = fopen(Rc_name, "w"))) { show_msg(fmtmk(N_fmt(FAIL_rc_open_fmt), Rc_name, strerror(errno))); return; diff --git a/top/top_nls.c b/top/top_nls.c index 51b7a0c6..ab3029e0 100644 --- a/top/top_nls.c +++ b/top/top_nls.c @@ -503,6 +503,7 @@ static void build_norm_nlstab (void) { Norm_nlstab[XTRA_vforest_fmt] = _("PID to collapse/expand [default pid = %d]"); Norm_nlstab[XTRA_size2up_txt] = _("terminal is not wide enough"); Norm_nlstab[XTRA_modebad_txt] = _("wrong mode, command inactive"); + Norm_nlstab[XTRA_warnold_txt] = _("saving prevents older top from reading, save anyway?"); } diff --git a/top/top_nls.h b/top/top_nls.h index 2783368b..6c30dcd7 100644 --- a/top/top_nls.h +++ b/top/top_nls.h @@ -83,7 +83,7 @@ enum norm_nls { WORD_eachcpu_fmt, WORD_exclude_txt, WORD_include_txt, WORD_noneone_txt, WORD_process_txt, WORD_threads_txt, WRITE_rcfile_fmt, WRONG_switch_fmt, XTRA_badflds_fmt, XTRA_fixwide_fmt, XTRA_modebad_txt, XTRA_size2up_txt, - XTRA_vforest_fmt, XTRA_warncfg_txt, XTRA_winsize_txt, + XTRA_vforest_fmt, XTRA_warncfg_txt, XTRA_warnold_txt, XTRA_winsize_txt, #ifndef INSP_OFFDEMO YINSP_demo01_txt, YINSP_demo02_txt, YINSP_demo03_txt, YINSP_deqfmt_txt, YINSP_deqtyp_txt, YINSP_dstory_txt,