From 505f257a8cbc53d0982ae118f826e17bc6d1e924 Mon Sep 17 00:00:00 2001 From: Craig Small Date: Thu, 18 Jun 2015 22:37:24 +1000 Subject: [PATCH] library: remove procps_version functions It doesn't make any sense to have the binary version strings embedded into the library. The version strings are defined already either in the Makefile or in include/c.h --- pgrep.c | 1 - proc/libprocps.sym | 2 -- proc/version.c | 6 ------ proc/version.h | 2 -- ps/display.c | 2 +- ps/global.c | 2 +- ps/parser.c | 13 +++++++++---- top/top.c | 8 ++++---- 8 files changed, 15 insertions(+), 21 deletions(-) diff --git a/pgrep.c b/pgrep.c index bd25eaa0..9a61e6d5 100644 --- a/pgrep.c +++ b/pgrep.c @@ -53,7 +53,6 @@ #include "proc/sig.h" #include "proc/devname.h" #include "proc/sysinfo.h" -#include "proc/version.h" /* procps_version */ static int i_am_pkill = 0; diff --git a/proc/libprocps.sym b/proc/libprocps.sym index 77a658ba..9f1d61ca 100644 --- a/proc/libprocps.sym +++ b/proc/libprocps.sym @@ -4,7 +4,6 @@ global: closeproc; cpuinfo; dev_to_tty; - display_version; escape_command; escape_str; escape_strlist; @@ -47,7 +46,6 @@ global: page_bytes; pretty_print_signals; print_uptime; - procps_version; put_slabinfo; readeither; readproc; diff --git a/proc/version.c b/proc/version.c index e57cafe9..88b6eeb4 100644 --- a/proc/version.c +++ b/proc/version.c @@ -24,12 +24,6 @@ #include #include "version.h" -const char procps_version[] = PACKAGE_NAME " version " PACKAGE_VERSION; - -void display_version(void) { - fprintf(stdout, "%s\n", procps_version); -} - /* Linux kernel version information for procps-ng utilities * Copyright (c) 1996 Charles Blake */ diff --git a/proc/version.h b/proc/version.h index e7baa971..f1848ff0 100644 --- a/proc/version.h +++ b/proc/version.h @@ -15,8 +15,6 @@ EXTERN_C_BEGIN void init_Linux_version(void); /* Get Linux version */ -extern void display_version(void); /* display suite version */ -extern const char procps_version[]; /* global buf for suite version */ extern int linux_version_code; /* runtime version of LINUX_VERSION_CODE in /usr/include/linux/version.h */ diff --git a/ps/display.c b/ps/display.c index a2adcc8f..7dfde122 100644 --- a/ps/display.c +++ b/ps/display.c @@ -55,7 +55,7 @@ static void signal_handler(int signo){ signo, signal_number_to_name(signo), myname, - procps_version + PACKAGE_VERSION ); switch (signo) { case SIGHUP: diff --git a/ps/global.c b/ps/global.c index 5a4f1e57..8dc7f7be 100644 --- a/ps/global.c +++ b/ps/global.c @@ -479,7 +479,7 @@ void self_info(void){ sysv_l_format ? sysv_l_format : "(none)" ); - display_version(); + fprintf(stderr, "%s version %s\n", PACKAGE_NAME, PACKAGE_VERSION); fprintf(stderr, "Linux version %d.%d.%d\n", LINUX_VERSION_MAJOR(linux_version_code), LINUX_VERSION_MINOR(linux_version_code), diff --git a/ps/parser.c b/ps/parser.c index ad49459f..09e4d3b6 100644 --- a/ps/parser.c +++ b/ps/parser.c @@ -32,9 +32,9 @@ #include #include "../proc/alloc.h" -#include "../proc/version.h" #include "common.h" +#include "c.h" #define ARG_GNU 0 #define ARG_END 1 @@ -58,6 +58,11 @@ static int force_bsd = 0; /* set when normal parsing fails */ return _("the option is exclusive: " x) /********** utility functions **********/ +static void display_ps_version(void) +{ + fprintf(stdout, PROCPS_NG_VERSION); +} + /* * Both "-Oppid" and "-O ppid" should be legal, though Unix98 @@ -341,7 +346,7 @@ static const char *parse_sysv_option(void){ case 'V': /* single */ trace("-V prints version\n"); exclusive("-V"); - display_version(); + display_ps_version(); exit(0); // This must be verified against SVR4-MP. (UnixWare or Powermax) // Leave it undocumented until that problem is solved. @@ -610,7 +615,7 @@ static const char *parse_bsd_option(void){ case 'V': /* single */ trace("V show version info\n"); exclusive("V"); - display_version(); + display_ps_version(); exit(0); case 'W': trace("W N/A get swap info from ... not /dev/drum.\n"); @@ -1029,7 +1034,7 @@ static const char *parse_gnu_option(void){ case_version: trace("--version\n"); exclusive("--version"); - display_version(); + display_ps_version(); exit(0); return NULL; case_context: diff --git a/top/top.c b/top/top.c index a51835bb..4b38754e 100644 --- a/top/top.c +++ b/top/top.c @@ -445,7 +445,7 @@ static void bye_bye (const char *str) { , LINUX_VERSION_MAJOR(linux_version_code) , LINUX_VERSION_MINOR(linux_version_code) , LINUX_VERSION_PATCH(linux_version_code) - , procps_version + , PACKAGE_STRING , (unsigned)Hertz, (unsigned)sizeof(Hertz), (unsigned)sizeof(Hertz) * 8 , (int)page_bytes, Cpu_faux_tot, (int)smp_num_cpus, (unsigned)sizeof(CPU_t) , (unsigned)sizeof(HST_t), ((int)page_bytes / (int)sizeof(HST_t)), HHist_siz @@ -3696,7 +3696,7 @@ static void parse_args (char **args) { case 'h': case 'v': puts(fmtmk(N_fmt(HELP_cmdline_fmt) - , procps_version, Myname, N_txt(USAGE_abbrev_txt))); + , PACKAGE_STRING, Myname, N_txt(USAGE_abbrev_txt))); bye_bye(NULL); case 'i': TOGw(Curwin, Show_IDLEPS); @@ -3975,7 +3975,7 @@ signify_that: putp(Cap_home); // this string is well above ISO C89's minimum requirements! show_special(1, fmtmk(N_unq(COLOR_custom_fmt) - , procps_version, w->grpname + , PACKAGE_STRING, w->grpname , CHKw(w, View_NOBOLD) ? N_txt(ON_word_only_txt) : N_txt(OFF_one_word_txt) , CHKw(w, Show_COLORS) ? N_txt(ON_word_only_txt) : N_txt(OFF_one_word_txt) , CHKw(w, Show_HIBOLD) ? N_txt(ON_word_only_txt) : N_txt(OFF_one_word_txt) @@ -4219,7 +4219,7 @@ signify_that: adj_geometry(); show_special(1, fmtmk(N_unq(KEYS_helpbas_fmt) - , procps_version + , PACKAGE_STRING , w->grpname , CHKw(w, Show_CTIMES) ? N_txt(ON_word_only_txt) : N_txt(OFF_one_word_txt) , Rc.delay_time