看板 PttNewhand 關於我們 聯絡資訊
 關於「文章代碼(AID)」說明 ├╯ ⒈ 文章識別系統 (AIDS)   Article IDentification System   目的在告知他人某篇特定的文章  請那個人順利找到   同時,有效地解決傳統上,僅告知   看板的文章編號;卻因為前面文章   被刪除並且清理索引的空位,導致   之後的文章向前遞補之後所造成的   文章編號不同困境。 ⒉ 在 PttBBS 的應用 (telnet) :  ① 任何文章前,按 大寫 Q 即可,    系統顯示該篇文章代碼 (AID)   該篇文章網址(預設關閉)。  ② 將查詢到的文章代碼 (AID)複製    如:#14rWZ-E4 (PttNewhand)  ③ 對方進入 PttNewhand 看板後,    按下 # (符號) 並輸入文章代碼    ,或直接貼上即可查閱。  ④ 以上操作為 PC 電腦版的說明,    若您使用手機版、平板電腦版等    連線 Ptt BBS,可能因該軟體的    開發商(作者)不同而有所不同。 ⒊ 在 PttBBS 的應用 (Web BBS) :  ① 假設使用者在:    某篇文章推文文章代碼 (AID)    #14rWZ-E4    #14rWZ-E4 (PttNewhand)    PttNewhand 看板 #14rWZ-E4    ▲備註:三種形式皆可。  ② 瀏覽批踢踢實業坊 WebBBS 介面    發現 PttNewhand 板的該篇文章    內推文出現超連結。    ❶ Web BBS 原始文章:    https://www.ptt.cc/bbs/PttNewhand/M.1189784400.A.FAD.html    ❷ Web BBS 文章內的超連結:    https://www.ptt.cc/bbs/PttNewhand/M.1154877694.A.384.html ⒋ 目前 PttBBS 所使用的文章及文摘   檔名為: M(文章)G(文摘)   、接著十進位的 31-bit 數字(事   實上是一個 32-bit time_t 的正   數部分)、接著 ".A" 之後,再接   著 "." 及一個三位的大寫十六進   位數字,以 Regular Expression   拮取:   /^(M|G)\.(\d+)\.A(?:\.([0-9A-F]{3}))?$/   $type = $1   $v1 = $2   $v2 = (defined($3) ? hex($3) : 0) ⒌ 目前 AID 另外有幾種表現形態:  ① AIDu (AID uncompressed)    即 AID,以 uncompressed 強調    其為原始形態。  ② AIDc (AID compressed)    以類似 Base64 的表現方式(即    每 6-bit 以一個字元表示),    用字串表示 AIDu。    目前以 0-9, A-Z, a-z, -, _,    共 64 個符號代表 6-bit 裡面    0~64 的值。    AIDv1 使用 48-bit,故再轉換    成 AIDc 時為 8 個字元長。  ③ AIDu 與 AIDc 可完全互相轉換。 [相關代碼-一]  //若未定義則無 AID /* AIDS */ #define AID_DISPLAYNAME "文章代碼(AID)" /* end of AIDS */ /* QUERY_ARTICLE_URL */ #define URL_DISPLAYNAME "文章網址" /* end of QUERY_ARTICLE_URL */ [相關代碼-二] static int pvrb_search(char key, int curr, int total, pvrb_ctx *cx) { fileheader_t *fh; static char search_str[FNLEN] = ""; static char search_cmd = 0; const char *prompt = ""; const char *aid_str = NULL; aidu_t aidu = 0; int need_input = 1; if (key == 'n') { key = search_cmd; if (key) { need_input = 0; if (curr + 1 < total) curr ++; } else key = '/'; } if (key == '#') prompt = "請輸入文章代碼: #"; else if (key == '/') prompt = "請輸入標題關鍵字: "; else if (key == 'a') prompt = "請輸入作者關鍵字: "; else { assert(!"unknown search command"); return PSB_NA; } assert(sizeof(search_str) >= FNLEN); if (need_input && getdata(b_lines-1, 0, prompt, search_str, FNLEN, DOECHO) < 1) return PSB_NA; // cache for next cache. search_cmd = key; if (key == '#') { // AID search is very special, we have to search from begin to end. curr = 0; aid_str = search_str; while (*aid_str == ' ' || *aid_str == '#') aid_str++; aidu = aidc2aidu(aid_str); if (!aidu) return PSB_NOP; } // the records was in reversed ordering for (; curr < total; curr++) { fh = &cx->records[total - curr - 1]; if ((key == '/' && DBCS_strcasestr(fh->title, search_str)) || (key == 'a' && DBCS_strcasestr(fh->owner, search_str)) || (key == '#' && fn2aidu(fh->filename) == aidu)) { // found something. return as current index. return curr; } } return PSB_NOP; } [相關代碼-三] #ifdef AID_DISPLAYNAME // quick exit if (r <= 0) break; // LatestRef only works if system supports AID. // try to load next reference. lua_getglobal(L, "toc"); // stack 1 lua_getfield(L, -1, "latestref"); // stack 2 lastref = lua_tostring(L, -1); while (lastref && *lastref) { // try to load by AID char bn[IDLEN+1] = ""; aidu_t aidu = 0; unsigned char *p = (unsigned char*)bn; if (*lastref == '#') lastref++; aidu = aidc2aidu((char*)lastref); if (aidu <= 0) break; while (*lastref > ' ') lastref ++; // lastref points to zero of space while (*lastref && *lastref <= ' ') lastref++; // lastref points to zero or board name if (*lastref == '(') lastref ++; if (!*lastref) break; strlcpy(bn, lastref, sizeof(bn)); // truncate board name // (not_alnum(ch) && ch != '_' && ch != '-' && ch != '.') while (*p && (isalnum(*p) || *p == '_' || *p == '-' || *p == '.')) p++; *p = 0; if (bn[0]) { bfpath[0] = 0; setaidfile(bfpath, bn, aidu); } if (bfpath[0]) loadnext = 1; break; } lua_pop(L, 2); if (loadnext) continue; #endif // AID_DISPLAYNAME break; } while (r-- > 0); } --         ╱     ╱ [個人板] BS2 P_HWBA板         ████◣╱ █████  weifeng板 ╱       ╱  █      ─────────── █████      █████  ╱     熱心 愛心 耐心 服務心      ╱  █  █████  真意 善意 美意 誠意 HWBA █████ █████   ────── ψHWBA -- ※ 發信站: 批踢踢兔(ptt2.cc), 來自: 118.168.40.196 ※ 發信站: 批踢踢實業坊(ptt.cc) ※ 轉錄者: HWBA (118.168.40.196), 05/01/2015 23:25:44 ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 118.168.40.196 ※ 文章網址: https://www.ptt.cc/bbs/PttNewhand/M.1430493990.A.FE0.html ※ 編輯: HWBA (118.168.40.196), 05/01/2015 23:26:41 ymsgcat:轉錄至某隱形看板 05/01 23:29
holishing: 推專業! 05/07 00:13
name2name2: 這看起來有點C++可是好像不是,可以請問是哪個語言嗎 06/25 19:03
name2name2: ? 隨意問問~~ 06/25 19:03
holishing: c語言? 08/29 12:23
holishing: https://github.com/ptt/pttbbs.git 去看裡面就知道了 01/06 12:46