Skip to content

Commit 13c4589

Browse files
authored
Merge 54b3a7c into f1bc634
2 parents f1bc634 + 54b3a7c commit 13c4589

39 files changed

+339
-69
lines changed

NEWS.adoc

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -86,19 +86,26 @@ https://github.com/networkupstools/nut/milestone/11
8686
in certain cases against high voltage transfer, we only fixed-up one of
8787
them. [#1245]
8888
89-
- development iterations of NUT should now identify with not only the semantic
90-
version of a preceding release, but with git-derived information about the
91-
amount of iterations that followed (if available): the three-number "semver"
92-
would be seen on release snapshots, while other builds would expose the
93-
added components: one with the amount of commits on the main development
94-
trunk since the preceding release which are ancestors of the built code
95-
base, and in case of feature development branches -- another component
96-
with the amount of commits unique to this branch (which are not part of
97-
the development trunk). This allows to produce more relevant (monotonously
98-
growing) version identifiers for packages and similar artifacts, with more
99-
meaningful upgrades via development snapshots, eventually. A copy of the
100-
current version information would be embedded into "dist" archives as a
101-
`VERSION_DEFAULT` file. [#1949]
89+
- SEMVER, know thyself!
90+
* development iterations of NUT should now identify with not only the
91+
semantic version of a preceding release, but with git-derived information
92+
about the amount of iterations that followed (if available):
93+
the three-number "semver" would be seen on release snapshots, while
94+
other builds would expose the added components: one with the amount
95+
of commits on the main development trunk since the preceding release
96+
which are ancestors of the built code base, and in case of feature
97+
development branches -- another component with the amount of commits
98+
unique to this branch (which are not part of the development trunk yet).
99+
This allows to produce more relevant (monotonously growing) version
100+
identifiers for packages and similar artifacts, with more meaningful
101+
upgrades via development snapshots, eventually. A copy of the current
102+
version information would be embedded into "dist" archives as a
103+
`VERSION_DEFAULT` file, among provisions for packager tuning. [#1949]
104+
* SMF manifests and systemd units now refer to man pages and their online
105+
variants under `NUT_WEBSITE_BASE` dependent on codebase maturity
106+
(development or release snapshot); many programs now display such
107+
references in their command-line usage help, method `suggest_doc_links()`
108+
was introduced for this purpose. [issue #722, PR #2733]
102109
103110
- the `upsnotify()` common code introduced in recent NUT releases (integrating
104111
with service management frameworks, etc.) was a bit cryptic when it reported

clients/upsc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ static void usage(const char *prog)
6262
printf(" -h - display this help text\n");
6363

6464
nut_report_config_flags();
65+
66+
printf("\n%s", suggest_doc_links(prog, NULL));
6567
}
6668

6769
static void printvar(const char *var)

clients/upscmd.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ static void usage(const char *prog)
6868
printf(" [<value>] Additional data for command - number of seconds, etc.\n");
6969

7070
nut_report_config_flags();
71+
72+
printf("\n%s", suggest_doc_links(prog, "upsd.users"));
7173
}
7274

7375
static void print_cmd(char *cmdname)

clients/upslog.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,10 @@ static void help(const char *prog)
176176
printf("format string defaults to:\n");
177177
printf("%s\n", DEFAULT_LOGFORMAT);
178178

179-
printf("\n");
180-
printf("See the upslog(8) man page for more information.\n");
181-
182179
nut_report_config_flags();
183180

181+
printf("\n%s", suggest_doc_links(prog, NULL));
182+
184183
exit(EXIT_SUCCESS);
185184
}
186185

clients/upsmon.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3021,6 +3021,8 @@ static void help(const char *arg_progname)
30213021

30223022
nut_report_config_flags();
30233023

3024+
printf("\n%s", suggest_doc_links(arg_progname, "upsmon.conf"));
3025+
30243026
exit(EXIT_SUCCESS);
30253027
}
30263028

clients/upsrw.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ static void usage(const char *prog)
6969
printf("Call without -s to show all possible read/write variables (same as -l).\n");
7070

7171
nut_report_config_flags();
72+
73+
printf("\n%s", suggest_doc_links(prog, "upsd.users"));
7274
}
7375

7476
static void clean_exit(void)

clients/upssched.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1505,6 +1505,8 @@ static void help(const char *arg_progname)
15051505

15061506
nut_report_config_flags();
15071507

1508+
printf("\n%s", suggest_doc_links(arg_progname, "upsmon.conf"));
1509+
15081510
exit(EXIT_SUCCESS);
15091511
}
15101512

