回精華區
作者itoc, 信區: itoc
標題[功能] edit.c 六個簽名檔
時間03/06/08
作者: itoc (拯救一個靈魂) 看板: plan
標題: [功能] 六個簽名檔
時間: Sun Jun 30 18:31:29 2002                          Updated: 2005/04/10

  預設只有三個簽名檔,改成六個

: edit.c show_sign()

static void
- show_sign()
+ show_sign(ch)         /* itoc.000319: 顯示簽名檔的內容 */
+ char ch;
{
  int fd, len, i;
- char fpath[64], buf[10], ch, *str;
+ char fpath[64], buf[10], *str;

  ...
  ...

- for (ch = '1'; ch <= '3'; ch++)       /* 三個簽名檔 */
+ for (; ch <= '6'; ch++)               /* 六個簽名檔 */
  {
    fpath[len] = ch;

    fd = open(fpath, O_RDONLY);
    if (fd >= 0)
    {
      mgets(-1);
-     move((ch - '1') * (MAXSIGLINES + 1), 0);
+     move(((ch - '1') % 3) * (MAXSIGLINES + 1), 0);
      prints("\033[1;36m【 簽名檔 %c 】\033[m\n", ch);

      for (i = 1; i <= MAXSIGLINES; i++)
      {
        if (!(str = mgets(fd)))
          break;
        prints("%s\n", str);
      }

+     if (((ch - '0') % 3) == 0)
+       break;
    }
  }


: edit.c ve_quote()

- static char msg[] = "選擇簽名檔 (1/2/3, 0=不加 r=亂數)[0]:";
+ static char msg[] = "選擇簽名檔 (1 ~ 6, 0=不加 r=亂數 n=換頁)[0]:";

  ...
  ...

  {
+   int topsig = 1;     /* LHD.031107: 本頁最上面的簽名檔 */
+ show_sign:
    if (cuser.ufo & UFO_SHOWSIGN)       /* itoc.000319: 顯示簽名檔的內容 */
-     show_sign();
+     show_sign('0' + topsig);          /* itoc.000319: 顯示簽名檔的內容 */

-   msg[33] = op = cuser.signature + '0';
+   msg[40] = op = cuser.signature + '0';
    if (fd = vget(b_lines, 0, msg, buf, 3, DOECHO))
    {
+     if (fd == 'n')    /* LHD.031107: 按 n 循環換頁 */
+     {
+       topsig = (topsig + 3) % 6;
+       goto show_sign;
+     }

-     if (op != fd && ((fd >= '0' && fd <= '3') || fd == 'r'))
+     if (op != fd && ((fd >= '0' && fd <= '6') || fd == 'r'))
      {
        cuser.signature = fd - '0';
        op = fd;
      }
    }

    if (op == 'r')
-     op = (time(0) % 3) + '1';
+     op = (time(0) % 6) + '1';


: acct.c u_xfile()

  static char *desc[] =
  {
    "上站地點設定檔",
    "名片檔",
    "簽名檔.1",
    "簽名檔.2",
    "簽名檔.3",
+   "簽名檔.4",
+   "簽名檔.5",
+   "簽名檔.6",
    "暫存檔.1",
    "暫存檔.2",
    "暫存檔.3",
    "暫存檔.4",
    "暫存檔.5",
    NULL
  };

  static char *path[] =
  {
    "acl",
    "plans",
    FN_SIGN ".1",
    FN_SIGN ".2",
    FN_SIGN ".3",
+   FN_SIGN ".4",
+   FN_SIGN ".5",
+   FN_SIGN ".6",
    "buf.1",
    "buf.2",
    "buf.3",
    "buf.4",
    "buf.5"
  };


--
  目前的設計,最多可以改到 '9' 個簽名檔

--
□ 本文章由 itockiller.Dorm3.NCTU.edu.tw 發表
精華選讀←離開[主題上]主題下(k)上篇(j)下篇S/a搜尋 G串列 TAB精華 ↑↓捲 Pg/Space翻