Skip to content

Commit 65173e5

Browse files
committed
Fix headers + strings for code copied from aprsc
Issue identified by Owen Duffy
1 parent f38cd06 commit 65173e5

File tree

6 files changed

+57
-16
lines changed

6 files changed

+57
-16
lines changed

dupecheck.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212

1313
/*
1414
* Some parts of this code are copied from:
15-
*/
16-
/*
15+
*
1716
* aprsc
1817
*
1918
* (c) Heikki Hannikainen, OH7LZB <[email protected]>

filter.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
* *
88
********************************************************************/
99
/*
10+
* Some parts of this code are copied from:
11+
*
1012
* aprsc
1113
*
1214
* (c) Matti Aarnio, OH2MQK, <[email protected]>

hlog.c

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1+
/********************************************************************
2+
* APRX -- 2nd generation APRS-i-gate with *
3+
* minimal requirement of esoteric facilities or *
4+
* libraries of any kind beyond UNIX system libc. *
5+
* *
6+
* (c) Matti Aarnio - OH2MQK, 2007-2014 *
7+
* *
8+
********************************************************************/
19
/*
10+
* Some parts of this code are copied from:
11+
*
212
* aprsc
313
*
414
* (c) Heikki Hannikainen, OH7LZB <[email protected]>
@@ -38,13 +48,13 @@ int log_level = LOG_INFO; /* Logging level */
3848
int log_facility = LOG_DAEMON; /* Logging facility */
3949
char *log_name = NULL; /* Logging name */
4050

41-
char log_basename[] = "aprsc.log";
51+
char log_basename[] = "aprx.log";
4252
char *log_dir = NULL; /* Access log directory */
4353
char *log_fname = NULL; /* Access log file name */
4454
int log_file = -1; /* If logging to a file, the file name */
4555
rwlock_t log_file_lock = RWL_INITIALIZER;
4656

47-
char accesslog_basename[] = "aprsc.access.log";
57+
char accesslog_basename[] = "aprx.access.log";
4858
char *accesslog_dir = NULL; /* Access log directory */
4959
char *accesslog_fname = NULL; /* Access log file name */
5060
int accesslog_file = -1; /* Access log fd */
@@ -165,7 +175,7 @@ int open_log(char *name, int reopen)
165175
hfree(log_name);
166176

167177
if (!(log_name = hstrdup(name))) {
168-
fprintf(stderr, "aprsc logger: out of memory!\n");
178+
fprintf(stderr, "aprx logger: out of memory!\n");
169179
exit(1);
170180
}
171181

@@ -181,7 +191,7 @@ int open_log(char *name, int reopen)
181191

182192
log_file = open(log_fname, O_WRONLY|O_CREAT|O_APPEND, S_IRUSR|S_IWUSR|S_IRGRP);
183193
if (log_file < 0) {
184-
fprintf(stderr, "aprsc logger: Could not open %s: %s\n", log_fname, strerror(errno));
194+
fprintf(stderr, "aprx logger: Could not open %s: %s\n", log_fname, strerror(errno));
185195
exit(1);
186196
}
187197
}
@@ -218,7 +228,7 @@ int close_log(int reopen)
218228
} else if (log_dest == L_FILE) {
219229
if (log_file >= 0) {
220230
if (close(log_file))
221-
fprintf(stderr, "aprsc logger: Could not close log file %s: %s\n", log_fname, strerror(errno));
231+
fprintf(stderr, "aprx logger: Could not close log file %s: %s\n", log_fname, strerror(errno));
222232
log_file = -1;
223233
}
224234
if (log_fname) {
@@ -265,17 +275,17 @@ int rotate_log(void)
265275
tmp = hmalloc(strlen(log_fname) + 6);
266276
sprintf(tmp, "%s.tmp", log_fname);
267277
if (rename(log_fname, tmp) != 0) {
268-
fprintf(stderr, "aprsc logger: Failed to rename %s to %s: %s\n", log_fname, tmp, strerror(errno));
278+
fprintf(stderr, "aprx logger: Failed to rename %s to %s: %s\n", log_fname, tmp, strerror(errno));
269279
// continue anyway, try to reopen
270280
}
271281

272282
// reopen
273283
if (close(log_file))
274-
fprintf(stderr, "aprsc logger: Could not close log file %s: %s\n", log_fname, strerror(errno));
284+
fprintf(stderr, "aprx logger: Could not close log file %s: %s\n", log_fname, strerror(errno));
275285

276286
log_file = open(log_fname, O_WRONLY|O_CREAT|O_APPEND, S_IRUSR|S_IWUSR|S_IRGRP);
277287
if (log_file < 0) {
278-
fprintf(stderr, "aprsc logger: Could not open %s: %s\n", log_fname, strerror(errno));
288+
fprintf(stderr, "aprx logger: Could not open %s: %s\n", log_fname, strerror(errno));
279289
log_file = -1;
280290
}
281291

@@ -294,7 +304,7 @@ int rotate_log(void)
294304
}
295305

296306
if (rename(tmp, r1) != 0) {
297-
fprintf(stderr, "aprsc logger: Failed to rename %s to %s: %s\n", tmp, r1, strerror(errno));
307+
fprintf(stderr, "aprx logger: Failed to rename %s to %s: %s\n", tmp, r1, strerror(errno));
298308
}
299309

300310
hfree(tmp);
@@ -319,19 +329,19 @@ static int hlog_write(int priority, const char *s)
319329
rwl_rdlock(&log_file_lock);
320330
fprintf(stderr, "%4d/%02d/%02d %02d:%02d:%02d.%06d %s[%d:%lx] %s: %s\n",
321331
lt.tm_year + 1900, lt.tm_mon + 1, lt.tm_mday, lt.tm_hour, lt.tm_min, lt.tm_sec, (int)tv.tv_usec,
322-
(log_name) ? log_name : "aprsc", (int)getpid(), (unsigned long int)pthread_self(), log_levelnames[priority], s);
332+
(log_name) ? log_name : "aprx", (int)getpid(), (unsigned long int)pthread_self(), log_levelnames[priority], s);
323333
rwl_rdunlock(&log_file_lock);
324334

