summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-09-15 18:51:26 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-09-15 18:51:26 +0800
commit1f2456d052f54631285a96959e774c3f008846f1 (patch)
treeeaaa9d43a2d381428a44003a2949eb1b7faa59fa
parentf04b9380031d2534d30976101996d8729fc95937 (diff)
downloadpttbbs-1f2456d052f54631285a96959e774c3f008846f1.tar
pttbbs-1f2456d052f54631285a96959e774c3f008846f1.tar.gz
pttbbs-1f2456d052f54631285a96959e774c3f008846f1.tar.bz2
pttbbs-1f2456d052f54631285a96959e774c3f008846f1.tar.lz
pttbbs-1f2456d052f54631285a96959e774c3f008846f1.tar.xz
pttbbs-1f2456d052f54631285a96959e774c3f008846f1.tar.zst
pttbbs-1f2456d052f54631285a96959e774c3f008846f1.zip
make textlen an option
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3177 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/bbs.c22
-rw-r--r--sample/pttbbs.conf3
2 files changed, 21 insertions, 4 deletions
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index a14c197c..1bda4b80 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -828,11 +828,13 @@ do_general(int isbid)
struct stat st;
postfile.multi.money = aborted;
+#ifdef USE_TEXTLEN
if (stat(fpath, &st) != -1)
{
/* put original file (text) length. */
postfile.textlen = st.st_size;
}
+#endif
}
strlcpy(postfile.owner, owner, sizeof(postfile.owner));
@@ -1161,13 +1163,17 @@ edit_post(int ent, fileheader_t * fhdr, const char *direct)
setdirpath(genbuf, direct, fhdr->filename);
local_article = fhdr->filemode & FILE_LOCAL;
- if(fhdr->textlen <= 0)
- Copy(genbuf, fpath);
- else
+#ifdef USE_TEXTLEN
+ if(fhdr->textlen > 0)
{
/* TODO SYSOP may need some function to edit entire file. */
CopyN(genbuf, fpath, fhdr->textlen);
}
+ else
+#endif
+ {
+ Copy(genbuf, fpath);
+ }
strlcpy(save_title, fhdr->title, sizeof(save_title));
@@ -1182,7 +1188,11 @@ edit_post(int ent, fileheader_t * fhdr, const char *direct)
/* check textlen */
if(fhdr->textlen > 0)
{
- int gotnewstat = 0;
+ int gotnewstat = -1;
+
+#ifdef USE_TEXTLEN
+ /* TODO should we reload textlen info?
+ * multiple editing will make textlen invalid. */
if(fhdr->textlen != newstat.st_size)
{
#ifdef DEBUG
@@ -1195,12 +1205,16 @@ edit_post(int ent, fileheader_t * fhdr, const char *direct)
} else {
gotnewstat = stat(fpath, &newstat);
}
+#endif
+
/* now update the record. */
if(gotnewstat != -1)
fhdr->textlen = newstat.st_size;
else
fhdr->textlen = 0;
+
recordTouched = 1;
+
} else /* old flavor, no textlen info */
if (oldstat.st_mtime != newstat.st_mtime)
{
diff --git a/sample/pttbbs.conf b/sample/pttbbs.conf
index 3f85bb7e..6b815e31 100644
--- a/sample/pttbbs.conf
+++ b/sample/pttbbs.conf
@@ -142,6 +142,9 @@
/* "不"使用新式的 pmore (piaip's more) 代替舊式 bug 抓不完的 more */
//#define USE_TRADITIONAL_MORE
+/* 使用 textlen 欄位來確定文章實際長度,避免蓋掉推文等。 */
+// #define USE_TEXTLEN
+
/* 使用 rfork()取代 fork() . 目前只在 FreeBSD上有效 */
//#define USE_RFORK