PttNewhand 板


LINE

╭╗ 關於「文章代碼(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://webptt.com/m.aspx?n=bbs/PttNewhand/M.1189784400.A.FAD.html │ │   ❷ Web BBS 文章內的超連結: │   https://webptt.com/m.aspx?n=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://webptt.com/m.aspx?n=bbs/PttNewhand/M.1430493990.A.FE0.html ※ 編輯: HWBA (118.168.40.196), 05/01/2015 23:26:41 ※ ymsgcat:轉錄至某隱形看板 05/01 23:29
1F:推 holishing: 推專業! 05/07 00:13
2F:推 name2name2: 這看起來有點C++可是好像不是,可以請問是哪個語言嗎 06/25 19:03
3F:→ name2name2: ? 隨意問問~~ 06/25 19:03
4F:推 holishing: c語言? 08/29 12:23
5F:推 holishing: https://github.com/ptt/pttbbs.git 去看裡面就知道了 01/06 12:46







like.gif 您可能會有興趣的文章
icon.png[問題/行為] 貓晚上進房間會不會有憋尿問題
icon.pngRe: [閒聊] 選了錯誤的女孩成為魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一張
icon.png[心得] EMS高領長版毛衣.墨小樓MC1002
icon.png[分享] 丹龍隔熱紙GE55+33+22
icon.png[問題] 清洗洗衣機
icon.png[尋物] 窗台下的空間
icon.png[閒聊] 双極の女神1 木魔爵
icon.png[售車] 新竹 1997 march 1297cc 白色 四門
icon.png[討論] 能從照片感受到攝影者心情嗎
icon.png[狂賀] 賀賀賀賀 賀!島村卯月!總選舉NO.1
icon.png[難過] 羨慕白皮膚的女生
icon.png閱讀文章
icon.png[黑特]
icon.png[問題] SBK S1安裝於安全帽位置
icon.png[分享] 舊woo100絕版開箱!!
icon.pngRe: [無言] 關於小包衛生紙
icon.png[開箱] E5-2683V3 RX480Strix 快睿C1 簡單測試
icon.png[心得] 蒼の海賊龍 地獄 執行者16PT
icon.png[售車] 1999年Virage iO 1.8EXi
icon.png[心得] 挑戰33 LV10 獅子座pt solo
icon.png[閒聊] 手把手教你不被桶之新手主購教學
icon.png[分享] Civic Type R 量產版官方照無預警流出
icon.png[售車] Golf 4 2.0 銀色 自排
icon.png[出售] Graco提籃汽座(有底座)2000元誠可議
icon.png[問題] 請問補牙材質掉了還能再補嗎?(台中半年內
icon.png[問題] 44th 單曲 生寫竟然都給重複的啊啊!
icon.png[心得] 華南紅卡/icash 核卡
icon.png[問題] 拔牙矯正這樣正常嗎
icon.png[贈送] 老莫高業 初業 102年版
icon.png[情報] 三大行動支付 本季掀戰火
icon.png[寶寶] 博客來Amos水蠟筆5/1特價五折
icon.pngRe: [心得] 新鮮人一些面試分享
icon.png[心得] 蒼の海賊龍 地獄 麒麟25PT
icon.pngRe: [閒聊] (君の名は。雷慎入) 君名二創漫畫翻譯
icon.pngRe: [閒聊] OGN中場影片:失蹤人口局 (英文字幕)
icon.png[問題] 台灣大哥大4G訊號差
icon.png[出售] [全國]全新千尋侘草LED燈, 水草

請輸入看板名稱,例如:Gossiping 或 站內搜尋

TOP