325335
}
326336

327337
if ((log_dest & L_FILE) && (log_file >= 0)) {
328338
len = snprintf(wb, LOG_LEN, "%4d/%02d/%02d %02d:%02d:%02d.%06d %s[%d:%lx] %s: %s\n",
329339
lt.tm_year + 1900, lt.tm_mon + 1, lt.tm_mday, lt.tm_hour, lt.tm_min, lt.tm_sec, (int)tv.tv_usec,
330-
(log_name) ? log_name : "aprsc", (int)getpid(), (unsigned long int)pthread_self(), log_levelnames[priority], s);
340+
(log_name) ? log_name : "aprx", (int)getpid(), (unsigned long int)pthread_self(), log_levelnames[priority], s);
331341
wb[LOG_LEN-1] = 0;
332342
rwl_rdlock(&log_file_lock);
333343
if ((w = write(log_file, wb, len)) != len)
334-
fprintf(stderr, "aprsc logger: Could not write to %s (fd %d): %s\n", log_fname, log_file, strerror(errno));
344+
fprintf(stderr, "aprx logger: Could not write to %s (fd %d): %s\n", log_fname, log_file, strerror(errno));
335345
rwl_rdunlock(&log_file_lock);
336346

337347
if (log_rotate_size) {

hlog.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1+
/********************************************************************
2+
* APRX -- 2nd generation APRS-i-gate with *
3+
* minimal requirement of esoteric facilities or *
4+
* libraries of any kind beyond UNIX system libc. *
5+
* *
6+
* (c) Matti Aarnio - OH2MQK, 2007-2014 *
7+
* *
8+
********************************************************************/
19
/*
10+
* Some parts of this code are copied from:
11+
*
212
* aprsc
313
*
414
* (c) Heikki Hannikainen, OH7LZB <[email protected]>

parse_aprs.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1+
/********************************************************************
2+
* APRX -- 2nd generation APRS-i-gate with *
3+
* minimal requirement of esoteric facilities or *
4+
* libraries of any kind beyond UNIX system libc. *
5+
* *
6+
* (c) Matti Aarnio - OH2MQK, 2007-2014 *
7+
* *
8+
********************************************************************/
19
/*
10+
* Some parts of this code are copied from:
11+
*
212
* aprsc
313
*
414
* (c) Heikki Hannikainen, OH7LZB <[email protected]>
@@ -9,7 +19,7 @@
919
*/
1020

1121
/*
12-
* A simple APRS parser for aprsc. Translated from Ham::APRS::FAP
22+
* A simple APRS parser from aprsc. Translated from Ham::APRS::FAP
1323
* perl module (by OH2KKU).
1424
*
1525
* Only needs to get lat/lng out of the packet, other features would
@@ -1101,7 +1111,7 @@ int parse_aprs(struct pbuf_t*const pb, historydb_t*const historydb)
11011111
*/
11021112

11031113
// ignore the CRLF in the end of the body
1104-
body_end = pb->data + pb->packet_len; // NOTE! Difference from original aprsc code
1114+
body_end = pb->data + pb->packet_len;
11051115

11061116
do {
11071117
// body is right after the packet type character

pbuf.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1+
/********************************************************************
2+
* APRX -- 2nd generation APRS-i-gate with *
3+
* minimal requirement of esoteric facilities or *
4+
* libraries of any kind beyond UNIX system libc. *
5+
* *
6+
* (c) Matti Aarnio - OH2MQK, 2007-2014 *
7+
* *
8+
********************************************************************/
19
/*
10+
* Some parts of this code are copied from:
11+
*
212
* aprsc
313
*
414
* (c) Heikki Hannikainen, OH7LZB <[email protected]>

0 commit comments

Comments
 (0)