Change hard-coded "iptraf-ng" string into IPTRAF_NAME define.
Also print IPTRAF_VERSION in the first line.
Signed-off-by: Vitezslav Samel <vitezslav(a)samel.cz>
---
Makefile | 3 ++-
src/iptraf.c | 8 ++++----
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
index 00661ed..9db7942 100644
--- a/Makefile
+++ b/Makefile
@@ -268,7 +268,8 @@ iptraf-ng: $(iptraf-o)
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ \
$(iptraf-o) $(ALL_LDFLAGS) $(NCURSES_LDFLAGS)
-src/deskman.o: EXTRA_CPPFLAGS = -DIPTRAF_VERSION='"$(IPTRAF_VERSION)"'
\
+src/deskman.o src/iptraf.o: EXTRA_CPPFLAGS = \
+ -DIPTRAF_VERSION='"$(IPTRAF_VERSION)"' \
-DIPTRAF_NAME='"iptraf-ng"'
rvnamed-ng: $(rvnamed-o)
diff --git a/src/iptraf.c b/src/iptraf.c
index a6c3192..0cf91b9 100644
--- a/src/iptraf.c
+++ b/src/iptraf.c
@@ -286,8 +286,8 @@ static void mark_first_instance(void)
}
static const char *const iptraf_ng_usage[] = {
- "iptraf-ng [options]",
- "iptraf-ng [options] -B [-i <iface> | -d <iface> | -s <iface> |
-z <iface> | -l <iface> | -g]",
+ IPTRAF_NAME " [options]",
+ IPTRAF_NAME " [options] -B [-i <iface> | -d <iface> | -s <iface>
| -z <iface> | -l <iface> | -g]",
NULL
};
@@ -442,7 +442,7 @@ int main(int argc, char **argv)
options.logging = 1;
break;
case -1: /* error */
- die("Fork error, iptraf-ng cannot run in background");
+ die("Fork error, %s cannot run in background", IPTRAF_NAME);
default: /* parent */
exit(0);
}
@@ -523,7 +523,7 @@ int main(int argc, char **argv)
* */
draw_desktop();
attrset(STATUSBARATTR);
- mvprintw(0, 1, "iptraf-ng");
+ mvprintw(0, 1, "%s %s", IPTRAF_NAME, IPTRAF_VERSION);
/* simplify */
if (g_opt)
--
1.7.8.4
Show replies by date