Skip to content

Commit 89ed3b4

Browse files
committed
fix backup with two-pass
1 parent 62ae001 commit 89ed3b4

1 file changed

Lines changed: 21 additions & 18 deletions

File tree

statements.c

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11308,26 +11308,29 @@ void set (char **statement)
1130811308
}
1130911309
else if (!strncmp (statement[2], "backupfile", 10))
1131011310
{
11311-
assertminimumargs (statement, "set backupfile", 1);
11312-
// set backupname to statement[3]
11313-
removeCR (statement[3]);
11314-
char *backupstr=statement[3];
11315-
if (*backupstr == '\'')
11316-
backupstr++;
11317-
int t;
11318-
for(t=0;t<SIZEOFSTATEMENT;t++)
11311+
if (!backupflag)
1131911312
{
11320-
if(backupstr[t]==0)
11321-
break;
11322-
if(backupstr[t]=='^')
11323-
backupstr[t]=' ';
11324-
}
11325-
if(backupstr[t-1]=='\'')
11313+
assertminimumargs (statement, "set backupfile", 1);
11314+
// set backupname to statement[3]
11315+
removeCR (statement[3]);
11316+
char *backupstr=statement[3];
11317+
if (*backupstr == '\'')
11318+
backupstr++;
11319+
int t;
11320+
for(t=0;t<SIZEOFSTATEMENT;t++)
11321+
{
11322+
if(backupstr[t]==0)
11323+
break;
11324+
if(backupstr[t]=='^')
11325+
backupstr[t]=' ';
11326+
}
11327+
if(backupstr[t-1]=='\'')
1132611328
backupstr[t-1]=0;
11327-
if(OpenArchive(backupstr)==FALSE)
11328-
prerror ("set backupfile failed - couldn't write to '%s'",backupstr);
11329-
backupflag = TRUE;
11330-
backupthisfile(backupname);
11329+
if(OpenArchive(backupstr)==FALSE)
11330+
prerror ("set backupfile failed - couldn't write to '%s'",backupstr);
11331+
backupflag = TRUE;
11332+
backupthisfile(backupname);
11333+
}
1133111334
}
1133211335
else if (!strncmp (statement[2], "screenheight", 12))
1133311336
{

0 commit comments

Comments
 (0)