From f75f5d6770d2cd8c189c90294ac565bc02973cab Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Thu, 31 Oct 2002 20:04:45 +0000 Subject: [PATCH] mbout stat now also counts directory outbound files --- ChangeLog | 4 ++++ mbcico/outstat.c | 26 ++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/ChangeLog b/ChangeLog index e1e0eb77..7591f8c1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,10 @@ v0.35.05 19-Oct-2002 mbcico: Fixed crash with incoming YooHoo session with bad password. + mbout: + The stat command now also shows what is on hold for a node + with an directory outbound (ftp node). Status is always hold. + mbmsg: The summary counters in the logfile are increased to 6 digits. diff --git a/mbcico/outstat.c b/mbcico/outstat.c index 499a3c40..901ec22c 100644 --- a/mbcico/outstat.c +++ b/mbcico/outstat.c @@ -88,6 +88,7 @@ int outstat() /* * Check private outbound box for nodes in the setup. + * Also, check directory outbounds for FTP nodes. */ temp = calloc(PATH_MAX, sizeof(char)); sprintf(temp, "%s/etc/nodes.data", getenv("MBSE_ROOT")); @@ -160,6 +161,31 @@ int outstat() } tidy_faddr(fa); } + if ((nodes.Session_out == S_DIR) && strlen(nodes.Dir_out_path)) { + fa = fido2faddr(nodes.Aka[0]); + flavor = 'h'; /* Directory outbound files are always on hold */ + Syslog('o', "checking directory path %s (%s)", nodes.Dir_out_path, ascfnode(fa, 0x2f)); + if ((dp = opendir(nodes.Dir_out_path)) == NULL) { + Syslog('o', "\"%s\" cannot be opened, proceed", MBSE_SS(nodes.Dir_out_path)); + } else { + while ((de = readdir(dp))) { + if (strcmp(de->d_name, ".") && strcmp(de->d_name, "..")) { + sprintf(temp, "%s/%s", nodes.Dir_out_path, de->d_name); + if (stat(temp, &sb) == 0) { + if (S_ISREG(sb.st_mode)) { + each(fa, flavor, 0, temp); + } else { + Syslog('o', "not a regular file"); + } + } else { + WriteError("Can't stat %s", temp); + } + } + } + closedir(dp); + } + tidy_faddr(fa); + } fseek(fp, nodeshdr.filegrp + nodeshdr.mailgrp, SEEK_CUR); } fclose(fp);