Don't clobber old qwk rep files
This commit is contained in:
parent
64ae6556f1
commit
99feabb6e5
@ -17,14 +17,20 @@ def dostuff(config_file):
|
|||||||
|
|
||||||
repfile = config.get("Main", "Outbound") + "/" + config.get("Main", "Host") + ".REP"
|
repfile = config.get("Main", "Outbound") + "/" + config.get("Main", "Host") + ".REP"
|
||||||
|
|
||||||
exists = os.path.isfile(repfile)
|
i = 1
|
||||||
|
|
||||||
|
while True:
|
||||||
|
exists = os.path.isfile(repfile)
|
||||||
if exists:
|
if exists:
|
||||||
file = open(repfile, "rb")
|
file = open(repfile, "rb")
|
||||||
ftp.storbinary("STOR " + config.get("Main", "Host") + ".REP", file)
|
ftp.storbinary("STOR " + config.get("Main", "Host") + ".REP", file)
|
||||||
file.close()
|
file.close()
|
||||||
os.remove(repfile)
|
os.remove(repfile)
|
||||||
print("SENT: " + config.get("Main", "Host") + ".REP")
|
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"
|
qwkfile = config.get("Main", "Inbound") + "/" + config.get("Main", "Host") + ".QWK"
|
||||||
with open(qwkfile, 'wb') as file:
|
with open(qwkfile, 'wb') as file:
|
||||||
|
@ -384,6 +384,8 @@ int main(int argc, char **argv) {
|
|||||||
char buffer[PATH_MAX];
|
char buffer[PATH_MAX];
|
||||||
char archive[PATH_MAX];
|
char archive[PATH_MAX];
|
||||||
int ret;
|
int ret;
|
||||||
|
struct stat st;
|
||||||
|
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
fprintf(stderr, "Usage:\n ./qwkscan config.ini\n");
|
fprintf(stderr, "Usage:\n ./qwkscan config.ini\n");
|
||||||
return -1;
|
return -1;
|
||||||
@ -412,6 +414,11 @@ int main(int argc, char **argv) {
|
|||||||
if (qwkidx > 0) {
|
if (qwkidx > 0) {
|
||||||
|
|
||||||
snprintf(archive, PATH_MAX, "%s/%s.REP", outbound_path, hostid);
|
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;
|
char *b = buffer;
|
||||||
size_t blen = sizeof buffer;
|
size_t blen = sizeof buffer;
|
||||||
|
Reference in New Issue
Block a user