diff --git a/utils/qwknet/qwknetftpc.py b/utils/qwknet/qwknetftpc.py index 0b69045..d5bedf5 100644 --- a/utils/qwknet/qwknetftpc.py +++ b/utils/qwknet/qwknetftpc.py @@ -17,14 +17,20 @@ def dostuff(config_file): repfile = config.get("Main", "Outbound") + "/" + config.get("Main", "Host") + ".REP" - exists = os.path.isfile(repfile) + i = 1 - if exists: - file = open(repfile, "rb") - ftp.storbinary("STOR " + config.get("Main", "Host") + ".REP", file) - file.close() - os.remove(repfile) - print("SENT: " + config.get("Main", "Host") + ".REP") + while True: + exists = os.path.isfile(repfile) + if exists: + file = open(repfile, "rb") + ftp.storbinary("STOR " + config.get("Main", "Host") + ".REP", file) + file.close() + os.remove(repfile) + print("SENT: " + config.get("Main", "Host") + ".REP") + repfile = config.get("Main", "Outbound") + "/" + config.get("Main", "Host") + ".REP." + i + i = i + 1 + else: + break qwkfile = config.get("Main", "Inbound") + "/" + config.get("Main", "Host") + ".QWK" with open(qwkfile, 'wb') as file: diff --git a/utils/qwknet/qwkscan.c b/utils/qwknet/qwkscan.c index 1c063c5..848aca3 100644 --- a/utils/qwknet/qwkscan.c +++ b/utils/qwknet/qwkscan.c @@ -384,6 +384,8 @@ int main(int argc, char **argv) { char buffer[PATH_MAX]; char archive[PATH_MAX]; int ret; + struct stat st; + if (argc < 2) { fprintf(stderr, "Usage:\n ./qwkscan config.ini\n"); return -1; @@ -412,6 +414,11 @@ int main(int argc, char **argv) { if (qwkidx > 0) { snprintf(archive, PATH_MAX, "%s/%s.REP", outbound_path, hostid); + i = 1; + while (stat(archive, &st) == 0) { + snprintf(archive, PATH_MAX, "%s/%s.REP.%d", outbound_path, hostid, i); + i++; + } char *b = buffer; size_t blen = sizeof buffer;