diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-09-15 18:51:26 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-09-15 18:51:26 +0800 |
commit | 1f2456d052f54631285a96959e774c3f008846f1 (patch) | |
tree | eaaa9d43a2d381428a44003a2949eb1b7faa59fa /mbbsd/bbs.c | |
parent | f04b9380031d2534d30976101996d8729fc95937 (diff) | |
download | pttbbs-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
Diffstat (limited to 'mbbsd/bbs.c')
-rw-r--r-- | mbbsd/bbs.c | 22 |
1 files changed, 18 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) { |