summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-06-24 01:04:32 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-06-24 01:04:32 +0800
commit3e1adccc79b103308400861b7a22d0fc0bcd6351 (patch)
tree15a6b853de51d8a3c4e036c0af3f40793cc65db8
parenta545d2f4f3dc28c0b12d35b192ec1bcedce86e4b (diff)
downloadpttbbs-not-maintained@4903.tar
pttbbs-not-maintained@4903.tar.gz
pttbbs-not-maintained@4903.tar.bz2
pttbbs-not-maintained@4903.tar.lz
pttbbs-not-maintained@4903.tar.xz
pttbbs-not-maintained@4903.tar.zst
pttbbs-not-maintained@4903.zip
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/not-maintained@2863 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--ColaBBS_to_PttBBS/README15
-rw-r--r--ColaBBS_to_PttBBS/cntarticle.pl1
-rw-r--r--ColaBBS_to_PttBBS/cnthomedir.pl4
-rw-r--r--ColaBBS_to_PttBBS/cntpasswd.c29
4 files changed, 26 insertions, 23 deletions
diff --git a/ColaBBS_to_PttBBS/README b/ColaBBS_to_PttBBS/README
index 1fdd1b87..1002e489 100644
--- a/ColaBBS_to_PttBBS/README
+++ b/ColaBBS_to_PttBBS/README
@@ -1,9 +1,9 @@
There're some tools for transfering data from ColaBBS
(http://lh.twbbs.org/) to PttBBS (http://ptt.cc). Since ColaBBS
-doesn't provide its source code or any file spec, there's no good way
-to do this. I hacked the data structures with only VERY LITTLE
+doesn't provide its source code or any file spec, there's no shortcut
+for this. I hacked the data structures with only VERY LITTLE
information directly from files, and these may NOT work. You sould NOT
-use if you don't have programming background, or contact(make a
+use if you don't have programming background, or contact(make an
offer?) me in2 _AT_ in2home.org.
the Id of this file is $Id$ .
@@ -25,15 +25,16 @@ please follow the step:
apply "mv %1/.DIR %1/.DIR.colabbs; cntDIR < %1/.DIR.colabbs >
%1/.DIR" */*
cntbrd < _COLABBS_/boards/.BOARDS > ~/.BRD
-6. transfer password file:
- cntpasswd < _COLABBS_/.PASSWDS > ~/.PASSWDS
-7. transfer mails
+6. transfer mails
cd _COLABBS_/home; cnthomedir.pl
cd ~/home/;
apply "mv %1/mail/* %1/" */*; \
apply "mv %1/mail/.DIR %1/.DIR.colabbs" */*; \
apply "rmdir %1/mail" */*; \
- apply "cnthomeDIR < %1/.DIR.colabbs > %1/.DIR"; \
+ apply "cnthomeDIR < %1/.DIR.colabbs > %1/.DIR" */* ; \
cntarticle.pl */*
+7. transfer password file:
+ cntpasswd home/*/*/USERDATA.DAT > ~/.PASSWDS; \
+ tunepasswd
8. tranfer man
use cntDIR to convert .DIR and cntarticle.pl for articles.
diff --git a/ColaBBS_to_PttBBS/cntarticle.pl b/ColaBBS_to_PttBBS/cntarticle.pl
index 36419b5a..649aff00 100644
--- a/ColaBBS_to_PttBBS/cntarticle.pl
+++ b/ColaBBS_to_PttBBS/cntarticle.pl
@@ -23,6 +23,7 @@ sub convert
$content < io($fn);
$content =~ s/\r//gs;
$content =~ s/^.*?m 作者 .*?m (.*\))\s+\S+? 信區 .*?m (\S+).*/作者: $1 看板: $2/m;
+ $content =~ s/^.*?m 作者 .*?m (.*\))/作者: $1/m;
$content =~ s/^.*?m 標題 .*?m (.*?)\s+\S+m/標題: $1/m;
$content =~ s/^.*?m 時間 .*?m (.*?)\s+\S+m/時間: $1/m;
$content =~ s/^\e\[36m────────────────────────────────────────\e\[m\n//m;
diff --git a/ColaBBS_to_PttBBS/cnthomedir.pl b/ColaBBS_to_PttBBS/cnthomedir.pl
index 3e36fb8e..64695a21 100644
--- a/ColaBBS_to_PttBBS/cnthomedir.pl
+++ b/ColaBBS_to_PttBBS/cnthomedir.pl
@@ -2,8 +2,10 @@
# $Id$
# usage: cd ColaBBS/home; perl cnthomedir.pl
use IO::All;
+`mkdir -p ~/home/$_` foreach( 'a'..'z', 'A'..'Z' );
+
foreach( <*> ){
- next if( !-d $_ || /\./ );
+ next if( !-d $_ || /\./ || /^[A-Za-z]$/ );
$USERDATA < io("$_/USERDATA.DAT");
($userid) = $USERDATA =~ /^(\w+)/;
$c = substr($userid, 0, 1);
diff --git a/ColaBBS_to_PttBBS/cntpasswd.c b/ColaBBS_to_PttBBS/cntpasswd.c
index fd9f778a..40a97ac1 100644
--- a/ColaBBS_to_PttBBS/cntpasswd.c
+++ b/ColaBBS_to_PttBBS/cntpasswd.c
@@ -1,6 +1,6 @@
/* $Id$ */
#include "bbs.h"
-/* usage: ./cntpasswd < ColaBBS/.PASSWDS > ~/.PASSWDS */
+// usage: cd home/; cntpasswd */*/USERDATA.DAT > ~/.PASSWDS ; tunepasswd
typedef struct {
char userid[IDLEN + 1];
@@ -16,21 +16,20 @@ int main(int argc, char **argv)
{
fuserect_t fu;
userec_t u;
- memset(&u, 0, sizeof(u));
- while( read(0, &fu, sizeof(fu)) == sizeof(fu) ){
-#if 0
- printf("(%s), (%s), (%s), (%s)\n",
- fu.userid, fu.passwd, fu.nick, fu.name);
-#endif
- if( !fu.userid[0] )
- continue;
+ int fd, i;
- memset(&u, 0, sizeof(u));
- strlcpy(u.userid, fu.userid, sizeof(u.userid));
- strlcpy(u.passwd, fu.passwd, sizeof(u.passwd));
- strlcpy(u.realname, fu.name, sizeof(u.realname));
- strlcpy(u.username, fu.nick, sizeof(u.username));
- write(1, &u, sizeof(u));
+ for( i = 1 ; i < argc ; ++i ){
+ if( (fd = open(argv[i], O_RDONLY)) > 0 &&
+ read(fd, &fu, sizeof(fu)) == sizeof(fu) &&
+ fu.userid[0] ){
+
+ memset(&u, 0, sizeof(u));
+ strlcpy(u.userid, fu.userid, sizeof(u.userid));
+ strlcpy(u.passwd, fu.passwd, sizeof(u.passwd));
+ strlcpy(u.realname, fu.name, sizeof(u.realname));
+ strlcpy(u.username, fu.nick, sizeof(u.username));
+ write(1, &u, sizeof(u));
+ }
}
return 0;
}