回文章列表
作者JoeHorn.bbs@Star.leobbs.net (獅子男) 看板: itoc
標題[修正] 解決亂數簽名檔會讀到空檔的問題
時間星情小築 (2008/04/07 Mon 03:02:23)
我這邊使用了六個簽名檔,如果沒有六個的話,請注意黃色數字。

: maple/edit.c:ve_quote()

     if (op == 'r')
-      op = (time(0) % 6) + '1';
+    {
+      int i = 0, count = 0;
+      char sign_array[6];
+
+      while(i < 6)
+      {
+        char fpath[64];
+
+        sprintf(buf, "%s.%d", FN_SIGN, i+1);
+        usr_fpath(fpath, cuser.userid, buf);
+
+        if ((fd = open(fpath, O_RDONLY)) >= 0)
+        {
+          sign_array[count] = i + '1';
+          count++;
+        }
+        i++;
+      }
+
+      if ( count > 0 )
+      {
+        i = time(0) % count;
+        op = sign_array[i];
+      }
+      else
+      {
+        op = '0';
+      }
+    }

     if (op != '0')
     {
       char fpath[64];

--
Leo [joehorn]:~> make one lover for me
make: don't know how to make one. Stop
Leo [joehorn]:~> why?
why?: No match.

--
  Origin:  ˙星情小築  Star.leobbs.net 
  Author: JoeHorn59-116-35-227.dynamic.hinet.net 發表
文章選讀←離開[主題上]主題下(k)上篇(j)下篇S/a搜尋 G串列 TAB精華 ↑↓捲 Pg/Space翻