summaryrefslogtreecommitdiffstats
path: root/mbbsd/stuff.c
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-03-27 14:26:11 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-03-27 14:26:11 +0800
commitc17b1ec0c4c66cbe2761fa0e8c83831e6258d11d (patch)
tree21e0d184cdf9f58095dce3c486522e2266449391 /mbbsd/stuff.c
parent3e774d4829229f4132e3b6895b572a117f60c99d (diff)
downloadpttbbs-c17b1ec0c4c66cbe2761fa0e8c83831e6258d11d.tar
pttbbs-c17b1ec0c4c66cbe2761fa0e8c83831e6258d11d.tar.gz
pttbbs-c17b1ec0c4c66cbe2761fa0e8c83831e6258d11d.tar.bz2
pttbbs-c17b1ec0c4c66cbe2761fa0e8c83831e6258d11d.tar.lz
pttbbs-c17b1ec0c4c66cbe2761fa0e8c83831e6258d11d.tar.xz
pttbbs-c17b1ec0c4c66cbe2761fa0e8c83831e6258d11d.tar.zst
pttbbs-c17b1ec0c4c66cbe2761fa0e8c83831e6258d11d.zip
- (internal) move UTIL_C API from mbbsd/stuff to cmbbs.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4031 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/stuff.c')
-rw-r--r--mbbsd/stuff.c103
1 files changed, 3 insertions, 100 deletions
diff --git a/mbbsd/stuff.c b/mbbsd/stuff.c
index 2349a68d..1b3aace1 100644
--- a/mbbsd/stuff.c
+++ b/mbbsd/stuff.c
@@ -1,46 +1,16 @@
/* $Id$ */
#include "bbs.h"
+// TODO remove this
/* ----------------------------------------------------- */
/* set file path for boards/user home */
/* ----------------------------------------------------- */
static const char * const str_home_file = "home/%c/%s/%s";
static const char * const str_board_file = "boards/%c/%s/%s";
-static const char * const str_board_n_file = "boards/%c/%s/%s.%d";
-
static const char * const str_dotdir = FN_DIR;
/* XXX set*() all assume buffer size = PATHLEN */
-void
-sethomepath(char *buf, const char *userid)
-{
- assert(is_validuserid(userid));
- snprintf(buf, PATHLEN, "home/%c/%s", userid[0], userid);
-}
-
-void
-sethomedir(char *buf, const char *userid)
-{
- assert(is_validuserid(userid));
- snprintf(buf, PATHLEN, str_home_file, userid[0], userid, str_dotdir);
-}
-
-void
-sethomeman(char *buf, const char *userid)
-{
- assert(is_validuserid(userid));
- snprintf(buf, PATHLEN, str_home_file, userid[0], userid, "man");
-}
-
-
-void
-sethomefile(char *buf, const char *userid, const char *fname)
-{
- assert(is_validuserid(userid));
- assert(fname[0]);
- snprintf(buf, PATHLEN, str_home_file, userid[0], userid, fname);
-}
void
setuserfile(char *buf, const char *fname)
@@ -51,27 +21,6 @@ setuserfile(char *buf, const char *fname)
}
void
-setapath(char *buf, const char *boardname)
-{
- //assert(boardname[0]);
- snprintf(buf, PATHLEN, "man/boards/%c/%s", boardname[0], boardname);
-}
-
-void
-setadir(char *buf, const char *path)
-{
- //assert(path[0]);
- snprintf(buf, PATHLEN, "%s/%s", path, str_dotdir);
-}
-
-void
-setbpath(char *buf, const char *boardname)
-{
- //assert(boardname[0]);
- snprintf(buf, PATHLEN, "boards/%c/%s", boardname[0], boardname);
-}
-
-void
setbdir(char *buf, const char *boardname)
{
//assert(boardname[0]);
@@ -79,37 +28,6 @@ setbdir(char *buf, const char *boardname)
(currmode & MODE_DIGEST ? fn_mandex : str_dotdir));
}
-void
-setbfile(char *buf, const char *boardname, const char *fname)
-{
- //assert(boardname[0]);
- assert(fname[0]);
- snprintf(buf, PATHLEN, str_board_file, boardname[0], boardname, fname);
-}
-
-void
-setbnfile(char *buf, const char *boardname, const char *fname, int n)
-{
- //assert(boardname[0]);
- assert(fname[0]);
- snprintf(buf, PATHLEN, str_board_n_file, boardname[0], boardname, fname, n);
-}
-
-/*
- * input direct
- * output buf: copy direct
- * fname: direct 的檔名部分
- */
-void
-setdirpath(char *buf, const char *direct, const char *fname)
-{
- char *p;
- strcpy(buf, direct);
- p = strrchr(buf, '/');
- assert(p);
- strlcpy(p + 1, fname, PATHLEN-(p+1-buf));
-}
-
/**
* 給定文章標題 title,傳回指到主題的部分的指標。
* @param title
@@ -202,14 +120,7 @@ userid_is_BM(const char *userid, const char *list)
return 0;
}
-int
-belong(const char *filelist, const char *key)
-{
- return file_exist_record(filelist, key);
-}
-
-#ifndef _BBS_UTIL_C_ /* getdata_buf */
time4_t
gettime(int line, time4_t dt, const char*head)
{
@@ -259,12 +170,6 @@ void syncnow(void)
#endif
}
-#endif
-
-
-#ifndef _BBS_UTIL_C_
-/* 這一區都是有關於畫面處理的, 故 _BBS_UTIL_C_ 不須要 */
-
#ifdef PLAY_ANGEL
void
pressanykey_or_callangel(){
@@ -593,8 +498,6 @@ show_helpfile(const char *helpfile)
pressanykey();
}
-#endif // _BBS_UTIL_C_
-
/* ----------------------------------------------------- */
/* use mmap() to malloc large memory in CRITICAL_MEMORY */
/* ----------------------------------------------------- */
@@ -605,7 +508,7 @@ void *MALLOC(int size)
p = (int *)mmap(NULL, (size + 4), PROT_READ | PROT_WRITE,
MAP_ANON | MAP_PRIVATE, -1, 0);
p[0] = size;
-#if defined(DEBUG) && !defined(_BBS_UTIL_C_)
+#if defined(DEBUG)
vmsgf("critical malloc %d bytes", size);
#endif
return (void *)&p[1];
@@ -615,7 +518,7 @@ void FREE(void *ptr)
{
int size = ((int *)ptr)[-1];
munmap((void *)(&(((int *)ptr)[-1])), size);
-#if defined(DEBUG) && !defined(_BBS_UTIL_C_)
+#if defined(DEBUG)
vmsgf("critical free %d bytes", size);
#endif
}