diff --git a/top/top.c b/top/top.c index ea1a8fe2..a40b1d33 100644 --- a/top/top.c +++ b/top/top.c @@ -82,6 +82,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; /* SMP, Irix/Solaris mode, Linux 2.5.xx support (and beyond) */ static long Hertz; @@ -3613,6 +3614,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'; @@ -4638,6 +4643,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 c69385df..cfb90321 100644 --- a/top/top_nls.c +++ b/top/top_nls.c @@ -509,6 +509,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 e728b763..daee67bd 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,