--- lmtp2nntp.c 2001/10/12 12:26:26 1.88
+++ lmtp2nntp.c 2001/10/12 13:23:52 1.89
@@ -157,6 +157,7 @@
int option_daemon;
int option_aclc;
struct acl option_acl[MAXACLS];
+ int option_veryverbose;
int option_childsmax;
int active_childs;
l2_stream_t *l2;
@@ -211,6 +212,7 @@
"[-D] "
"[-K] "
"[-P pidfile] "
+ "[-V] "
"[-a addr/mask[,addr/mask[,...]] "
"[-b addr[:port]|-|path[:perms]] "
"[-c addr[:port]] "
@@ -356,7 +358,7 @@
log2(ctx, NOTICE, "caught signal %d - child [%ld] terminated", sig, (long)pid);
return;
case SIGUSR1:
- log1(ctx, NOTICE, "caught signal %d - flush logging buffer", sig);
+ log1(ctx, NOTICE, "caught signal %d - flush logging stream", sig);
l2_stream_flush(ctx->l2);
return;
case SIGHUP:
@@ -439,6 +441,7 @@
ctx->option_killflag = FALSE;
ctx->option_uid = getuid();
ctx->option_daemon = FALSE;
+ ctx->option_veryverbose = FALSE;
ctx->option_childsmax = 10;
ctx->active_childs = 0;
ctx->l2 = NULL;
@@ -482,7 +485,7 @@
*/
/* read in the arguments */
- while ((i = getopt(argc, argv, "C:DKP:a:b:c:d:g:l:m:n:o:s:t:u:v")) != -1) {
+ while ((i = getopt(argc, argv, "C:DKP:Va:b:c:d:g:l:m:n:o:s:t:u:v")) != -1) {
switch (i) {
case 'C': /*POD [B<-C> I<childsmax>] */
ctx->option_childsmax = atoi(optarg);
@@ -500,6 +503,9 @@
case 'P': /*POD [B<-P> I<pidfile>] */
ctx->option_pidfile = strdup(optarg);
break;
+ case 'V': /*POD [B<-V>] */
+ ctx->option_veryverbose = TRUE;
+ break;
case 'a': /*POD [B<-a> I<addr>/I<mask>[,I<addr>/I<mask>[,...]] */
if (argz_create_sep(optarg, ',', &azACL, &asACL) != 0)
CU(ERR_EXECUTION);
@@ -945,14 +951,18 @@
CU(ERR_EXECUTION);
}
- if ((chBuf = l2_channel_create(&l2_handler_buffer)) == NULL) {
- fprintf(stderr, "%s:Error: logging failed to create buffer channel\n", ctx->progname);
- CU(ERR_EXECUTION);
- }
- if (l2_channel_configure(chBuf, "size", 65536) != L2_OK) {
- fprintf(stderr, "%s:Error: logging failed to configure buffer channel\n", ctx->progname);
- CU(ERR_EXECUTION);
+ if (!ctx->option_veryverbose) {
+ if ((chBuf = l2_channel_create(&l2_handler_buffer)) == NULL) {
+ fprintf(stderr, "%s:Error: logging failed to create buffer channel\n", ctx->progname);
+ CU(ERR_EXECUTION);
+ }
+ if (l2_channel_configure(chBuf, "size", 65536) != L2_OK) {
+ fprintf(stderr, "%s:Error: logging failed to configure buffer channel\n", ctx->progname);
+ CU(ERR_EXECUTION);
+ }
}
+ else
+ chBuf = NULL;
if ((chFile = l2_channel_create(&l2_handler_file)) == NULL) {
fprintf(stderr, "%s:Error: logging failed to create file channel\n", ctx->progname);
@@ -963,13 +973,21 @@
CU(ERR_EXECUTION);
}
- if (l2_channel_stack(chFile, chBuf) != L2_OK) {
- fprintf(stderr, "%s:Error: logging failed to stack buffer channel on top of file channel\n", ctx->progname);
- CU(ERR_EXECUTION);
+ if (!ctx->option_veryverbose) {
+ if (l2_channel_stack(chFile, chBuf) != L2_OK) {
+ fprintf(stderr, "%s:Error: logging failed to stack buffer channel on top of file channel\n", ctx->progname);
+ CU(ERR_EXECUTION);
+ }
+ if (l2_channel_stack(chBuf, chPrefix) != L2_OK) {
+ fprintf(stderr, "%s:Error: logging failed to stack prefix channel on top of buffer channel\n", ctx->progname);
+ CU(ERR_EXECUTION);
+ }
}
- if (l2_channel_stack(chBuf, chPrefix) != L2_OK) {
- fprintf(stderr, "%s:Error: logging failed to stack prefix channel on top of buffer channel\n", ctx->progname);
- CU(ERR_EXECUTION);
+ else {
+ if (l2_channel_stack(chFile, chPrefix) != L2_OK) {
+ fprintf(stderr, "%s:Error: logging failed to stack prefix channel on top of buffer channel\n", ctx->progname);
+ CU(ERR_EXECUTION);
+ }
}
if (l2_channel_open(chPrefix) != L2_OK) {
@@ -991,6 +1009,9 @@
* should not be used in the remainder of the code
*/
+ if (ctx->option_veryverbose)
+ log0(ctx, NOTICE, "logging very verbose (unbuffered)");
+
if ((ctx->option_pidfile != NULL) && ctx->option_killflag) {
if ((fd = fopen(ctx->option_pidfile, "r")) == NULL)
log1(ctx, ERROR, "cannot open pidfile \"%s\" for reading %m", ctx->option_pidfile);
@@ -1167,7 +1188,7 @@
log1(ctx, NOTICE, "startup new child process, parent pid[%d]", getppid());
/* child must close listening socket */
- sa_destroy(ctx->saAltio);
+ sa_destroy(ctx->saAltio);
/* initialize LMTP context */
lmtp_io.ctx = ctx;
|