summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-12-29 16:18:29 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-12-29 16:18:29 +0800
commit5507859f58d2a4dd6ff14f441c5c0f51ed4c5928 (patch)
tree6b7d9fe6a0732463c8ded6f592960716cd63e5df /mbbsd
parent5148569239ecb02ebd4d2fc2cfb6e6f91797b2ba (diff)
downloadpttbbs-5507859f58d2a4dd6ff14f441c5c0f51ed4c5928.tar
pttbbs-5507859f58d2a4dd6ff14f441c5c0f51ed4c5928.tar.gz
pttbbs-5507859f58d2a4dd6ff14f441c5c0f51ed4c5928.tar.bz2
pttbbs-5507859f58d2a4dd6ff14f441c5c0f51ed4c5928.tar.lz
pttbbs-5507859f58d2a4dd6ff14f441c5c0f51ed4c5928.tar.xz
pttbbs-5507859f58d2a4dd6ff14f441c5c0f51ed4c5928.tar.zst
pttbbs-5507859f58d2a4dd6ff14f441c5c0f51ed4c5928.zip
after translating from old format, save favorite file in new format immediately
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@591 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/board.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/mbbsd/board.c b/mbbsd/board.c
index c7543ef2..ddeef92e 100644
--- a/mbbsd/board.c
+++ b/mbbsd/board.c
@@ -1,4 +1,4 @@
-/* $Id: board.c,v 1.64 2002/12/29 08:04:18 in2 Exp $ */
+/* $Id: board.c,v 1.65 2002/12/29 08:18:29 in2 Exp $ */
#include "bbs.h"
#define BRC_STRLEN 15 /* Length of board name */
#define BRC_MAXSIZE 24576
@@ -269,17 +269,29 @@ void load_brdbuf(void)
close(fd);
}
else{
+ // translate old fav format(int array) to new format(char array)
setuserfile(fname, STR_FAV);
if( (fd = open(fname, O_RDONLY, 0600)) != -1 ){
int *oldfav = (int *)malloc(size);
read(fd, oldfav, size);
close(fd);
- unlink(fname);
for( i = (numboards + 32) - 1 ; i >= 0 ; --i )
favbuf[i] = oldfav[i];
free(oldfav);
- favchange = 1;
+
+ setuserfile(fname, STR_FAV2);
+ if( (fd = open(fname, O_WRONLY | O_CREAT, 0600)) != -1 ){
+ size = numboards * sizeof(char);
+ write(fd, favbuf, size);
+ close(fd);
+
+ // remove old favorite file
+ setuserfile(fname, STR_FAV);
+ unlink(fname);
+ }
+ else
+ favchange = 1;
}
}