Fix build with -fno-common

This commit is contained in:
Stefan Eßer 2020-09-22 11:15:28 +00:00
parent e74372b1ef
commit 7f1256834f
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=549572
5 changed files with 64 additions and 17 deletions

View file

@ -3,7 +3,7 @@
PORTNAME= rtg
PORTVERSION= 0.7.4
PORTREVISION= 20
PORTREVISION= 21
CATEGORIES= net
MASTER_SITES= SF \
ftp://ftpmirror.uk/freebsd-ports/rtg/

View file

@ -1,16 +1,33 @@
--- src/rtg.h.orig 2003-09-25 15:56:04 UTC
+++ src/rtg.h
@@ -40,11 +40,9 @@
@@ -40,12 +40,10 @@
#define DEFAULT_DB_DB "rtg"
#define DEFAULT_DB_USER "snmp"
#define DEFAULT_DB_PASS "rtgdefault"
-#define DEFAULT_SNMP_VER 1
+#define DEFAULT_SNMP_VER 2
#define DEFAULT_SNMP_PORT 161
-
-/* PID File */
-#define PIDFILE "/tmp/rtgpoll.pid"
+#define DEFAULT_PIDFILE "/tmp/rtgpoll.pid"
-/* PID File */
-#define PIDFILE "/tmp/rtgpoll.pid"
-
#define STAT_DESCRIP_ERROR 99
#define HASHSIZE 5000
@@ -175,10 +173,10 @@ int add_hash_entry(target_t *);
int hash_target_file(char *);
/* Globals */
-config_t set;
-int lock;
-int waiting;
-char config_paths[CONFIG_PATHS][BUFSIZE];
-hash_t hash;
+extern config_t set;
+extern int lock;
+extern int waiting;
+extern char config_paths[CONFIG_PATHS][BUFSIZE];
+extern hash_t hash;
#endif /* not _RTG_H_ */

View file

@ -1,6 +1,16 @@
--- src/rtgplot.c.orig 2003-10-02 15:27:52 UTC
+++ src/rtgplot.c
@@ -221,7 +221,10 @@ int main(int argc, char **argv) {
@@ -54,6 +54,9 @@
#include "rtgplot.h"
#include "cgi.h"
+config_t set;
+char config_paths[CONFIG_PATHS][BUFSIZE];
+
/* dfp is a debug file pointer. Points to stderr unless debug=level is set */
FILE *dfp = NULL;
@@ -221,7 +224,10 @@ int main(int argc, char **argv) {
plot_line(data[i][j], &img, &graph, colors->shade, TRUE);
else
plot_line(data[i][j], &img, &graph, colors->shade, FALSE);
@ -12,7 +22,7 @@
plot_legend(&img, rate[i][j], &graph, colors->shade, intname, offset);
offset++;
}
@@ -629,15 +632,15 @@ void plot_legend(gdImagePtr * img, rate_
@@ -629,15 +635,15 @@ void plot_legend(gdImagePtr * img, rate_t rate, graph_
if (set.verbose >= HIGH)
fprintf(dfp, "Plotting legend (%s).\n", __FUNCTION__);
@ -34,7 +44,7 @@
}
snprintf(string, sizeof(string), "%s", interface);
for (i = 0; i < (17 - strlen(interface)); i++) {
@@ -662,7 +665,7 @@ void plot_legend(gdImagePtr * img, rate_
@@ -662,7 +668,7 @@ void plot_legend(gdImagePtr * img, rate_t rate, graph_
units(rate.cur, cur), graph->units,
units((float)rate.total, total));
}
@ -43,7 +53,7 @@
BORDER_T + graph->image.yplot_area + 33 + (10 * offset), string, std_colors[black]);
}
@@ -866,6 +869,13 @@ void plot_labels(gdImagePtr * img, graph
@@ -866,6 +872,13 @@ void plot_labels(gdImagePtr * img, graph_t * graph) {
title_offset = 1 - (0.01 * (strlen(VERSION) + strlen(COPYRIGHT) + 2));
snprintf(string, sizeof(string), "%s %s", COPYRIGHT, VERSION);
gdImageString(*img, gdFontSmall, BORDER_L + (graph->image.xplot_area * title_offset), BORDER_T - 15, string, std_colors[black]);
@ -57,7 +67,7 @@
}
@@ -1342,10 +1352,14 @@ void parseWeb(arguments_t *arguments, gr
@@ -1342,10 +1355,14 @@ void parseWeb(arguments_t *arguments, graph_t *graph)
}
}
/* XXX REB - Warning: Deprecated, tN argument will go away in RTG 0.8 XXX */

View file

@ -1,6 +1,12 @@
--- src/rtgpoll.c.orig 2003-09-25 15:56:04 UTC
+++ src/rtgpoll.c
@@ -13,6 +13,7 @@
@@ -9,10 +9,13 @@
#include "common.h"
#include "rtg.h"
+char config_paths[CONFIG_PATHS][BUFSIZE];
+
/* Yes. Globals. */
stats_t stats =
{PTHREAD_MUTEX_INITIALIZER, 0, 0, 0, 0, 0, 0, 0, 0, 0.0};
char *target_file = NULL;
@ -8,7 +14,7 @@
target_t *current = NULL;
MYSQL mysql;
int entries = 0;
@@ -41,7 +42,7 @@ int main(int argc, char *argv[]) {
@@ -41,7 +44,7 @@ int main(int argc, char *argv[]) {
config_defaults(&set);
/* Parse the command-line. */
@ -17,7 +23,7 @@
switch ((char) ch) {
case 'c':
conf_file = optarg;
@@ -55,6 +56,9 @@ int main(int argc, char *argv[]) {
@@ -55,6 +58,9 @@ int main(int argc, char *argv[]) {
case 'm':
set.multiple++;
break;
@ -27,7 +33,7 @@
case 't':
target_file = optarg;
break;
@@ -66,6 +70,9 @@ int main(int argc, char *argv[]) {
@@ -66,6 +72,9 @@ int main(int argc, char *argv[]) {
break;
}
@ -37,7 +43,7 @@
if (set.verbose >= LOW)
printf("RTG version %s starting.\n", VERSION);
@@ -78,7 +85,7 @@ int main(int argc, char *argv[]) {
@@ -78,7 +87,7 @@ int main(int argc, char *argv[]) {
sigaddset(&signal_set, SIGINT);
sigaddset(&signal_set, SIGQUIT);
if (!set.multiple)
@ -46,7 +52,7 @@
if (pthread_sigmask(SIG_BLOCK, &signal_set, NULL) != 0)
printf("pthread_sigmask error\n");
@@ -244,7 +251,7 @@ void *sig_handler(void *arg)
@@ -244,7 +253,7 @@ void *sig_handler(void *arg)
if (set.verbose >= LOW)
printf("Quiting: received signal %d.\n", sig_number);
rtg_dbdisconnect(&mysql);
@ -55,7 +61,7 @@
exit(1);
break;
}
@@ -259,6 +266,7 @@ void usage(char *prog)
@@ -259,6 +268,7 @@ void usage(char *prog)
printf("\nOptions:\n");
printf(" -c <file> Specify configuration file\n");
printf(" -d Disable database inserts\n");

View file

@ -0,0 +1,14 @@
--- src/rtgsnmp.c.orig 2003-09-25 18:23:35 UTC
+++ src/rtgsnmp.c
@@ -8,6 +8,11 @@
#include "common.h"
#include "rtg.h"
+config_t set;
+int lock;
+int waiting;
+hash_t hash;
+
#ifdef OLD_UCD_SNMP
#include "asn1.h"
#include "snmp_api.h"