common/common.c

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,45 @@ int print_banner_once(const char *prog, int even_if_disabled)
659659
return ret;
660660
}
661661

662+
const char *suggest_doc_links(const char *progname, const char *progconf) {
663+
static char buf[LARGEBUF];
664+
665+
buf[0] = '\0';
666+
667+
if (progname) {
668+
char *s = NULL, *buf2 = xstrdup(xbasename(progname));
669+
size_t i;
670+
671+
for (i = 0; buf2[i]; i++) {
672+
buf2[i] = tolower(buf2[i]);
673+
}
674+
675+
if ((s = strstr(buf2, ".exe")) && strcmp(buf2, "nut.exe"))
676+
*s = '\0';
677+
678+
snprintf(buf, sizeof(buf),
679+
"For more information please ");
680+
#if defined(WITH_DOCS) && WITH_DOCS
681+
snprintfcat(buf, sizeof(buf),
682+
"Read The Fine Manual ('man %s') and/or ",
683+
buf2);
684+
#endif
685+
snprintfcat(buf, sizeof(buf),
686+
"see\n\t%s/docs/man/%s.html\n",
687+
NUT_WEBSITE_BASE, buf2);
688+
689+
free(buf2);
690+
}
691+
692+
if (progconf)
693+
snprintfcat(buf, sizeof(buf),
694+
"%s check documentation and samples of %s\n",
695+
progname ? "Also" : "Please",
696+
progconf);
697+
698+
return buf;
699+
}
700+
662701
/* enable writing upslog_with_errno() and upslogx() type messages to
663702
the syslog */
664703
void syslogbit_set(void)

configure.ac

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@ AC_INIT([nut],
3030
dnl See docs/maintainer-guide.txt about releases - updating the version
3131
dnl above is a small part of the consistent ritual!
3232

33+
dnl PACKAGE_URL="https://www.networkupstools.org/" for development iterations
34+
dnl or "https://www.networkupstools.org/historic/v1.2.3/index.html" for release
35+
dnl snapshots further set in stone. Either way, there should be a slash and
36+
dnl either a filename, or nothing. Adding a bogus filename and chopping it
37+
dnl off by `dirname` should do the trick.
38+
dnl NOTE: the resulting NUT_WEBSITE_BASE string does not end with a slash!
39+
NUT_WEBSITE_BASE="`dirname "${PACKAGE_URL}index.html"`"
40+
dnl Fallback, no trailing slash!
41+
[ -n "${NUT_WEBSITE_BASE-}" ] || NUT_WEBSITE_BASE='https://www.networkupstools.org'
42+
3343
dnl Note: this refers to GITREV at the time of configure script running
3444
dnl primarily for better messaging in the script itself (also to render
3545
dnl the PDF documentation revision history via docs/docinfo.xml.in).
@@ -747,6 +757,8 @@ AS_IF([test x"${NUT_SOURCE_GITREV}" = x],
747757
[NUT_REPORT([configured version], [${PACKAGE_VERSION} ${NUT_SOURCE_GITREV_DEVREL}])],
748758
[NUT_REPORT([configured version], [${PACKAGE_VERSION} (${NUT_SOURCE_GITREV}) ${NUT_SOURCE_GITREV_DEVREL}])])
749759
])
760+
NUT_REPORT([Documentation website base URL], [${NUT_WEBSITE_BASE}])
761+
AC_DEFINE_UNQUOTED([NUT_WEBSITE_BASE], "${NUT_WEBSITE_BASE}", [Documentation website base URL, no trailing slash])
750762

751763
dnl Note: the compiler/pragma/attr methods below are custom for NUT codebase:
752764
NUT_COMPILER_FAMILY
@@ -4832,6 +4844,7 @@ AC_SUBST(NUT_SOURCE_GITREV)
48324844
AC_SUBST(NUT_SOURCE_GITREV_IS_RELEASE)
48334845
AC_SUBST(NUT_SOURCE_GITREV_SEMVER)
48344846
AC_SUBST(NUT_SOURCE_GITREV_NUMERIC)
4847+
AC_SUBST(NUT_WEBSITE_BASE)
48354848
AC_SUBST(LIBSSL_CFLAGS)
48364849
AC_SUBST(LIBSSL_LIBS)
48374850
AC_SUBST(LIBSSL_LDFLAGS_RPATH)

drivers/blazer_ser.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ ssize_t blazer_command(const char *cmd, char *buf, size_t buflen)
106106

107107
void upsdrv_help(void)
108108
{
109-
printf("Read The Fine Manual ('man 8 blazer_ser')\n");
110109
}
111110

112111

0 commit comments

Comments
 (0)