summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-05-31 21:39:18 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-05-31 21:39:18 +0800
commit1b8913058fb642723ce9a47d7bc1a78783afc86f (patch)
tree2a47cece018c33708fb6b4c80484c35edaabafdc
parent279728a516ab54039261a4061cdba9f3dbed0270 (diff)
downloadpttbbs-1b8913058fb642723ce9a47d7bc1a78783afc86f.tar
pttbbs-1b8913058fb642723ce9a47d7bc1a78783afc86f.tar.gz
pttbbs-1b8913058fb642723ce9a47d7bc1a78783afc86f.tar.bz2
pttbbs-1b8913058fb642723ce9a47d7bc1a78783afc86f.tar.lz
pttbbs-1b8913058fb642723ce9a47d7bc1a78783afc86f.tar.xz
pttbbs-1b8913058fb642723ce9a47d7bc1a78783afc86f.tar.zst
pttbbs-1b8913058fb642723ce9a47d7bc1a78783afc86f.zip
code for inserting data inside linked-list
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk@916 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rwxr-xr-xpttbbs/blog/builddb.pl11
1 files changed, 10 insertions, 1 deletions
diff --git a/pttbbs/blog/builddb.pl b/pttbbs/blog/builddb.pl
index 74bd5d99..b5262017 100755
--- a/pttbbs/blog/builddb.pl
+++ b/pttbbs/blog/builddb.pl
@@ -146,7 +146,16 @@ sub builddata($$$$$$)
$dat{last} = $currid;
}
else{ # inside ? @_@;;;
- debugmsg("not implement yet");
+ my($p, $c);
+ for( $p = $dat{last} ; $p>$currid ; $p = $dat{"$p.prev"} ){
+ ;
+ }
+ $c = $dat{"$p.next"};
+
+ $dat{"$currid.next"} = $c;
+ $dat{"$currid.prev"} = $p;
+ $dat{"$p.next"} = $currid;
+ $dat{"$c.prev"} = $currid;
}
$dat{$currid} = 1;
}