summaryrefslogtreecommitdiffstats
path: root/mbbsd/stuff.c
diff options
context:
space:
mode:
authormhsin <mhsin@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2007-12-17 19:49:15 +0800
committermhsin <mhsin@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2007-12-17 19:49:15 +0800
commit16bf63475770e642a94d5d617b000f025846fddf (patch)
treef1d0951f3dc073cb1ad6f612db883786f2884a06 /mbbsd/stuff.c
parentd9108233ecee950fcc9aa1f0599f28adfd204537 (diff)
downloadpttbbs-16bf63475770e642a94d5d617b000f025846fddf.tar
pttbbs-16bf63475770e642a94d5d617b000f025846fddf.tar.gz
pttbbs-16bf63475770e642a94d5d617b000f025846fddf.tar.bz2
pttbbs-16bf63475770e642a94d5d617b000f025846fddf.tar.lz
pttbbs-16bf63475770e642a94d5d617b000f025846fddf.tar.xz
pttbbs-16bf63475770e642a94d5d617b000f025846fddf.tar.zst
pttbbs-16bf63475770e642a94d5d617b000f025846fddf.zip
* Enhanced AID query UI.
* Use aidu_t(uint64_t) for AIDus. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3703 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/stuff.c')
-rw-r--r--mbbsd/stuff.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/mbbsd/stuff.c b/mbbsd/stuff.c
index af55ca01..b5b18645 100644
--- a/mbbsd/stuff.c
+++ b/mbbsd/stuff.c
@@ -663,12 +663,13 @@ uintbsearch(const unsigned int key, const unsigned int *base0, const int nmemb)
return (NULL);
}
-unsigned long fn2aidu(char *fn)
+/* AIDS */
+aidu_t fn2aidu(char *fn)
{
- unsigned long aidu = 0;
- unsigned long type = 0;
- unsigned long v1 = 0;
- unsigned long v2 = 0;
+ aidu_t aidu = 0;
+ aidu_t type = 0;
+ aidu_t v1 = 0;
+ aidu_t v2 = 0;
char *sp = fn;
if(fn == NULL)
@@ -709,12 +710,12 @@ unsigned long fn2aidu(char *fn)
/* IMPORTANT:
* size of buf must be at least 8+1 bytes
*/
-char *aidu2aidc(char *buf, unsigned long aidu)
+char *aidu2aidc(char *buf, aidu_t aidu)
{
const char aidu2aidc_table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_";
const int aidu2aidc_tablesize = sizeof(aidu2aidc_table) - 1;
char *sp = buf + 8;
- unsigned long v;
+ aidu_t v;
*(sp --) = '\0';
while(sp >= buf)
@@ -731,11 +732,11 @@ char *aidu2aidc(char *buf, unsigned long aidu)
/* IMPORTANT:
* size of fn must be at least FNLEN bytes
*/
-char *aidu2fn(char *fn, unsigned long aidu)
+char *aidu2fn(char *fn, aidu_t aidu)
{
- unsigned long type = ((aidu >> 44) & 0xf);
- unsigned long v1 = ((aidu >> 12) & 0xffffffff);
- unsigned long v2 = (aidu & 0xfff);
+ aidu_t type = ((aidu >> 44) & 0xf);
+ aidu_t v1 = ((aidu >> 12) & 0xffffffff);
+ aidu_t v2 = (aidu & 0xfff);
if(fn == NULL)
return NULL;
@@ -744,17 +745,17 @@ char *aidu2fn(char *fn, unsigned long aidu)
return fn;
}
-unsigned long aidc2aidu(char *aidc)
+aidu_t aidc2aidu(char *aidc)
{
char *sp = aidc;
- unsigned long aidu = 0;
+ aidu_t aidu = 0;
if(aidc == NULL)
return 0;
while(*sp != '\0' && /* ignore trailing spaces */ *sp != ' ')
{
- unsigned long v = 0;
+ aidu_t v = 0;
/* FIXME: 查表法會不會比較快? */
if(*sp >= '0' && *sp <= '9')
v = *sp - '0';
@@ -776,7 +777,7 @@ unsigned long aidc2aidu(char *aidc)
return aidu;
}
-int search_aidu(char *bfile, unsigned long aidu)
+int search_aidu(char *bfile, aidu_t aidu)
{
char fn[FNLEN];
int fd;
@@ -816,4 +817,4 @@ int search_aidu(char *bfile, unsigned long aidu)
return (found ? pos : (lastpos ? lastpos : -1));
}
-
+/* end of AIDS */