diff options
author | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-06-24 01:04:32 +0800 |
---|---|---|
committer | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-06-24 01:04:32 +0800 |
commit | 5d1b3b61fce5737953e155ffd12c3f63c031c298 (patch) | |
tree | 6e8dbfda2a6a46dfd0717bc4e76afaabc5d8b412 | |
parent | f069904bab42fc7ff6b3b5085ace779ee08f6a87 (diff) | |
download | pttbbs-5d1b3b61fce5737953e155ffd12c3f63c031c298.tar pttbbs-5d1b3b61fce5737953e155ffd12c3f63c031c298.tar.gz pttbbs-5d1b3b61fce5737953e155ffd12c3f63c031c298.tar.bz2 pttbbs-5d1b3b61fce5737953e155ffd12c3f63c031c298.tar.lz pttbbs-5d1b3b61fce5737953e155ffd12c3f63c031c298.tar.xz pttbbs-5d1b3b61fce5737953e155ffd12c3f63c031c298.tar.zst pttbbs-5d1b3b61fce5737953e155ffd12c3f63c031c298.zip |
enhance
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@2863 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | not-maintained/ColaBBS_to_PttBBS/README | 15 | ||||
-rw-r--r-- | not-maintained/ColaBBS_to_PttBBS/cntarticle.pl | 1 | ||||
-rw-r--r-- | not-maintained/ColaBBS_to_PttBBS/cnthomedir.pl | 4 | ||||
-rw-r--r-- | not-maintained/ColaBBS_to_PttBBS/cntpasswd.c | 29 |
4 files changed, 26 insertions, 23 deletions
diff --git a/not-maintained/ColaBBS_to_PttBBS/README b/not-maintained/ColaBBS_to_PttBBS/README index 1fdd1b87..1002e489 100644 --- a/not-maintained/ColaBBS_to_PttBBS/README +++ b/not-maintained/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/not-maintained/ColaBBS_to_PttBBS/cntarticle.pl b/not-maintained/ColaBBS_to_PttBBS/cntarticle.pl index 36419b5a..649aff00 100644 --- a/not-maintained/ColaBBS_to_PttBBS/cntarticle.pl +++ b/not-maintained/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/not-maintained/ColaBBS_to_PttBBS/cnthomedir.pl b/not-maintained/ColaBBS_to_PttBBS/cnthomedir.pl index 3e36fb8e..64695a21 100644 --- a/not-maintained/ColaBBS_to_PttBBS/cnthomedir.pl +++ b/not-maintained/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/not-maintained/ColaBBS_to_PttBBS/cntpasswd.c b/not-maintained/ColaBBS_to_PttBBS/cntpasswd.c index fd9f778a..40a97ac1 100644 --- a/not-maintained/ColaBBS_to_PttBBS/cntpasswd.c +++ b/not-maintained/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; } |