head 1.4; access; symbols pkgsrc-2026Q1:1.4.0.118 pkgsrc-2026Q1-base:1.4 pkgsrc-2025Q4:1.4.0.116 pkgsrc-2025Q4-base:1.4 pkgsrc-2025Q3:1.4.0.114 pkgsrc-2025Q3-base:1.4 pkgsrc-2025Q2:1.4.0.112 pkgsrc-2025Q2-base:1.4 pkgsrc-2025Q1:1.4.0.110 pkgsrc-2025Q1-base:1.4 pkgsrc-2024Q4:1.4.0.108 pkgsrc-2024Q4-base:1.4 pkgsrc-2024Q3:1.4.0.106 pkgsrc-2024Q3-base:1.4 pkgsrc-2024Q2:1.4.0.104 pkgsrc-2024Q2-base:1.4 pkgsrc-2024Q1:1.4.0.102 pkgsrc-2024Q1-base:1.4 pkgsrc-2023Q4:1.4.0.100 pkgsrc-2023Q4-base:1.4 pkgsrc-2023Q3:1.4.0.98 pkgsrc-2023Q3-base:1.4 pkgsrc-2023Q2:1.4.0.96 pkgsrc-2023Q2-base:1.4 pkgsrc-2023Q1:1.4.0.94 pkgsrc-2023Q1-base:1.4 pkgsrc-2022Q4:1.4.0.92 pkgsrc-2022Q4-base:1.4 pkgsrc-2022Q3:1.4.0.90 pkgsrc-2022Q3-base:1.4 pkgsrc-2022Q2:1.4.0.88 pkgsrc-2022Q2-base:1.4 pkgsrc-2022Q1:1.4.0.86 pkgsrc-2022Q1-base:1.4 pkgsrc-2021Q4:1.4.0.84 pkgsrc-2021Q4-base:1.4 pkgsrc-2021Q3:1.4.0.82 pkgsrc-2021Q3-base:1.4 pkgsrc-2021Q2:1.4.0.80 pkgsrc-2021Q2-base:1.4 pkgsrc-2021Q1:1.4.0.78 pkgsrc-2021Q1-base:1.4 pkgsrc-2020Q4:1.4.0.76 pkgsrc-2020Q4-base:1.4 pkgsrc-2020Q3:1.4.0.74 pkgsrc-2020Q3-base:1.4 pkgsrc-2020Q2:1.4.0.70 pkgsrc-2020Q2-base:1.4 pkgsrc-2020Q1:1.4.0.50 pkgsrc-2020Q1-base:1.4 pkgsrc-2019Q4:1.4.0.72 pkgsrc-2019Q4-base:1.4 pkgsrc-2019Q3:1.4.0.68 pkgsrc-2019Q3-base:1.4 pkgsrc-2019Q2:1.4.0.66 pkgsrc-2019Q2-base:1.4 pkgsrc-2019Q1:1.4.0.64 pkgsrc-2019Q1-base:1.4 pkgsrc-2018Q4:1.4.0.62 pkgsrc-2018Q4-base:1.4 pkgsrc-2018Q3:1.4.0.60 pkgsrc-2018Q3-base:1.4 pkgsrc-2018Q2:1.4.0.58 pkgsrc-2018Q2-base:1.4 pkgsrc-2018Q1:1.4.0.56 pkgsrc-2018Q1-base:1.4 pkgsrc-2017Q4:1.4.0.54 pkgsrc-2017Q4-base:1.4 pkgsrc-2017Q3:1.4.0.52 pkgsrc-2017Q3-base:1.4 pkgsrc-2017Q2:1.4.0.48 pkgsrc-2017Q2-base:1.4 pkgsrc-2017Q1:1.4.0.46 pkgsrc-2017Q1-base:1.4 pkgsrc-2016Q4:1.4.0.44 pkgsrc-2016Q4-base:1.4 pkgsrc-2016Q3:1.4.0.42 pkgsrc-2016Q3-base:1.4 pkgsrc-2016Q2:1.4.0.40 pkgsrc-2016Q2-base:1.4 pkgsrc-2016Q1:1.4.0.38 pkgsrc-2016Q1-base:1.4 pkgsrc-2015Q4:1.4.0.36 pkgsrc-2015Q4-base:1.4 pkgsrc-2015Q3:1.4.0.34 pkgsrc-2015Q3-base:1.4 pkgsrc-2015Q2:1.4.0.32 pkgsrc-2015Q2-base:1.4 pkgsrc-2015Q1:1.4.0.30 pkgsrc-2015Q1-base:1.4 pkgsrc-2014Q4:1.4.0.28 pkgsrc-2014Q4-base:1.4 pkgsrc-2014Q3:1.4.0.26 pkgsrc-2014Q3-base:1.4 pkgsrc-2014Q2:1.4.0.24 pkgsrc-2014Q2-base:1.4 pkgsrc-2014Q1:1.4.0.22 pkgsrc-2014Q1-base:1.4 pkgsrc-2013Q4:1.4.0.20 pkgsrc-2013Q4-base:1.4 pkgsrc-2013Q3:1.4.0.18 pkgsrc-2013Q3-base:1.4 pkgsrc-2013Q2:1.4.0.16 pkgsrc-2013Q2-base:1.4 pkgsrc-2013Q1:1.4.0.14 pkgsrc-2013Q1-base:1.4 pkgsrc-2012Q4:1.4.0.12 pkgsrc-2012Q4-base:1.4 pkgsrc-2012Q3:1.4.0.10 pkgsrc-2012Q3-base:1.4 pkgsrc-2012Q2:1.4.0.8 pkgsrc-2012Q2-base:1.4 pkgsrc-2012Q1:1.4.0.6 pkgsrc-2012Q1-base:1.4 pkgsrc-2011Q4:1.4.0.4 pkgsrc-2011Q4-base:1.4 pkgsrc-2011Q3:1.4.0.2 pkgsrc-2011Q3-base:1.4 pkgsrc-2011Q2:1.3.0.54 pkgsrc-2011Q2-base:1.3 pkgsrc-2011Q1:1.3.0.52 pkgsrc-2011Q1-base:1.3 pkgsrc-2010Q4:1.3.0.50 pkgsrc-2010Q4-base:1.3 pkgsrc-2010Q3:1.3.0.48 pkgsrc-2010Q3-base:1.3 pkgsrc-2010Q2:1.3.0.46 pkgsrc-2010Q2-base:1.3 pkgsrc-2010Q1:1.3.0.44 pkgsrc-2010Q1-base:1.3 pkgsrc-2009Q4:1.3.0.42 pkgsrc-2009Q4-base:1.3 pkgsrc-2009Q3:1.3.0.40 pkgsrc-2009Q3-base:1.3 pkgsrc-2009Q2:1.3.0.38 pkgsrc-2009Q2-base:1.3 pkgsrc-2009Q1:1.3.0.36 pkgsrc-2009Q1-base:1.3 pkgsrc-2008Q4:1.3.0.34 pkgsrc-2008Q4-base:1.3 pkgsrc-2008Q3:1.3.0.32 pkgsrc-2008Q3-base:1.3 cube-native-xorg:1.3.0.30 cube-native-xorg-base:1.3 pkgsrc-2008Q2:1.3.0.28 pkgsrc-2008Q2-base:1.3 cwrapper:1.3.0.26 pkgsrc-2008Q1:1.3.0.24 pkgsrc-2008Q1-base:1.3 pkgsrc-2007Q4:1.3.0.22 pkgsrc-2007Q4-base:1.3 pkgsrc-2007Q3:1.3.0.20 pkgsrc-2007Q3-base:1.3 pkgsrc-2007Q2:1.3.0.18 pkgsrc-2007Q2-base:1.3 pkgsrc-2007Q1:1.3.0.16 pkgsrc-2007Q1-base:1.3 pkgsrc-2006Q4:1.3.0.14 pkgsrc-2006Q4-base:1.3 pkgsrc-2006Q3:1.3.0.12 pkgsrc-2006Q3-base:1.3 pkgsrc-2006Q2:1.3.0.10 pkgsrc-2006Q2-base:1.3 pkgsrc-2006Q1:1.3.0.8 pkgsrc-2006Q1-base:1.3 pkgsrc-2005Q4:1.3.0.6 pkgsrc-2005Q4-base:1.3 pkgsrc-2005Q3:1.3.0.4 pkgsrc-2005Q3-base:1.3 pkgsrc-2005Q2:1.3.0.2 pkgsrc-2005Q2-base:1.3 pkgsrc-2005Q1:1.2.0.20 pkgsrc-2005Q1-base:1.2 pkgsrc-2004Q4:1.2.0.18 pkgsrc-2004Q4-base:1.2 pkgsrc-2004Q3:1.2.0.16 pkgsrc-2004Q3-base:1.2 pkgsrc-2004Q2:1.2.0.14 pkgsrc-2004Q2-base:1.2 pkgsrc-2004Q1:1.2.0.12 pkgsrc-2004Q1-base:1.2 pkgsrc-2003Q4:1.2.0.10 pkgsrc-2003Q4-base:1.2 netbsd-1-6-1:1.2.0.6 netbsd-1-6-1-base:1.2 netbsd-1-6:1.2.0.8 netbsd-1-6-RELEASE-base:1.2 pkgviews:1.2.0.4 pkgviews-base:1.2 buildlink2:1.2.0.2 buildlink2-base:1.2 netbsd-1-5-PATCH003:1.2 netbsd-1-5-PATCH001:1.2 netbsd-1-5-RELEASE:1.2 netbsd-1-4-PATCH003:1.2 netbsd-1-4-PATCH002:1.2 comdex-fall-1999:1.2 netbsd-1-4-PATCH001:1.2 netbsd-1-4-RELEASE:1.2 netbsd-1-3-PATCH003:1.2; locks; strict; comment @# @; 1.4 date 2011.08.28.22.30.17; author dholland; state Exp; branches; next 1.3; 1.3 date 2005.05.23.08.42.39; author rillig; state Exp; branches; next 1.2; 1.2 date 98.08.07.10.35.55; author agc; state Exp; branches; next 1.1; 1.1 date 98.06.30.22.01.21; author tron; state Exp; branches; next ; desc @@ 1.4 log @Fix void main. While here: - add various LP64 fixes; - use stdlib.h as needed instead of casting the return value of malloc; - fix fake-varargs printf code and use stdarg.h; - use system snprintf instead of included custom one; - tidy up symbol name conflict with log(); - add patch comments; - remove some pkglint; - add LICENSE. PKGREVISION -> 2. @ text @$NetBSD: patch-ab,v 1.3 2005/05/23 08:42:39 rillig Exp $ - needs stdlib.h instead of casting return value of malloc - other LP64 fixes - add const to silence qsort type warnings - fix printf follies, use stdarg.h - don't use included custom snprintf - avoid symbol name conflict with standard log(), which is a gcc builtin - void main --- cddbd.c.orig 1996-12-22 03:49:54.000000000 +0000 +++ cddbd.c @@@@ -43,6 +43,8 @@@@ static char *_cddbd_c_ident_ = "@@(#)$Id: #include #include #include +#include +#include #include "patchlevel.h" #include "access.h" #include "list.h" @@@@ -87,7 +89,7 @@@@ int cddbd_locked(clck_t *); int cddbd_nus(int); int cddbd_parse_access(arg_t *, int); int cddbd_strcasecmp(char *, char *); -int comp_client(void *, void *); +int comp_client(const void *, const void *); int comp_user(void *, void *); int cvt_date(char *, char *); int get_conv(char **, char *); @@@@ -189,18 +191,18 @@@@ lhead_t *lock_head; /* Lock list head. /* Access file fields. */ access_t acctab[] = { - "logfile", logfile, AC_PATH, 0, (int)TMPDIR"/log", - "motdfile", motdfile, AC_PATH, 0, (int)"", - "sitefile", sitefile, AC_PATH, 0, (int)"", - "histfile", histfile, AC_PATH, 0, (int)"", - "lockdir", lockdir, AC_PATH, 0, (int)"", - "hashdir", hashdir, AC_PATH, 0, (int)"", - "cddbdir", cddbdir, AC_PATH, 0, (int)"", - "dupdir", dupdir, AC_PATH, 0, (int)"", - "postdir", postdir, AC_PATH, 0, (int)"", - "smtphost", smtphost, AC_STRING, 0, (int)"localhost", + "logfile", logfile, AC_PATH, 0, (long)TMPDIR"/log", + "motdfile", motdfile, AC_PATH, 0, (long)"", + "sitefile", sitefile, AC_PATH, 0, (long)"", + "histfile", histfile, AC_PATH, 0, (long)"", + "lockdir", lockdir, AC_PATH, 0, (long)"", + "hashdir", hashdir, AC_PATH, 0, (long)"", + "cddbdir", cddbdir, AC_PATH, 0, (long)"", + "dupdir", dupdir, AC_PATH, 0, (long)"", + "postdir", postdir, AC_PATH, 0, (long)"", + "smtphost", smtphost, AC_STRING, 0, (long)"localhost", "admin_email", admin_email, AC_STRING, AF_NODEF, 0, - "bounce_email", bounce_email, AC_STRING, 0, (int)"", + "bounce_email", bounce_email, AC_STRING, 0, (long)"", "xmit_time", &xmit_time, AC_NUMERIC, AF_ZERO, DEF_XMIT_TO, "transmits", &max_xmits, AC_NUMERIC, AF_ZERO, DEF_MAX_XMITS, "post_lines", &max_lines, AC_NUMERIC, AF_ZERO, DEF_MAX_LINES, @@@@ -230,7 +232,7 @@@@ proto_t proto_flags[MAX_PROTO_LEVEL + 1] /* Log flags. */ -log_t log[] = { +static log_t logs[] = { { LOG_NONE, 0, 0, "none", 0, }, { LOG_INPUT, 0, 0, "input", 0, }, { LOG_INFO, 0, 0, "info", 0, }, @@@@ -339,7 +341,7 @@@@ char *day[] = { "Sun", "Mon", "Tue", "We /* ARGSUSED */ -void +int main(int argc, char **argv) { int i; @@@@ -1126,7 +1128,7 @@@@ cddbd_check_access(void) log_flags = 0; for(i = 1; i < args.nargs; i++) { - for(lp = log; lp->name; lp++) { + for(lp = logs; lp->name; lp++) { if(!cddbd_strcasecmp(args.arg[i], lp->name)) { if(lp->flag) @@@@ -1460,7 +1462,7 @@@@ cddbd_db_init(void) if(dp->d_name[0] == '.') continue; - p = (char *)malloc(strlen(dp->d_name) + 1); + p = malloc(strlen(dp->d_name) + 1); if(p == NULL) { cddbd_log(LOG_ERR, "Malloc failed."); quit(QUIT_ERR); @@@@ -2407,8 +2409,8 @@@@ do_log(arg_t *args) last[0] = '\0'; } - for(i = 0; log[i].name; i++) - log[i].cnt = 0; + for(i = 0; logs[i].name; i++) + logs[i].cnt = 0; lines = 0; nclient = 0; @@@@ -2452,9 +2454,9 @@@@ do_log(arg_t *args) lines++; /* Log the message if it's acceptable. */ - for(i = 0; log[i].name; i++) { - if((log[i].flag & flag) && incl) - log[i].cnt++; + for(i = 0; logs[i].name; i++) { + if((logs[i].flag & flag) && incl) + logs[i].cnt++; } /* Count clients. */ @@@@ -2515,10 +2517,10 @@@@ do_log(arg_t *args) printf("Log status between: %s and %s\r\n", start, end); } - for(i = 0; log[i].name; i++) - if(log[i].banr != 0 && !((log[i].dflag & L_NOSHOW) && - log[i].cnt == 0)) - printf("%s: %d\r\n", log[i].banr, log[i].cnt); + for(i = 0; logs[i].name; i++) + if(logs[i].banr != 0 && !((logs[i].dflag & L_NOSHOW) && + logs[i].cnt == 0)) + printf("%s: %d\r\n", logs[i].banr, logs[i].cnt); if(nclient > 0) { for(i = 0; i < nclient; i++) @@@@ -2541,7 +2543,7 @@@@ do_log(arg_t *args) printf("Total messages: %d\r\n", lines); if(sbuf.st_size != 0) - printf("Log size: %d bytes\r\n", sbuf.st_size); + printf("Log size: %lld bytes\r\n", (long long)sbuf.st_size); printf(".\r\n"); } @@@@ -2562,15 +2564,15 @@@@ comp_user(void *u1, void *u2) int -comp_client(void *c1, void *c2) +comp_client(const void *c1, const void *c2) { int x; - x = client_cnt[*(int *)c2] - client_cnt[*(int *)c1]; + x = client_cnt[*(const int *)c2] - client_cnt[*(const int *)c1]; if(x != 0) return(x); - return(cddbd_strcasecmp(client[*(int *)c1], client[*(int *)c2])); + return(cddbd_strcasecmp(client[*(const int *)c1], client[*(const int *)c2])); } @@@@ -2895,7 +2897,7 @@@@ cddbd_lock_alloc(char *name) quit(QUIT_ERR); } - if((lk = (clck_t *)malloc(sizeof(clck_t))) == NULL) { + if((lk = malloc(sizeof(clck_t))) == NULL) { cddbd_log(LOG_ERR | LOG_LOCK, "Can't allocate %s lock memory.", name); quit(QUIT_ERR); @@@@ -3179,15 +3181,15 @@@@ trunc_log(void) } /* Get a buffer for the file. */ - if((buf = (char *)malloc(len)) == 0) { + if((buf = malloc(len)) == 0) { cddbd_log(LOG_ERR, "Can't malloc %d bytes for logfile (%d).", - (void *)len, errno); + len, errno); return; } if((fd = open(logfile, O_RDONLY)) < 0) { cddbd_log(LOG_ERR, "Can't open logfile %s for reading (%d).", - logfile, (void *)errno); + logfile, errno); free(buf); return; } @@@@ -3195,7 +3197,7 @@@@ trunc_log(void) /* Read in the whole log file. */ if(read(fd, buf, len) != len) { cddbd_log(LOG_ERR, "Can't read logfile: %s (%d).", logfile, - (void *)errno); + errno); close(fd); free(buf); return; @@@@ -3219,7 +3221,7 @@@@ trunc_log(void) if((fd = open(logfile, O_TRUNC | O_WRONLY)) < 0) { cddbd_log(LOG_ERR, "Can't open logfile %s for writing (%d).", - logfile, (void *)errno); + logfile, errno); free(buf); return; } @@@@ -3227,7 +3229,7 @@@@ trunc_log(void) /* Write out the truncated file. */ if(write(fd, p, len) != len) { cddbd_log(LOG_ERR, "Can't write logfile: %s (%d).", - logfile, (void *)errno); + logfile, errno); } close(fd); @@@@ -3236,7 +3238,7 @@@@ trunc_log(void) return; } - +#if 0 #define SCOPY(p, buf) if(cc < (CDDBBUFSIZ-1)) {(buf)[cc] = **(p),(*(p))++,cc++;} #define SASGN(c, buf) if(cc < (CDDBBUFSIZ-1)) {(buf)[cc] = c, cc++;} #define SPUT(c, buf) (buf)[cc] = c, cc++ @@@@ -3408,15 +3412,15 @@@@ cddbd_snprintf(char *buf, int size, char if(!logging) cddbd_log(LOG_ERR, "Buf overflow in snprintf: \"%s\"", buf); } - +#endif /* This should be the last function in the file, to avoid compile errors. */ void -cddbd_log(unsigned int flags, char *fmt, void *a1, void *a2, void *a3, - void *a4, void *a5, void *a6) +cddbd_log(unsigned int flags, const char *fmt, ...) { FILE *fp; char buf[CDDBBUFSIZ]; + va_list ap; if((!(log_flags & (short)flags) && !debug) || quiet) return; @@@@ -3455,7 +3459,9 @@@@ cddbd_log(unsigned int flags, char *fmt, strip_crlf(buf); /* Print the log message. */ - fprintf(fp, buf, a1, a2, a3, a4, a5, a6); + va_start(ap, fmt); + vfprintf(fp, buf, ap); + va_end(ap); fputc('\n', fp); if(fp != stderr && fp != stdout) { @ 1.3 log @Removed trailing empty lines. @ text @d1 1 a1 1 $NetBSD: patch-ab,v 1.2 1998/08/07 10:35:55 agc Exp $ d3 31 a33 3 --- cddbd.c.orig Sun Jun 14 06:42:12 1998 +++ cddbd.c Sun Jun 14 06:42:50 1998 @@@@ -191,14 +191,14 @@@@ d59 199 @ 1.2 log @Add NetBSD RCS Ids. @ text @d1 1 a1 1 $NetBSD$ a30 1 @ 1.1 log @Get package to work on alpha, fixes PR pkg/5587 by Tim Rightnour. @ text @d1 2 @