YTHT代码,丝路的删除

类别:软件工程 点击:0 评论:0 推荐:

移植自北大未名代码,感谢chutium的指正
===================================================================
RCS file: D:\ythtcvs\bbs\src\announce.c,v
retrieving revision 1.2
retrieving revision 1.5
diff -u -r1.2 -r1.5
--- announce.c  2004/11/30 13:33:50     1.2
+++ announce.c  2005/00/05 10:43:45     1.5
@@ -2221,7 +2221,7 @@
        move(t_lines - 22, 0);
        clrtobot();
        prints
-           ("将当前路径设置为丝路的那一项? (按A-T↑↓选择, ' '或回车确定', ←或
'X'取消)");
+           ("将当前路径设置为丝路的那一项? (按A-T↑↓选择, ' '或回车确定', ←或
'X'取消,'z'删除丝路)");
        for (i = 0; i < 20; i++) {
                move(t_lines - 22 + 1 + i, 0);
                prints(" %s(%c) %s",
@@ -2247,6 +2247,21 @@
                                if (nindex >= 20)
                                        nindex = 0;
                        }
+               } else if (i=='Z') {
+                       if(strlen(paths[index])) {
+                               if (askyn("确实要删除这个丝路吗?", NA, YEA) ==
YEA){
+                                               strncpy(paths[index],"",sizeof(p
aths[index]));
+                                       strncpy(titles[index], "尚未设定
                    ",sizeof(titles[index]));
+                                       if (save_anpath(titles, paths) < 0) {
+                                               prints("丝路删除错误! 按任意键继
续");
+                                               pressanykey();
+                                       } else {
+                                               pressreturn();
+                                       }
+                               } else {
+                                       pressanykey();
+                               }
+                       }
                } else {
                        i = i - 'A';
                        if (i >= 0 && i < 20) {
@@ -2292,6 +2307,7 @@
        return 0;
 }

+
 int
 select_anpath()
 {
@@ -2307,7 +2323,7 @@
                return -1;
        }
        prints
-           ("将文档保存到哪个丝路? (按A-H↑↓选择, ' '或回车确定', ←或'X'取消)
");
+           ("将文档保存到哪个丝路? (按A-T↑↓选择, ' '或回车确定', ←或'X'取消)
");
        for (i = 0; i < 20; i++) {
                move(t_lines - 22 + 1 + i, 0);
                prints(" %s(%c) %s",

本文地址:http://com.8s8s.com/it/it32104.htm