diff -ruN joe-2.9.8/b.c zh-joe-2.9.8/b.c --- joe-2.9.8/b.c Fri Feb 21 17:43:52 2003 +++ zh-joe-2.9.8/b.c Thu Nov 3 22:57:58 2005 @@ -48,11 +48,11 @@ VFILE *vmem; char *msgs[] = { - "Error writing file", - "Error opening file", - "Error seeking file", - "Error reading file", - "New File" + "寫入檔案錯誤", + "開啟檔案錯誤", + "尋找檔案錯誤", + "讀取檔案錯誤", + "新檔" }; /* Get size of gap (amount of free space) */ @@ -2162,18 +2162,18 @@ if ((f = fdopen(tmpfd, "a")) == NULL) _exit(-1); - fprintf(f, "\n*** Modified files in JOE when it aborted on %s", ctime(&tim)); + fprintf(f, "\n*** 於 %s 時不正常結束的 JOE 存檔", ctime(&tim)); if (sig) - fprintf(f, "*** JOE was aborted by signal %d\n", sig); + fprintf(f, "*** JOE 因 signal %d 而不正常結束\n", sig); else - fprintf(f, "*** JOE was aborted because the terminal closed\n"); + fprintf(f, "*** JOE 因 terminal 連線中斷而不正常結束\n"); fflush(f); for (b = bufs.link.next; b != &bufs; b = b->link.next) if (b->changed) { if (b->name) - fprintf(f, "\n*** File \'%s\'\n", b->name); + fprintf(f, "\n*** 檔名: \'%s\'\n", b->name); else - fprintf(f, "\n*** File \'(Unnamed)\'\n"); + fprintf(f, "\n*** 檔名: \'(未命名)\'\n"); fflush(f); bsavefd(b->bof, fileno(f), b->eof->byte); } diff -ruN joe-2.9.8/bw.c zh-joe-2.9.8/bw.c --- joe-2.9.8/bw.c Thu Mar 6 15:24:26 2003 +++ zh-joe-2.9.8/bw.c Thu Nov 3 22:57:58 2005 @@ -734,9 +734,9 @@ int c = brc(bw->cursor); if (c == NO_MORE_DATA) - snprintf(buf, sizeof(buf), "** Line %ld Col %ld Offset %ld(0x%lx) **", bw->cursor->line + 1, piscol(bw->cursor) + 1, bw->cursor->byte, bw->cursor->byte); + snprintf(buf, sizeof(buf), "** 行數 %ld 列數 %ld 檔案大小 %ld(0x%lx) **", bw->cursor->line + 1, piscol(bw->cursor) + 1, bw->cursor->byte, bw->cursor->byte); else - snprintf(buf, sizeof(buf), "** Line %ld Col %ld Offset %ld(0x%lx) Ascii %d(0%o/0x%X) **", bw->cursor->line + 1, piscol(bw->cursor) + 1, bw->cursor->byte, bw->cursor->byte, 255 & c, 255 & c, 255 & c); + snprintf(buf, sizeof(buf), "** 行數 %ld 列數 %ld 檔案大小 %ld(0x%lx) Ascii碼 %d(0%o/0x%X) **", bw->cursor->line + 1, piscol(bw->cursor) + 1, bw->cursor->byte, bw->cursor->byte, 255 & c, 255 & c, 255 & c); msgnw(bw->parent, buf); return 0; } diff -ruN joe-2.9.8/cmd.c zh-joe-2.9.8/cmd.c --- joe-2.9.8/cmd.c Mon Mar 24 17:19:09 2003 +++ zh-joe-2.9.8/cmd.c Thu Nov 3 22:57:58 2005 @@ -206,7 +206,7 @@ goto skip; if ((maint->curwin->watom->what & TYPETW) && bw->b->rdonly && (cmd->flag & EMOD)) { - msgnw(bw->parent, "Read only"); + msgnw(bw->parent, "唯讀"); if (beep) ttputc(7); goto skip; @@ -409,7 +409,7 @@ vsrm(s); /* allocated in pw.c::rtnpw() */ if (!cmd) - msgnw(bw->parent, "No such command"); + msgnw(bw->parent, "沒有這項指令"); else { mac = mkmacro(MAXINT, 0, 0, cmd); ret = exmacro(mac, 1); diff -ruN joe-2.9.8/joerc.in zh-joe-2.9.8/joerc.in --- joe-2.9.8/joerc.in Tue Dec 11 00:48:54 2001 +++ zh-joe-2.9.8/joerc.in Thu Nov 3 22:57:59 2005 @@ -24,7 +24,7 @@ -marking Text between ^KB and cursor is highlighted (use with -lightoff) - -asis Characters 128 - 255 shown as-is +-asis Characters 128 - 255 shown as-is -force Force final newline when files are saved @@ -101,7 +101,7 @@ \f Blink -lmsg \i%k%T%W%I%X %n %m%R %M --rmsg %S Row %r Col %c %t Ctrl-K H for help +-rmsg %S 行數 %r 列數 %c %t Ctrl-K H 線上輔助 SECOND SECTION: File name dependant local option settings: @@ -177,73 +177,75 @@ Use \f to turn on/off flash {Basic -\i Help Screen turn off with ^KH more help with ESC . (^[.) \i -\i \i\uCURSOR\u \uGO TO\u \uBLOCK\u \uDELETE\u \uMISC\u \uEXIT\u \i \i -\i \i^B left ^F right ^U prev. screen ^KB begin ^D char. ^KJ reformat ^KX save \i \i -\i \i^P up ^N down ^V next screen ^KK end ^Y line ^T options ^C abort \i \i -\i \i^Z previous word ^A beg. of line ^KM move ^W >word ^R refresh ^KZ shell \i \i -\i \i^X next word ^E end of line ^KC copy ^O word< ^@ insert \uFILE\u \i \i -\i \i\uSEARCH\u ^KU top of file ^KW file ^J >line \uSPELL\u ^KE edit \i \i -\i \i^KF find text ^KV end of file ^KY delete ^_ undo ^[N word ^KR insert\i \i -\i \i^L find next ^KL to line No. ^K/ filter ^^ redo ^[L file ^KD save \i \i +\i 線上輔助視窗 ^KH 關閉輔助視窗 ESC . 開啟更多輔助視窗 (^[.) \i +\i \i\u游 標\u \u移 動\u \u區 塊\u \u刪 除\u \u雜項\u \u離開\u \i \i +\i \i^B 往左 ^F 往右 ^U 上一個視窗 ^KB 起始 ^D 字元 ^KJ 重新排列 ^KX 存檔 \i \i +\i \i^P 往上 ^N 往下 ^V 下一個視窗 ^KK 結束 ^Y 整行 ^T 設定選項 ^C 放棄 \i \i +\i \i^Z 前一個字 ^A 單行的最前面 ^KM 移動 ^W >單字 ^R 螢幕更新 ^KZ SHELL \i \i +\i \i^X 下一個字 ^E 單行的最後面 ^KC 拷貝 ^O 單字< ^@ 插入空白 \u檔案\u \i \i +\i \i\u搜 尋\u ^KU 檔案最前面 ^KW 存檔 ^J >行尾 \u拼 字\u ^KE 編輯 \i \i +\i \i^KF 搜尋字串 ^KV 檔案最後面 ^KY 刪除 ^_ 復原 ^[N 字 ^KR 插入 \i \i +\i \i^L 下一字串 ^KL 跳往第幾行 ^K/ 過濾 ^^ 不復原 ^[L 檔案 ^KD 存檔 \i \i } {Windows -\i Help Screen turn off with ^KH prev. screen ^[, next screen ^[. \i -\i \i^KO Split the window in half ^KE Load file into window \i \i -\i \i^KG Make current window bigger ^KT Make current window smaller \i \i -\i \i^KN Go to the window below ^KP Go to the window above \i \i -\i \i^C Eliminate the current window ^KI Show all windows / Show one window\i \i +\i 線上輔助視窗 ^KH 關閉輔助視窗 前一頁輔助視窗 ^[, 下一頁輔助視窗^[. \i +\i \i^KO 分割視窗為二 ^KE 載入檔案進入游標所在視窗 \i \i +\i \i^KG 放大游標所在視窗 ^KT 縮小游標所在視窗 \i \i +\i \i^KN 跳往下一個視窗 ^KP 跳往前一個視窗 \i \i +\i \i^C 消除游標所在視窗 ^KI 顯示所有視窗 /顯示游標所在視窗 \i \i } {Advanced -\i Help Screen turn off with ^KH prev. screen ^[, next screen ^[. \i -\i \i\uMACROS\u \uMISC\u \uSCROLL\u \uSHELL\u \uGOTO\u \uI-SEARCH\u \i \i -\i \i^K[ 0-9 Record ^K SPACE status ^[W Up ^K' Window ^[B To ^KB ^[R Backwards\i \i -\i \i^K] Stop ^K\\ Repeat ^[Z Down ^[! Command ^[K To ^KK ^[S Forwards \i \i -\i \i^K 0-9 Play ^[M Math ^K< Left \uQUOTE\u \uDELETE\u \uBOOKMARKS\u \i \i -\i \i^K? Query ^KA Center line ^K> Right ` Ctrl- ^[Y yank ^[ 0-9 Goto \i \i -\i \i^[D Dump ^[H Message ^\\ Meta- ^[O line< ^[^[ Set \i \i +\i 線上輔助視窗 ^KH 關閉輔助視窗 前一頁輔助視窗 ^[, 下一頁輔助視窗 ^[. \i +\i \i\u巨 集\u \u雜項\u \u捲 軸\u \uSHELL\u \u移動\u \u即時搜尋\u \i \i +\i \i^K[ 0-9 記錄 ^K SPACE 狀態^[W 往上 ^K' 視窗模式 ^[B 移往 ^KB 處 ^[R 往後搜尋\i \i +\i \i^K] 停止 ^K\\ 重覆命令 ^[Z 往下 ^[! 命令模式 ^[K 移往 ^KK 處 ^[S 往前搜尋\i \i +\i \i^K 0-9 啟動 ^[M 數學 ^K< 往左 \u引 用\u \u刪 除\u \u書 籤\u \i \i +\i \i^K? 查詢 ^KA 中間對齊 ^K> 往右 ` 控制字元 ^[Y 下拉一行 ^[ 0-9 移動 \i \i +\i \i^[D 傾印 ^[H 訊息 ^\\ Meta- ^[O 刪前面一行 ^[^[ 設定 \i \i } {Programs -\i Help Screen turn off with ^KH prev. screen ^[, next screen ^[. \i -\i \i\uGOTO\u \uINDENT\u \uCOMPILING\u \i \i -\i \i^G Matching ( [ { ^K, less ^[C Compile and parse errors \i \i -\i \i^K- Previous place ^K. more ^[E Parse errors \i \i -\i \i^K= Next place ^[= To next error \i \i -\i \i^K; Tags file search ^[- To prev. error \i \i +\i 線上輔助視窗 ^KH 關閉輔助視窗 前一頁輔助視窗 ^[, 下一頁輔助視窗 ^[. \i +\i \i\u移動\u \u分 割\u \u編 譯\u \i \i +\i \i^G 成對搜尋 ( [ { ^K, 區塊左移 ^[C 編譯並列出錯誤 \i \i +\i \i^K- 前一個游標位置 ^K. 區塊右移 ^[E 列出錯誤 \i \i +\i \i^K= 下一個游標位置 ^[= 跳至下一個錯誤 \i \i +\i \i^K; 標籤檔搜尋 ^[- 回到上一個錯誤 \i \i } {Search -\i Help Screen turn off with ^KH prev. screen ^[, next screen ^[. \i -\i \iSpecial search sequences: \i \i -\i \i \\^ \\$ matches beg./end of line \\? match any single char \i \i -\i \i \\< \\> matches beg./end of word \\* match 0 or more chars \i \i -\i \i \\c matches balanced C expression \\\\ matches a \\ \i \i -\i \i \\[..] matches one of a set \\n matches a newline \i \i -\i \i \\+ matches 0 or more of the character which follows the \\+ \i \i -\i \iSpecial replace sequences: \i \i -\i \i \\& replaced with text which matched search string \i \i -\i \i \\0 - 9 replaced with text which matched Nth \\*, \\?, \\c, \\+, or \\[..] \i \i -\i \i \\\\ replaced with \\ \\n replaced with newline \i \i +\i 線上輔助視窗 ^KH 關閉輔助視窗 前一頁輔助視窗 ^[, 下一頁輔助視窗 ^[. \i +\i \i\u特殊搜尋條件\u \i \i +\i \i \\^ \\$ 位於行首/尾的符合字串 \\? 代替任何一個字元 \i \i +\i \i \\< \\> 位於字首/尾的符合字串 \\* 代替任意字元 \i \i +\i \i \\c 符合 C 語言格式的表示示字串 \\\\ 找尋 \"\\"\" \i \i +\i \i \\[..] 符合所指定集合中的任一字串 \\n 代表一個換行符號 \i \i +\i \i \\+ 符合一個或是多個以上附加於 \"+\" 號後面指定條件的字串 \i \i +\i \i\u特殊取代條件\u \i \i +\i \i \\& 直接以替代字元取代找尋到的字串(不加詢問) \i \i +\i \i \\0 - 9 直接以替代字元取代第 n 個字串 \\*, \\?, \\c, \\+, or \\[..] \i \i +\i \i \\\\ 以 \"\\\"來取代 \\n 以換行符號來取代 \i \i } {Names -\i Help Screen turn off with ^KH prev. screen ^[, next screen ^[. \i -\i \i Hit TAB at file name prompts to generate menu of file names \i \i -\i \i Or use up/down keys to access history of previously entered names \i \i -\i \i Special file names: \i \i -\i \i !command Pipe in/out of a shell command \i \i -\i \i >>filename Append to a file \i \i -\i \i - Read/Write to/from standard I/O \i \i -\i \i filename,START,SIZE Read/Write a part of a file/device \i \i -\i \i Give START/SIZE in decimal (255), octal (0377) or hex (0xFF) \i \i +\i 線上輔助視窗 ^KH 關閉輔助視窗 前一頁輔助視窗 ^[, 下一頁輔助視窗 ^[. \i +\i \i 在輸入檔案名稱的提示視窗中,按下 TAB 鍵可以產生一個您目前所在目錄下的所有 \i \i +\i \i 檔案名字的列表,或是使用上下鍵來使用以前用過的檔案名稱. \i \i +\i \i 特殊的檔案名稱: \i \i +\i \i !command 引入一個 shell 底下的命令 \i \i +\i \i >>filename 把現有檔息附加到另一檔案中 \i \i +\i \i - 從標準的 I/O 設備中讀入/寫出 \i \i +\i \i filename,START,SIZE 從一個檔案/設備中讀入/寫出部份資料 \i \i +\i \i 給定檔案開始的位置/檔案大小 以十進位(255), 八位位(0377), 十六進進(0xFF) \i \i } {Joe -\i Help Screen turn off with ^KH prev. screen ^[, \i -\i \i Send bug reports to: Marek 'Marx' Grac (xgrac@fi.muni.cz) \i \i +\i 線上輔助視窗 ^KH 關閉輔助視窗 ^[, 前一頁輔助視窗 \i +\i \i [***JOE 2.9.8 中文版***] [** 中文化:國立交通大學 應用數學系 86級 賴有得 **]\i \i +\i \i 有任何問題請 email 至 u8222034@cc.nctu.edu.tw 或 u8222034@math.nctu.edu.tw \i \i +\i \i 英文版有任何問題請 Send bug reports to: Marek 'Marx' Grac (xgrac@fi.muni.cz)\i \i } FOURTH SECTION: Key bindings: @@ -308,6 +310,7 @@ :windows Bindings common to all windows type ^@ TO � Type a character abort ^C Abort window +abort .k4 abort ^K Q abort ^K ^Q abort ^K q @@ -432,7 +435,7 @@ Standard JOE user interface quote8 ^\ Enter Meta chars -quote ` Enter Ctrl chars +quote .k; Enter Ctrl chars backs ^? Backspace backs ^H diff -ruN joe-2.9.8/macro.c zh-joe-2.9.8/macro.c --- joe-2.9.8/macro.c Thu Mar 6 15:24:28 2003 +++ zh-joe-2.9.8/macro.c Thu Nov 3 22:57:58 2005 @@ -483,7 +483,7 @@ { if (c >= '0' && c <= '9') return dorecord(bw, c, NULL, NULL); - else if (mkqw(bw->parent, sc("Macro to record (0-9 or ^C to abort): "), dorecord, NULL, NULL, NULL)) + else if (mkqw(bw->parent, sc("錄製巨集 (0-9 或 ^C 中斷): "), dorecord, NULL, NULL, NULL)) return 0; else return -1; @@ -554,7 +554,7 @@ { if (c >= '0' && c <= '9') return doplay(bw, c, NULL, NULL); - else if (mkqwna(bw->parent, sc("Play-"), doplay, NULL, NULL, NULL)) + else if (mkqwna(bw->parent, sc("執行-"), doplay, NULL, NULL, NULL)) return 0; else return -1; @@ -581,7 +581,7 @@ int uarg(BW *bw) { - if (wmkpw(bw->parent, "No. times to repeat next command (^C to abort): ", NULL, doarg, NULL, NULL, utypebw, NULL, NULL)) + if (wmkpw(bw->parent, "下一個指令重複的次數為 (^C 中斷): ", NULL, doarg, NULL, NULL, utypebw, NULL, NULL)) return 0; else return -1; @@ -620,7 +620,7 @@ *notify = 1; return 0; } - snprintf(msgbuf, JOE_MSGBUFSIZE, "Repeat %s%d", negarg ? "-" : "", unaarg); + snprintf(msgbuf, JOE_MSGBUFSIZE, "重複 %s%d", negarg ? "-" : "", unaarg); if (mkqwna(bw->parent, sz(msgbuf), douarg, NULL, NULL, notify)) return 0; else @@ -633,7 +633,7 @@ negarg = 0; if ((c >= '0' && c <= '9') || c == '-') return douarg(bw, c, NULL, NULL); - else if (mkqwna(bw->parent, sc("Repeat"), douarg, NULL, NULL, NULL)) + else if (mkqwna(bw->parent, sc("重複"), douarg, NULL, NULL, NULL)) return 0; else return -1; diff -ruN joe-2.9.8/main.c zh-joe-2.9.8/main.c --- joe-2.9.8/main.c Mon May 5 15:14:25 2003 +++ zh-joe-2.9.8/main.c Thu Nov 3 22:57:59 2005 @@ -207,7 +207,7 @@ #ifndef __MSDOS__ if (!(cap = getcap(NULL, 9600, NULL, NULL))) { - fprintf(stderr, "Couldn't load termcap/terminfo entry\n"); + fprintf(stderr, "無法載入 termcap/terminfo 項目\n"); return 1; } #endif @@ -222,7 +222,7 @@ if (c == 1) { char buf[8]; - fprintf(stderr, "There were errors in '%s'. Use it anyway?", s); + fprintf(stderr, "在 '%s' 中有錯誤. 要使用它嗎?", s); fflush(stderr); fgets(buf, 8, stdin); if (buf[0] == 'y' || buf[0] == 'Y') @@ -239,7 +239,7 @@ if (c == 1) { char buf[8]; - fprintf(stderr, "There were errors in '%s'. Use it anyway?", s); + fprintf(stderr, "在 '%s' 中有錯誤. 要使用它嗎?", s); fflush(stderr); fgets(buf, 8, stdin); if (buf[0] == 'y' || buf[0] == 'Y') @@ -259,7 +259,7 @@ if (c == 1) { char buf[8]; - fprintf(stderr, "There were errors in '%s'. Use it anyway?", s); + fprintf(stderr, "在 '%s' 中有錯誤. 要使用它嗎?", s); fflush(stderr); fgets(buf, 8, stdin); if (buf[0] == 'y' || buf[0] == 'Y') @@ -277,7 +277,7 @@ if (c == 1) { char buf[8]; - fprintf(stderr, "There were errors in '%s'. Use it anyway?", s); + fprintf(stderr, "在 '%s' 中有錯誤. 要使用它嗎?", s); fflush(stderr); fgets(buf, 8, stdin); if (buf[0] == 'y' || buf[0] == 'Y') @@ -285,7 +285,7 @@ } #endif - fprintf(stderr, "Couldn't open '%s'\n", s); + fprintf(stderr, "無法開啟 '%s'\n", s); return 1; donerc: @@ -295,7 +295,7 @@ if (argv[c][1]) switch (glopt(argv[c] + 1, argv[c + 1], NULL, 1)) { case 0: - fprintf(stderr, "Unknown option '%s'\n", argv[c]); + fprintf(stderr, "不知名的選項 '%s'\n", argv[c]); break; case 1: break; diff -ruN joe-2.9.8/menu.c zh-joe-2.9.8/menu.c --- joe-2.9.8/menu.c Thu Mar 6 15:24:28 2003 +++ zh-joe-2.9.8/menu.c Thu Nov 3 22:57:57 2005 @@ -32,10 +32,13 @@ for (x = 0; x != m->perline && m->list[x + m->top]; ++x) { int atr, z; + atr = 0; +/* if (x + m->top == m->cursor) atr = INVERSE; else atr = 0; +*/ if (col == m->w) break; for (z = 0; m->list[x + m->top][z]; ++z) { diff -ruN joe-2.9.8/rc.c zh-joe-2.9.8/rc.c --- joe-2.9.8/rc.c Mon Mar 24 17:19:09 2003 +++ zh-joe-2.9.8/rc.c Thu Nov 3 22:57:57 2005 @@ -100,7 +100,7 @@ 1, /* indent step */ "main", /* *context */ "\\i%n %m %M", /* *lmsg */ - " %S Ctrl-K H for help", /* *rmsg */ + " %S Ctrl-K H 線上輔助", /* *rmsg */ 0, /* line numbers */ 0, /* read only */ 0, /* french spacing */ @@ -149,33 +149,33 @@ int low; /* Low limit for numeric options */ int high; /* High limit for numeric options */ } glopts[] = { - { "overwrite", 4, NULL, (char *) &fdefault.overtype, "Overtype mode", "Insert mode", "T Overtype " }, - { "autoindent", 4, NULL, (char *) &fdefault.autoindent, "Autoindent enabled", "Autindent disabled", "I Autoindent " }, - { "wordwrap", 4, NULL, (char *) &fdefault.wordwrap, "Wordwrap enabled", "Wordwrap disabled", "Word wrap " }, - { "tab", 5, NULL, (char *) &fdefault.tab, "Tab width (%d): ", 0, "D Tab width ", 0, 1, 64 }, - { "lmargin", 7, NULL, (char *) &fdefault.lmargin, "Left margin (%d): ", 0, "Left margin ", 0, 0, 63 }, - { "rmargin", 7, NULL, (char *) &fdefault.rmargin, "Right margin (%d): ", 0, "Right margin ", 0, 7, 255 }, - { "square", 0, &square, NULL, "Rectangle mode", "Text-stream mode", "X Rectangle mode " }, - { "indentc", 5, NULL, (char *) &fdefault.indentc, "Indent char %d (SPACE=32, TAB=9, ^C to abort): ", 0, " Indent char ", 0, 0, 255 }, - { "istep", 5, NULL, (char *) &fdefault.istep, "Indent step %d (^C to abort): ", 0, " Indent step ", 0, 1, 64 }, - { "french", 4, NULL, (char *) &fdefault.french, "One space after periods for paragraph reformat", "Two spaces after periods for paragraph reformat", " french spacing " }, - { "spaces", 4, NULL, (char *) &fdefault.spaces, "Inserting spaces when tab key is hit", "Inserting tabs when tab key is hit", " no tabs " }, - { "mid", 0, &mid, NULL, "Cursor will be recentered on scrolls", "Cursor will not be recentered on scroll", "Center on scroll " }, - { "crlf", 4, NULL, (char *) &fdefault.crlf, "CR-LF is line terminator", "LF is line terminator", "Z CR-LF (MS-DOS) " }, - { "linums", 4, NULL, (char *) &fdefault.linums, "Line numbers enabled", "Line numbers disabled", "N Line numbers " }, - { "marking", 0, &marking, NULL, "Anchored block marking on", "Anchored block marking off", "Marking " }, - { "asis", 0, &dspasis, NULL, "Characters above 127 shown as-is", "Characters above 127 shown in inverse", "Meta chars as-is " }, - { "force", 0, &force, NULL, "Last line forced to have NL when file saved", "Last line not forced to have NL", "Force last NL " }, - { "nobackups", 0, &nobackups, NULL, "Backup files will not be made", "Backup files will be made", " Disable backups " }, - { "lightoff", 0, &lightoff, NULL, "Highlighting turned off after block operations", "Highlighting not turned off after block operations", "Auto unmark " }, - { "exask", 0, &exask, NULL, "Prompt for filename in save & exit command", "Don't prompt for filename in save & exit command", "Exit ask " }, - { "beep", 0, &beep, NULL, "Warning bell enabled", "Warning bell disabled", "Beeps " }, - { "nosta", 0, &staen, NULL, "Top-most status line disabled", "Top-most status line enabled", " Disable status line " }, - { "keepup", 0, &keepup, NULL, "Status line updated constantly", "Status line updated once/sec", " Fast status line " }, - { "pg", 1, &pgamnt, NULL, "Lines to keep for PgUp/PgDn or -1 for 1/2 window (%d): ", 0, " No. PgUp/PgDn lines ", 0, -1, 64 }, - { "csmode", 0, &csmode, NULL, "Start search after a search repeats previous search", "Start search always starts a new search", "Continued search " }, - { "rdonly", 4, NULL, (char *) &fdefault.readonly, "Read only", "Full editing", "O Read only " }, - { "backpath", 2, (int *) &backpath, NULL, "Backup files stored in (%s): ", 0, "Path to backup files " }, + { "overwrite", 4, NULL, (char *) &fdefault.overtype, "覆寫模式", "插入模式", "T [**輸入模式的設定(overwrite)**] " }, + { "autoindent", 4, NULL, (char *) &fdefault.autoindent, "自動縮排 [開啟]", "自動縮排 [關閉]", "I [**自動縮排的設定(autoindent)**] " }, + { "wordwrap", 4, NULL, (char *) &fdefault.wordwrap, "自動換行 [開啟]", "自動換行 [關閉]", "* [**自動換行的設定(wordwrap)**] " }, + { "tab", 5, NULL, (char *) &fdefault.tab, "Tab 寬度 (%d): ", 0, "D [**Tab寬長的設定(tab)**] ", 0, 1, 64 }, + { "lmargin", 7, NULL, (char *) &fdefault.lmargin, "設定左邊界 (%d): ", 0, "L [**設定左邊界(lmargin)**] ", 0, 0, 63 }, + { "rmargin", 7, NULL, (char *) &fdefault.rmargin, "設定右邊界 (%d): ", 0, "* [**設定右邊界(rmargin)**] ", 0, 7, 255 }, + { "square", 0, &square, NULL, "矩形選取", "行列選取", "X [**選取區塊模式(square)**] " }, + { "indentc", 5, NULL, (char *) &fdefault.indentc, "設定縮排字元 %d (SPACE=32, TAB=9, ^C 中斷): ", 0, "* [**縮排長度的設定(indentc)**] ", 0, 0, 255 }, + { "istep", 5, NULL, (char *) &fdefault.istep, "設定縮排段落 %d (^C 中斷): ", 0, "* [**設定縮排的段落(istep)**] ", 0, 1, 64 }, + { "french", 4, NULL, (char *) &fdefault.french, "段落重排後多 1 個空白", "段落重排後多 2 個空白", "* [**設定法國式段落排列(french)**] " }, + { "spaces", 4, NULL, (char *) &fdefault.spaces, "設定按下 [TAB] 後插入 [空白] 字元 ", "設定按下 [TAB] 後插入 [TAB ] 字元 ", "* [**設定 TAB 鍵用途(spaces)**] " }, + { "mid", 0, &mid, NULL, "螢幕捲動後游標自動向中間對齊功\能 [開啟", "螢幕捲動後游標自動向中間對齊功\能 [關閉]", "* [**游標向中對齊(mid)**] " }, + { "crlf", 4, NULL, (char *) &fdefault.crlf, "行的結尾是 CR-LF(DOS)", "行的結尾是 LF(UNIX)", "Z [*行尾字元的設定(crlf)*] " }, + { "linums", 4, NULL, (char *) &fdefault.linums, "顯示行數功\能 [開啟]", "顯示行數功\能 [關閉]", "N [***行數顯示與否(linums)***] " }, + { "marking", 0, &marking, NULL, "反白區塊隨游標移動功\能 [開啟]", "反白區塊隨游標移動功\能 [關閉]", "* [**區塊反白設定(marking)**] " }, + { "asis", 0, &dspasis, NULL, "顯示 ASCII 127 以上的字元", "以相反方式來顯示 ASCII 127 以上的字元", "* [**中文顯示方式(asis)**] " }, + { "force", 0, &force, NULL, "存檔後,檔尾自動加上一行空白行功\能 [開啟]", "存檔後,檔尾自動加上一行空白行功\能 [關閉]", "* [**存檔時檔尾的設定(force)**] " }, + { "nobackups", 0, &nobackups, NULL, "自動產生備份檔功\能 [關閉]", "自動產生備份檔功\能 [開啟]", "* [**自動備份的設定(nobackups)**] " }, + { "lightoff", 0, &lightoff, NULL, "使用區塊功\能後,自動關閉高亮度區塊功\能 [關閉]", "使用區塊功\能後,自動關閉高亮度區塊功\能 [開啟]", "* [**區塊亮度設定**] " }, + { "exask", 0, &exask, NULL, "離開時是否問要存的檔名 [是的]", "離開時是否問要存的檔名 [不要]", "* [**離開時詢問要存檔的檔名(exask)** " }, + { "beep", 0, &beep, NULL, "錯誤時發出\"嗶\"的聲音功\能 [開啟]", "錯誤時發出\"嗶\"的聲音功\能 [關閉]", "* [**錯誤時,是否發\"嗶\"聲(beep)**] " }, + { "nosta", 0, &staen, NULL, "開啟最上面的狀態列功\能[關閉]", "開啟最上面的狀態列功\能[開啟]", "* [**狀態列開關(nosta)**] " }, + { "keepup", 0, &keepup, NULL, "狀態列固定時間更新資料一次", "狀態列每秒更新資料一次", "* [**狀態列資料更新(keepup)**] " }, + { "pg", 1, &pgamnt, NULL, "按下 [PgUp]/[PgDn] 時所保留的行數 或 -1(保留半個視窗) (%d): ", 0, "* [**按PaUp/PaDn 時的行數(pg)**] ", 0, -1, 64 }, + { "csmode", 0, &csmode, NULL, "按下 CTRL + F 以前面所輸入的字串開始搜尋", "按下 CTRL + F 都以新的字串進行搜尋", "* [**搜尋字元的設定(csmode)**] " }, + { "rdonly", 4, NULL, (char *) &fdefault.readonly, "唯讀模式", "可編輯模式", "O [**唯讀模式設定(rdonly)**] " }, + { "backpath", 2, (int *) &backpath, NULL, "備份檔儲存路徑(%s): ", 0, "* [**備份檔案路徑(backpath)**] " }, { "nonotice", 0, &nonotice, NULL, 0, 0, 0 }, { "noxon", 0, &noxon, NULL, 0, 0, 0 }, { "orphan", 0, &orphan, NULL, 0, 0, 0 }, @@ -387,7 +387,7 @@ } else if (v >= glopts[x].low && v <= glopts[x].high) *glopts[x].set = v; else { - msgnw(bw->parent, "Value out of range"); + msgnw(bw->parent, "數值超過範圍"); ret = -1; } break; @@ -403,7 +403,7 @@ } else if (v >= glopts[x].low && v <= glopts[x].high) *(int *) ((char *) &bw->o + glopts[x].ofst) = v; else { - msgnw(bw->parent, "Value out of range"); + msgnw(bw->parent, "數值超過範圍"); ret = -1; } break; @@ -415,7 +415,7 @@ } else if (v >= glopts[x].low && v <= glopts[x].high) *(int *) ((char *) &bw->o + glopts[x].ofst) = v; else { - msgnw(bw->parent, "Value out of range"); + msgnw(bw->parent, "數值超過範圍"); ret = -1; } break; @@ -530,7 +530,7 @@ s[x] = (char *) joe_malloc(40); /* FIXME: why 40 ??? */ switch (glopts[x].type) { case 0: - snprintf(s[x], OPT_BUF_SIZE, "%s%s", glopts[x].menu, *glopts[x].set ? "ON" : "OFF"); + snprintf(s[x], OPT_BUF_SIZE, "%s%s", glopts[x].menu, *glopts[x].set ? "開" : "關"); break; case 1: snprintf(s[x], OPT_BUF_SIZE, "%s%d", glopts[x].menu, *glopts[x].set); @@ -539,7 +539,7 @@ strcpy(s[x], glopts[x].menu); break; case 4: - snprintf(s[x], OPT_BUF_SIZE, "%s%s", glopts[x].menu, *(int *) ((char *) &bw->o + glopts[x].ofst) ? "ON" : "OFF"); + snprintf(s[x], OPT_BUF_SIZE, "%s%s", glopts[x].menu, *(int *) ((char *) &bw->o + glopts[x].ofst) ? "開" : "關"); break; case 5: snprintf(s[x], OPT_BUF_SIZE, "%s%d", glopts[x].menu, *(int *) ((char *) &bw->o + glopts[x].ofst)); @@ -582,7 +582,7 @@ if (!fd) return -1; /* Return if we couldn't open the rc file */ - fprintf(stderr, "Processing '%s'...", name); + fprintf(stderr, "'%s'處理中...", name); fflush(stderr); while (fgets(buf, sizeof(buf), fd)) { @@ -621,7 +621,7 @@ buf[x] = 0; if (!glopt(opt, arg, o, 2)) { err = 1; - fprintf(stderr, "\n%s %d: Unknown option %s", name, line, opt); + fprintf(stderr, "\n%s %d: 未定義的設定 %s", name, line, opt); } } break; @@ -631,7 +631,7 @@ /* do nothing */; if (buf[0] != '}') { err = 1; - fprintf(stderr, "\n%s %d: End of joerc file occured before end of help text\n", name, line); + fprintf(stderr, "\n%s %d: 因為 joerc 內容中的 help(說明文字)有不正常的結束,所以結束 joe 的讀取\n", name, line); break; } } @@ -660,11 +660,11 @@ addcmd(buf + x, m); else { err = 1; - fprintf(stderr, "\n%s %d: macro missing from :def", name, line); + fprintf(stderr, "\n%s %d: 找不到巨集 :def", name, line); } } else { err = 1; - fprintf(stderr, "\n%s %d: command name missing from :def", name, line); + fprintf(stderr, "\n%s %d: 找不到指令 :def", name, line); } } else if (!strcmp(buf + 1, "inherit")) if (context) { @@ -675,11 +675,11 @@ kcpy(context, kmap_getcontext(buf + x)); else { err = 1; - fprintf(stderr, "\n%s %d: context name missing from :inherit", name, line); + fprintf(stderr, "\n%s %d: 找不到內容 :inherit", name, line); } } else { err = 1; - fprintf(stderr, "\n%s %d: No context selected for :inherit", name, line); + fprintf(stderr, "\n%s %d: 沒有選定任何的內容 :inherit", name, line); } else if (!strcmp(buf + 1, "include")) { for (buf[x] = c; isblank(buf[x]); ++x) ; for (c = x; !isspace_eof(buf[c]); ++c) ; @@ -690,7 +690,7 @@ err = 1; break; case -1: - fprintf(stderr, "\n%s %d: Couldn't open %s", name, line, buf + x); + fprintf(stderr, "\n%s %d: 無法開啟 %s", name, line, buf + x); err = 1; break; } @@ -698,7 +698,7 @@ o = 0; } else { err = 1; - fprintf(stderr, "\n%s %d: :include missing file name", name, line); + fprintf(stderr, "\n%s %d: : 無法找到相關 include 檔", name, line); } } else if (!strcmp(buf + 1, "delete")) if (context) { @@ -711,12 +711,12 @@ kdel(context, buf + x); } else { err = 1; - fprintf(stderr, "\n%s %d: No context selected for :delete", name, line); + fprintf(stderr, "\n%s %d: 沒有選定任何的內容 :delete", name, line); } else context = kmap_getcontext(buf + 1); else { err = 1; - fprintf(stderr, "\n%s %d: Invalid context name", name, line); + fprintf(stderr, "\n%s %d: 不正確的名稱", name, line); } } break; @@ -727,7 +727,7 @@ if (!context) { err = 1; - fprintf(stderr, "\n%s %d: No context selected for macro to key-sequence binding", name, line); + fprintf(stderr, "\n%s %d: 未選定任何內容給巨集使用", name, line); break; } @@ -736,7 +736,7 @@ m = mparse(m, buf, &x); if (x == -1) { err = 1; - fprintf(stderr, "\n%s %d: Unknown command in macro", name, line); + fprintf(stderr, "\n%s %d: 巨集內有未知的的指令", name, line); break; } else if (x == -2) { fgets(buf, 1024, fd); @@ -751,7 +751,7 @@ /* Add binding to context */ if (kadd(cap, context, buf + x, m) == -1) { - fprintf(stderr, "\n%s %d: Bad key sequence '%s'", name, line, buf + x); + fprintf(stderr, "\n%s %d: 錯誤的按鍵順序設定 '%s'", name, line, buf + x); err = 1; } } @@ -762,9 +762,9 @@ /* Print proper ending string */ if (err) - fprintf(stderr, "\ndone\n"); + fprintf(stderr, "\n完成\n"); else - fprintf(stderr, "done\n"); + fprintf(stderr, "完成\n"); return err; /* 0 for success, 1 for syntax error */ } diff -ruN joe-2.9.8/rjoerc.in zh-joe-2.9.8/rjoerc.in --- joe-2.9.8/rjoerc.in Mon Oct 29 22:39:52 2001 +++ zh-joe-2.9.8/rjoerc.in Thu Nov 3 22:57:59 2005 @@ -24,7 +24,7 @@ -marking Text between ^KB and cursor is highlighted (use with -lightoff) - -asis Characters 128 - 255 shown as-is +-asis Characters 128 - 255 shown as-is -force Force final newline when files are saved @@ -414,7 +414,7 @@ Standard JOE user interface quote8 ^\ Enter Meta chars -quote ` Enter Ctrl chars +quote .k; Enter Ctrl chars backs ^? Backspace backs ^H diff -ruN joe-2.9.8/tab.c zh-joe-2.9.8/tab.c --- joe-2.9.8/tab.c Thu Mar 6 15:24:28 2003 +++ zh-joe-2.9.8/tab.c Thu Nov 3 22:57:59 2005 @@ -197,7 +197,7 @@ vsrm(e); tab->pattern = vsncpy(NULL, 0, sc("*")); if (treload(m, 0)) { - msgnw(m->parent, "Couldn't read directory "); + msgnw(m->parent, "無法讀取目錄"); vsrm(tab->pattern); tab->pattern = orgpattern; vsrm(tab->path); @@ -238,7 +238,7 @@ tab->pattern = vsncpy(NULL, 0, sc("*")); if (treload(m, 1)) { - msgnw(m->parent, "Couldn't read directory "); + msgnw(m->parent, "無法讀取目錄"); vsrm(tab->pattern); tab->pattern = orgpattern; vsrm(tab->path); diff -ruN joe-2.9.8/termcap.c zh-joe-2.9.8/termcap.c --- joe-2.9.8/termcap.c Thu Mar 6 15:24:28 2003 +++ zh-joe-2.9.8/termcap.c Thu Nov 3 22:57:57 2005 @@ -223,7 +223,7 @@ joe_free(cap); return 0; */ - fprintf(stderr, "Couldn't load termcap entry. Using ansi default\n"); + fprintf(stderr, "無法載入 termcap,使用 ansi 為內定值\n"); ti = 0; cap->tbuf = vsncpy(cap->tbuf, 0, sc(defentry)); goto checktc; diff -ruN joe-2.9.8/tty.c zh-joe-2.9.8/tty.c --- joe-2.9.8/tty.c Thu Mar 6 15:24:29 2003 +++ zh-joe-2.9.8/tty.c Thu Nov 3 22:57:59 2005 @@ -293,7 +293,7 @@ if (!termin) { if (idleout ? (!(termin = stdin) || !(termout = stdout)) : (!(termin = fopen("/dev/tty", "r")) || !(termout = fopen("/dev/tty", "w")))) { - fprintf(stderr, "Couldn\'t open /dev/tty\n"); + fprintf(stderr, "無法開啟 /dev/tty\n"); exit(1); } else { #ifdef SIGWINCH @@ -679,7 +679,7 @@ if (cmd) execl(s, s, "-c", cmd, NULL); else { - fprintf(stderr, "You are at the command shell. Type 'exit' to return\n"); + fprintf(stderr, "你已在命命列的狀態下,鍵入 'exit' 即可返回 joe\n"); execl(s, s, NULL); } _exit(0); @@ -694,7 +694,7 @@ #ifdef SIGTSTP omode = ttymode; ttclsn(); - fprintf(stderr, "You have suspended the program. Type 'fg' to return\n"); + fprintf(stderr, "你已經暫停目前這個 joe 程式,鍵入 'fg' 可以返回 joe。\n"); kill(0, SIGTSTP); if (ackkbd != -1) kill(kbdpid, SIGCONT); diff -ruN joe-2.9.8/tty.c.orig zh-joe-2.9.8/tty.c.orig --- joe-2.9.8/tty.c.orig Thu Jan 1 08:00:00 1970 +++ zh-joe-2.9.8/tty.c.orig Thu Nov 3 22:57:58 2005 @@ -0,0 +1,1018 @@ +/* + * UNIX Tty and Process interface + * Copyright + * (C) 1992 Joseph H. Allen + * + * This file is part of JOE (Joe's Own Editor) + */ +#include "config.h" +#include "types.h" + +#include +#ifdef HAVE_SYS_STAT_H +#include +#endif +#ifdef GWINSZ_IN_SYS_IOCTL +#ifdef HAVE_SYS_IOCTL_H +#include +#endif +#endif +#include +#ifdef HAVE_FCNTL_H +#include +#endif +#ifdef HAVE_SYS_WAIT_H +#include +#endif +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#include +#include +#include +#include + +int idleout = 1; + +#include "config.h" + +/* We use the defines in sys/ioctl to determine what type + * tty interface the system uses and what type of system + * we actually have. + */ +#ifdef HAVE_POSIX_TERMIOS +# include +# include +#else +# ifdef HAVE_SYSV_TERMIO +# include +# include +# else +# include +# endif +#endif + +#ifdef HAVE_SETITIMER +#ifdef HAVE_SYS_TIME_H +#include +#endif +#endif + +/* I'm not sure if SCO_UNIX and ISC have __svr4__ defined, but I think + they might */ +#ifdef M_SYS5 +#ifndef M_XENIX +#include +#include +#ifndef __svr4__ +#define __svr4__ 1 +#endif +#endif +#endif + +#ifdef ISC +#ifndef __svr4__ +#define __svr4__ 1 +#endif +#endif + +#ifdef __svr4__ +#include +#endif + +/* JOE include files */ + +#include "main.h" +#include "path.h" +#include "tty.h" +#include "utils.h" + +/** Aliased defines **/ + +/* O_NDELAY, O_NONBLOCK, and FNDELAY are all synonyms for placing a descriptor + * in non-blocking mode; we make whichever one we have look like O_NDELAY + */ +#ifndef O_NDELAY +#ifdef O_NONBLOCK +#define O_NDELAY O_NONBLOCK +#endif +#ifdef FNDELAY +#define O_NDELAY FNDELAY +#endif +#endif + +/* Some systems define this, some don't */ +#ifndef sigmask +#define sigmask(x) (1<<((x)-1)) +#endif + +/* Some BSDs don't have TILDE */ +#ifndef TILDE +#define TILDE 0 +#endif + +/* Global configuration variables */ + +int noxon = 0; /* Set if ^S/^Q processing should be disabled */ +int Baud = 0; /* Baud rate from joerc, cmd line or environment */ + +/* The terminal */ + +FILE *termin = NULL; +FILE *termout = NULL; + +/* Original state of tty */ + +#ifdef HAVE_POSIX_TERMIOS +struct termios oldterm; +#else /* HAVE_POSIX_TERMIOS */ +#ifdef HAVE_SYSV_TERMIO +static struct termio oldterm; +#else /* HAVE_SYSV_TERMIO */ +static struct sgttyb oarg; +static struct tchars otarg; +static struct ltchars oltarg; +#endif /* HAVE_SYSV_TERMIO */ +#endif /* HAVE_POSIX_TERMIOS */ + +/* Output buffer, index and size */ + +char *obuf = NULL; +int obufp = 0; +int obufsiz; + +/* The baud rate */ + +unsigned baud; /* Bits per second */ +unsigned long upc; /* Microseconds per character */ + +/* TTY Speed code to baud-rate conversion table (this is dumb- is it really + * too much to ask for them to just use an integer for the baud-rate?) + */ + +static int speeds[] = { + B50, 50, B75, 75, B110, 110, B134, 134, B150, 150, B200, 200, B300, + 300, B600, 600, + B1200, 1200, B1800, 1800, B2400, 2400, B4800, 4800, B9600, 9600 +#ifdef EXTA + , EXTA, 19200 +#endif +#ifdef EXTB + , EXTB, 38400 +#endif +#ifdef B19200 + , B19200, 19200 +#endif +#ifdef B38400 + , B38400, 38400 +#endif +}; + +/* Input buffer */ + +int have = 0; /* Set if we have pending input */ +static unsigned char havec; /* Character read in during pending input check */ +int leave = 0; /* When set, typeahead checking is disabled */ + +/* TTY mode flag. 1 for open, 0 for closed */ +static int ttymode = 0; + +/* Signal state flag. 1 for joe, 0 for normal */ +static int ttysig = 0; + +/* Stuff for shell windows */ + +static pid_t kbdpid; /* PID of kbd client */ +static int ackkbd = -1; /* Editor acks keyboard client to this */ + +static int mpxfd; /* Editor reads packets from this fd */ +static int mpxsfd; /* Clients send packets to this fd */ + +static int nmpx = 0; +static int accept = MAXINT; /* =MAXINT if we have last packet */ + /* FIXME: overloaded meaning of MAXINT */ + +struct packet { + MPX *who; + int size; + int ch; + char data[1024]; +} pack; + +MPX asyncs[NPROC]; + +/* Set signals for JOE */ +void sigjoe(void) +{ + if (ttysig) + return; + ttysig = 1; + joe_set_signal(SIGHUP, ttsig); + joe_set_signal(SIGTERM, ttsig); + joe_set_signal(SIGINT, SIG_IGN); + joe_set_signal(SIGPIPE, SIG_IGN); +} + +/* Restore signals for exiting */ +void signrm(void) +{ + if (!ttysig) + return; + ttysig = 0; + joe_set_signal(SIGHUP, SIG_DFL); + joe_set_signal(SIGTERM, SIG_DFL); + joe_set_signal(SIGINT, SIG_DFL); + joe_set_signal(SIGPIPE, SIG_DFL); +} + +/* Open terminal and set signals */ + +void ttopen(void) +{ + sigjoe(); + ttopnn(); +} + +/* Close terminal and restore signals */ + +void ttclose(void) +{ + ttclsn(); + signrm(); +} + +static int winched = 0; +#ifdef SIGWINCH +/* Window size interrupt handler */ +static RETSIGTYPE winchd(int unused) +{ + ++winched; + REINSTALL_SIGHANDLER(SIGWINCH, winchd); +} +#endif + +/* Second ticker */ + +int ticked = 0; +extern int dostaupd; +static RETSIGTYPE dotick(int unused) +{ + ticked = 1; + dostaupd = 1; +} + +void tickoff(void) +{ + alarm(0); +} + +void tickon(void) +{ + ticked = 0; + joe_set_signal(SIGALRM, dotick); + alarm(1); +} + +/* Open terminal */ + +void ttopnn(void) +{ + int x, bbaud; + +#ifdef HAVE_POSIX_TERMIOS + struct termios newterm; +#else +#ifdef HAVE_SYSV_TERMIO + struct termio newterm; +#else + struct sgttyb arg; + struct tchars targ; + struct ltchars ltarg; +#endif +#endif + + if (!termin) { + if (idleout ? (!(termin = stdin) || !(termout = stdout)) : (!(termin = fopen("/dev/tty", "r")) || !(termout = fopen("/dev/tty", "w")))) { + fprintf(stderr, "Couldn\'t open /dev/tty\n"); + exit(1); + } else { +#ifdef SIGWINCH + joe_set_signal(SIGWINCH, winchd); +#endif + tickon(); + } + } + + if (ttymode) + return; + ttymode = 1; + fflush(termout); + +#ifdef HAVE_POSIX_TERMIOS + tcgetattr(fileno(termin), &oldterm); + newterm = oldterm; + newterm.c_lflag = 0; + if (noxon) + newterm.c_iflag &= ~(ICRNL | IGNCR | INLCR | IXON | IXOFF); + else + newterm.c_iflag &= ~(ICRNL | IGNCR | INLCR); + newterm.c_oflag = 0; + newterm.c_cc[VMIN] = 1; + newterm.c_cc[VTIME] = 0; + tcsetattr(fileno(termin), TCSADRAIN, &newterm); + bbaud = cfgetospeed(&newterm); +#else +#ifdef HAVE_SYSV_TERMIO + ioctl(fileno(termin), TCGETA, &oldterm); + newterm = oldterm; + newterm.c_lflag = 0; + if (noxon) + newterm.c_iflag &= ~(ICRNL | IGNCR | INLCR | IXON | IXOFF); + else + newterm.c_iflag &= ~(ICRNL | IGNCR | INLCR); + newterm.c_oflag = 0; + newterm.c_cc[VMIN] = 1; + newterm.c_cc[VTIME] = 0; + ioctl(fileno(termin), TCSETAW, &newterm); + bbaud = (newterm.c_cflag & CBAUD); +#else + ioctl(fileno(termin), TIOCGETP, &arg); + ioctl(fileno(termin), TIOCGETC, &targ); + ioctl(fileno(termin), TIOCGLTC, <arg); + oarg = arg; + otarg = targ; + oltarg = ltarg; + arg.sg_flags = ((arg.sg_flags & ~(ECHO | CRMOD | XTABS | ALLDELAY | TILDE)) | CBREAK); + if (noxon) { + targ.t_startc = -1; + targ.t_stopc = -1; + } + targ.t_intrc = -1; + targ.t_quitc = -1; + targ.t_eofc = -1; + targ.t_brkc = -1; + ltarg.t_suspc = -1; + ltarg.t_dsuspc = -1; + ltarg.t_rprntc = -1; + ltarg.t_flushc = -1; + ltarg.t_werasc = -1; + ltarg.t_lnextc = -1; + ioctl(fileno(termin), TIOCSETN, &arg); + ioctl(fileno(termin), TIOCSETC, &targ); + ioctl(fileno(termin), TIOCSLTC, <arg); + bbaud = arg.sg_ospeed; +#endif +#endif + + baud = 9600; + upc = 0; + for (x = 0; x != 30; x += 2) + if (bbaud == speeds[x]) { + baud = speeds[x + 1]; + break; + } + if (Baud) + baud = Baud; + upc = DIVIDEND / baud; + if (obuf) + joe_free(obuf); + if (!(TIMES * upc)) + obufsiz = 4096; + else { + obufsiz = 1000000 / (TIMES * upc); + if (obufsiz > 4096) + obufsiz = 4096; + } + if (!obufsiz) + obufsiz = 1; + obuf = (char *) joe_malloc(obufsiz); +} + +/* Close terminal */ + +void ttclsn(void) +{ + int oleave; + + if (ttymode) + ttymode = 0; + else + return; + + oleave = leave; + leave = 1; + + ttflsh(); + +#ifdef HAVE_POSIX_TERMIOS + tcsetattr(fileno(termin), TCSADRAIN, &oldterm); +#else +#ifdef HAVE_SYSV_TERMIO + ioctl(fileno(termin), TCSETAW, &oldterm); +#else + ioctl(fileno(termin), TIOCSETN, &oarg); + ioctl(fileno(termin), TIOCSETC, &otarg); + ioctl(fileno(termin), TIOCSLTC, &oltarg); +#endif +#endif + + leave = oleave; +} + +/* Timer interrupt handler */ + +static int yep; +static RETSIGTYPE dosig(int unused) +{ + yep = 1; +} + +/* FLush output and check for typeahead */ + +#ifdef HAVE_SETITIMER +#ifdef SIG_SETMASK +static void maskit(void) +{ + sigset_t set; + + sigemptyset(&set); + sigaddset(&set, SIGALRM); + sigprocmask(SIG_SETMASK, &set, NULL); +} + +static void unmaskit(void) +{ + sigset_t set; + + sigemptyset(&set); + sigprocmask(SIG_SETMASK, &set, NULL); +} + +static void pauseit(void) +{ + sigset_t set; + + sigemptyset(&set); + sigsuspend(&set); +} + +#else +static void maskit(void) +{ + sigsetmask(sigmask(SIGALRM)); +} + +static void unmaskit(void) +{ + sigsetmask(0); +} + +static void pauseit(void) +{ + sigpause(0); +} + +#endif +#endif + +int ttflsh(void) +{ + /* Flush output */ + if (obufp) { + unsigned long usec = obufp * upc; /* No. usecs this write should take */ + +#ifdef HAVE_SETITIMER + if (usec >= 50000 && baud < 9600) { + struct itimerval a, b; + + a.it_value.tv_sec = usec / 1000000; + a.it_value.tv_usec = usec % 1000000; + a.it_interval.tv_usec = 0; + a.it_interval.tv_sec = 0; + alarm(0); + joe_set_signal(SIGALRM, dosig); + yep = 0; + maskit(); + setitimer(ITIMER_REAL, &a, &b); + joe_write(fileno(termout), obuf, obufp); + while (!yep) + pauseit(); + unmaskit(); + tickon(); + } else + joe_write(fileno(termout), obuf, obufp); + +#else + + joe_write(fileno(termout), obuf, obufp); + +#ifdef FIORDCHK + if (baud < 9600 && usec / 1000) + nap(usec / 1000); +#endif + +#endif + + obufp = 0; + } + + /* Ack previous packet */ + if (ackkbd != -1 && accept != MAXINT && !have) { + char c = 0; + + if (pack.who && pack.who->func) + joe_write(pack.who->ackfd, &c, 1); + else + joe_write(ackkbd, &c, 1); + accept = MAXINT; + } + + /* Check for typeahead or next packet */ + + if (!have && !leave) { + if (ackkbd != -1) { + fcntl(mpxfd, F_SETFL, O_NDELAY); + if (read(mpxfd, &pack, sizeof(struct packet) - 1024) > 0) { + fcntl(mpxfd, F_SETFL, 0); + joe_read(mpxfd, pack.data, pack.size); + have = 1; + accept = pack.ch; + } else + fcntl(mpxfd, F_SETFL, 0); + } else { + /* Set terminal input to non-blocking */ + fcntl(fileno(termin), F_SETFL, O_NDELAY); + + /* Try to read */ + if (read(fileno(termin), &havec, 1) == 1) + have = 1; + + /* Set terminal back to blocking */ + fcntl(fileno(termin), F_SETFL, 0); + } + } + return 0; +} + +/* Read next character from input */ + +void mpxdied(MPX *m); + +int ttgetc(void) +{ + int stat; + + loop: + ttflsh(); + while (winched) { + winched = 0; + edupd(1); + ttflsh(); + } + if (ticked) { + edupd(0); + ttflsh(); + tickon(); + } + if (ackkbd != -1) { + if (!have) { /* Wait for input */ + stat = read(mpxfd, &pack, sizeof(struct packet) - 1024); + + if (pack.size && stat > 0) { + joe_read(mpxfd, pack.data, pack.size); + } else if (stat < 1) { + if (winched || ticked) + goto loop; + else + ttsig(0); + } + accept = pack.ch; + } + have = 0; + if (pack.who) { /* Got bknd input */ + if (accept != MAXINT) { + if (pack.who->func) { + pack.who->func(pack.who->object, pack.data, pack.size); + edupd(1); + } + } else + mpxdied(pack.who); + goto loop; + } else { + if (accept != MAXINT) + return accept; + else { + ttsig(0); + return 0; + } + } + } + if (have) { + have = 0; + } else { + if (read(fileno(termin), &havec, 1) < 1) { + if (winched || ticked) + goto loop; + else + ttsig(0); + } + } + return havec; +} + +/* Write string to output */ + +void ttputs(char *s) +{ + while (*s) { + obuf[obufp++] = *s++; + if (obufp == obufsiz) + ttflsh(); + } +} + +/* Get window size */ + +void ttgtsz(int *x, int *y) +{ +#ifdef TIOCGSIZE + struct ttysize getit; +#else +#ifdef TIOCGWINSZ + struct winsize getit; +#endif +#endif + + *x = 0; + *y = 0; + +#ifdef TIOCGSIZE + if (ioctl(fileno(termout), TIOCGSIZE, &getit) != -1) { + *x = getit.ts_cols; + *y = getit.ts_lines; + } +#else +#ifdef TIOCGWINSZ + if (ioctl(fileno(termout), TIOCGWINSZ, &getit) != -1) { + *x = getit.ws_col; + *y = getit.ws_row; + } +#endif +#endif +} + +void ttshell(char *cmd) +{ + int x, omode = ttymode; + char *s = getenv("SHELL"); + + if (!s) + return; + ttclsn(); + if ((x = fork()) != 0) { + if (x != -1) + wait(NULL); + if (omode) + ttopnn(); + } else { + signrm(); + if (cmd) + execl(s, s, "-c", cmd, NULL); + else { + fprintf(stderr, "You are at the command shell. Type 'exit' to return\n"); + execl(s, s, NULL); + } + _exit(0); + } +} + +void ttsusp(void) +{ + int omode; + + tickoff(); +#ifdef SIGTSTP + omode = ttymode; + ttclsn(); + fprintf(stderr, "You have suspended the program. Type 'fg' to return\n"); + kill(0, SIGTSTP); + if (ackkbd != -1) + kill(kbdpid, SIGCONT); + if (omode) + ttopnn(); +#else + ttshell(NULL); +#endif + tickon(); +} + +static void mpxstart(void) +{ + int fds[2]; + + pipe(fds); + mpxfd = fds[0]; + mpxsfd = fds[1]; + pipe(fds); + accept = MAXINT; + have = 0; + if (!(kbdpid = fork())) { + close(fds[1]); + do { + unsigned char c; + int sta; + + pack.who = 0; + sta = joe_read(fileno(termin), &c, 1); + if (sta == 0) + pack.ch = MAXINT; + else + pack.ch = c; + pack.size = 0; + joe_write(mpxsfd, &pack, sizeof(struct packet) - 1024); + } while (joe_read(fds[0], &pack, 1) == 1); + _exit(0); + } + close(fds[0]); + ackkbd = fds[1]; +} + +static void mpxend(void) +{ + kill(kbdpid, 9); + while (wait(NULL) < 0 && errno == EINTR) + /* do nothing */; + close(ackkbd); + ackkbd = -1; + close(mpxfd); + close(mpxsfd); + if (have) + havec = pack.ch; +} + +/* Get a pty/tty pair. Returns open pty in 'ptyfd' and returns tty name + * string in static buffer or NULL if couldn't get a pair. + */ + +#ifdef sgi + +/* Newer sgi machines can do it the __svr4__ way, but old ones can't */ + +extern char *_getpty(); + +static char *getpty(int *ptyfd) +{ + return _getpty(ptyfd, O_RDWR, 0600, 0); +} + +#else +#ifdef __svr4__ + +/* Strange streams way */ + +extern char *ptsname(); + +static char *getpty(int *ptyfd) +{ + int fdm; + char *name; + + *ptyfd = fdm = open("/dev/ptmx", O_RDWR); + grantpt(fdm); + unlockpt(fdm); + return ptsname(fdm); +} + +#else + +/* The normal way: for each possible pty/tty pair, try to open the pty and + * then the corresponding tty. If both could be opened, close them both and + * then re-open the pty. If that succeeded, return with the opened pty and the + * name of the tty. + * + * Logically you should only have to succeed in opening the pty- but the + * permissions may be set wrong on the tty, so we have to try that too. + * We close them both and re-open the pty because we want the forked process + * to open the tty- that way it gets to be the controlling tty for that + * process and the process gets to be the session leader. + */ + +static char *getpty(int *ptyfd) +{ + int x, fd; + char *orgpwd = pwd(); + static char **ptys = NULL; + static char *ttydir; + static char *ptydir; + static char ttyname[32]; + + if (!ptys) { + ttydir = "/dev/pty/"; + ptydir = "/dev/ptym/"; /* HPUX systems */ + if (chpwd(ptydir) || !(ptys = rexpnd("pty*"))) + if (!ptys) { + ttydir = ptydir = "/dev/"; /* Everyone else */ + if (!chpwd(ptydir)) + ptys = rexpnd("pty*"); + } + } + chpwd(orgpwd); + + if (ptys) + for (fd = 0; ptys[fd]; ++fd) { + strcpy(ttyname, ptydir); + strcat(ttyname, ptys[fd]); + if ((*ptyfd = open(ttyname, O_RDWR)) >= 0) { + ptys[fd][0] = 't'; + strcpy(ttyname, ttydir); + strcat(ttyname, ptys[fd]); + ptys[fd][0] = 'p'; + x = open(ttyname, O_RDWR); + if (x >= 0) { + close(x); + close(*ptyfd); + strcpy(ttyname, ptydir); + strcat(ttyname, ptys[fd]); + *ptyfd = open(ttyname, O_RDWR); + ptys[fd][0] = 't'; + strcpy(ttyname, ttydir); + strcat(ttyname, ptys[fd]); + ptys[fd][0] = 'p'; + return ttyname; + } else + close(*ptyfd); + } + } + return NULL; +} + +#endif +#endif + +int dead = 0; + +static RETSIGTYPE death(int unused) +{ + wait(NULL); + dead = 1; +} + +#ifndef SIGCHLD +#define SIGCHLD SIGCLD +#endif + +/* Build a new environment */ + +extern char **mainenv; + +static char **newenv(char **old, char *s) +{ + char **new; + int x, y, z; + + for (x = 0; old[x]; ++x) ; + new = (char **) joe_malloc((x + 2) * sizeof(char *)); + + for (x = 0, y = 0; old[x]; ++x) { + for (z = 0; s[z] != '='; ++z) + if (s[z] != old[x][z]) + break; + if (s[z] == '=') { + if (s[z + 1]) + new[y++] = s; + } else + new[y++] = old[x]; + } + if (x == y) + new[y++] = s; + new[y] = 0; + return new; +} + +MPX *mpxmk(int *ptyfd, char *cmd, char **args, void (*func) (/* ??? */), void *object, void (*die) (/* ??? */), void *dieobj) +{ + int fds[2]; + int comm[2]; + pid_t pid; + int x; + MPX *m; + char *name; + + if (!(name = getpty(ptyfd))) + return NULL; + for (x = 0; x != NPROC; ++x) + if (!asyncs[x].func) { + m = asyncs + x; + goto ok; + } + return NULL; + ok: + ttflsh(); + ++nmpx; + if (ackkbd == -1) + mpxstart(); + m->func = func; + m->object = object; + m->die = die; + m->dieobj = dieobj; + pipe(fds); + pipe(comm); + m->ackfd = fds[1]; + if (!(m->kpid = fork())) { + close(fds[1]); + close(comm[0]); + dead = 0; + joe_set_signal(SIGCHLD, death); + + if (!(pid = fork())) { + signrm(); + close(*ptyfd); + +#ifdef TIOCNOTTY + x = open("/dev/tty", O_RDWR); + ioctl(x, TIOCNOTTY, 0); +#endif + +#ifndef SETPGRP_VOID + setpgrp(0, 0); +#else + setpgrp(); +#endif + + for (x = 0; x != 32; ++x) + close(x); /* Yes, this is quite a kludge... all in the + name of portability */ + + if ((x = open(name, O_RDWR)) != -1) { /* Standard input */ + char **env = newenv(mainenv, "TERM="); + +#ifdef __svr4__ + ioctl(x, I_PUSH, "ptem"); + ioctl(x, I_PUSH, "ldterm"); +#endif + dup(x); + dup(x); /* Standard output, standard error */ + /* (yes, stdin, stdout, and stderr must all be open for reading and + * writing. On some systems the shell assumes this */ + + /* We could probably have a special TTY set-up for JOE, but for now + * we'll just use the TTY setup for the TTY was was run on */ +#ifdef HAVE_POSIX_TERMIOS + tcsetattr(0, TCSADRAIN, &oldterm); +#else +#ifdef HAVE_SYSV_TERMIO + ioctl(0, TCSETAW, &oldterm); +#else + ioctl(0, TIOCSETN, &oarg); + ioctl(0, TIOCSETC, &otarg); + ioctl(0, TIOCSLTC, &oltarg); +#endif +#endif + + /* Execute the shell */ + execve(cmd, args, env); + } + + _exit(0); + } + joe_write(comm[1], &pid, sizeof(pid)); + + loop: + pack.who = m; + pack.ch = 0; + if (dead) + pack.size = 0; + else + pack.size = read(*ptyfd, pack.data, 1024); + if (pack.size > 0) { + joe_write(mpxsfd, &pack, sizeof(struct packet) - 1024 + pack.size); + + joe_read(fds[0], &pack, 1); + goto loop; + } else { + pack.ch = MAXINT; + pack.size = 0; + joe_write(mpxsfd, &pack, sizeof(struct packet) - 1024); + + _exit(0); + } + } + joe_read(comm[0], &m->pid, sizeof(m->pid)); + + close(comm[0]); + close(comm[1]); + close(fds[0]); + return m; +} + +void mpxdied(MPX *m) +{ + if (!--nmpx) + mpxend(); + while (wait(NULL) < 0 && errno == EINTR) + /* do nothing */; + if (m->die) + m->die(m->dieobj); + m->func = NULL; + edupd(1); +} diff -ruN joe-2.9.8/tw.c zh-joe-2.9.8/tw.c --- joe-2.9.8/tw.c Thu Mar 6 15:24:29 2003 +++ zh-joe-2.9.8/tw.c Thu Nov 3 22:57:59 2005 @@ -122,15 +122,15 @@ stalin = vsadd(stalin, fill); break; case 'n': - stalin = vsncpy(sv(stalin), sz(bw->b->name ? bw->b->name : "Unnamed")); + stalin = vsncpy(sv(stalin), sz(bw->b->name ? bw->b->name : "未命名")); break; case 'm': if (bw->b->changed) - stalin = vsncpy(sv(stalin), sc("(Modified)")); + stalin = vsncpy(sv(stalin), sc("(已更改)")); break; case 'R': if (bw->b->rdonly) - stalin = vsncpy(sv(stalin), sc("(Read only)")); + stalin = vsncpy(sv(stalin), sc("(唯讀)")); break; case '*': if (bw->b->changed) @@ -238,7 +238,7 @@ break; case 'M': if (recmac) { - snprintf(buf, sizeof(buf), "(Macro %d recording...)", recmac->n); + snprintf(buf, sizeof(buf), "(巨集 %d 錄製中...)", recmac->n); stalin = vsncpy(sv(stalin), sz(buf)); } break; @@ -433,7 +433,7 @@ if (bw->pid) return ukillpid(bw); if (bw->b->changed && bw->b->count == 1) - if (mkqw(bw->parent, sc("Lose changes to this file (y,n,^C)? "), naborttw, NULL, NULL, NULL)) + if (mkqw(bw->parent, sc("放棄對這個檔案的更改 (y,n,^C)? "), naborttw, NULL, NULL, NULL)) return 0; else return -1; @@ -501,7 +501,7 @@ if (t->curwin->main != mainw) { BW *bw = t->curwin->main->object; if (bw->pid) { - msgnw(bw->parent, "Process running in this window"); + msgnw(bw->parent, "視窗中正有程式執行中"); return -1; } utw0((BASE *)bw); diff -ruN joe-2.9.8/ublock.c zh-joe-2.9.8/ublock.c --- joe-2.9.8/ublock.c Thu Mar 6 15:24:29 2003 +++ zh-joe-2.9.8/ublock.c Thu Nov 3 22:57:57 2005 @@ -351,7 +351,7 @@ if (lightoff) unmark(bw); } else { - msgnw(bw->parent, "No block"); + msgnw(bw->parent, "尚未選取區塊"); return -1; } return 0; @@ -388,7 +388,7 @@ { if (markv(1)) { if (markb->b->rdonly) { - msgnw(bw->parent, "Read only"); + msgnw(bw->parent, "唯讀"); return -1; } if (square) { @@ -439,7 +439,7 @@ return 0; } } - msgnw(bw->parent, "No block"); + msgnw(bw->parent, "尚未選取區塊"); return -1; } @@ -483,7 +483,7 @@ return 0; } } else { - msgnw(bw->parent, "No block"); + msgnw(bw->parent, "尚未選取區塊"); return -1; } } @@ -527,7 +527,7 @@ } } else { vsrm(s); - msgnw(bw->parent, "No block"); + msgnw(bw->parent, "尚未選取區塊"); return -1; } } @@ -721,7 +721,7 @@ updall(); return 0; } else { - msgnw(bw->parent, "No block"); + msgnw(bw->parent, "尚未選取區塊"); return -1; } else { int ret = 0; @@ -753,7 +753,7 @@ if (markb && markk && !square && markb->b == bw->b && markk->b == bw->b && markb->byte == markk->byte) goto ok; if (!markv(1)) { - msgnw(bw->parent, "No block"); + msgnw(bw->parent, "尚未選取區塊"); return -1; } ok: @@ -873,23 +873,23 @@ int ufilt(BW *bw) { #ifdef __MSDOS__ - msgnw(bw->parent, "Sorry, no sub-processes in DOS (yet)"); + msgnw(bw->parent, "對不起!在 MS-DOS 下不能另外再執行子行程!"); return -1; #else switch (checkmark(bw)) { case 0: - if (wmkpw(bw->parent, "Command to filter block through (^C to abort): ", &filthist, dofilt, NULL, NULL, utypebw, NULL, NULL)) + if (wmkpw(bw->parent, "用來過濾區塊的命令名稱 (^C 中斷): ", &filthist, dofilt, NULL, NULL, utypebw, NULL, NULL)) return 0; else return -1; case 1: - if (wmkpw(bw->parent, "Command to filter file through (^C to abort): ", &filthist, dofilt, NULL, NULL, utypebw, NULL, NULL)) + if (wmkpw(bw->parent, "用來過濾區塊的命令名稱 (^C 中斷): ", &filthist, dofilt, NULL, NULL, utypebw, NULL, NULL)) return 0; else return -1; case 2: default: - msgnw(bw->parent, "No block"); + msgnw(bw->parent, "尚未選取區塊"); return -1; } #endif diff -ruN joe-2.9.8/uedit.c zh-joe-2.9.8/uedit.c --- joe-2.9.8/uedit.c Thu Mar 6 15:24:29 2003 +++ zh-joe-2.9.8/uedit.c Thu Nov 3 22:57:58 2005 @@ -514,14 +514,14 @@ if (merr) msgnw(bw->parent, merr); else - msgnw(bw->parent, "Invalid line number"); + msgnw(bw->parent, "不正確的行數"); return -1; } } int uline(BW *bw) { - if (wmkpw(bw->parent, "Go to line (^C to abort): ", &linehist, doline, NULL, NULL, NULL, NULL, NULL)) + if (wmkpw(bw->parent, "跳到第幾行 (^C 中斷): ", &linehist, doline, NULL, NULL, NULL, NULL, NULL)) return 0; else return -1; @@ -550,14 +550,14 @@ if (merr) msgnw(bw->parent, merr); else - msgnw(bw->parent, "Invalid column number"); + msgnw(bw->parent, "不正確的列數"); return -1; } } int ucol(BW *bw) { - if (wmkpw(bw->parent, "Go to column (^C to abort): ", &colhist, docol, NULL, NULL, NULL, NULL, NULL)) + if (wmkpw(bw->parent, "跳到第幾列 (^C 中斷): ", &colhist, docol, NULL, NULL, NULL, NULL, NULL)) return 0; else return -1; @@ -586,14 +586,14 @@ if (merr) msgnw(bw->parent, merr); else - msgnw(bw->parent, "Invalid byte number"); + msgnw(bw->parent, "不正確的位元數"); return -1; } } int ubyte(BW *bw) { - if (wmkpw(bw->parent, "Go to byte (^C to abort): ", &bytehist, dobyte, NULL, NULL, NULL, NULL, NULL)) + if (wmkpw(bw->parent, "跳到第幾位元 (^C 中斷): ", &bytehist, dobyte, NULL, NULL, NULL, NULL, NULL)) return 0; else return -1; @@ -971,7 +971,7 @@ int uquote(BW *bw) { quotestate = 0; - if (mkqwna(bw->parent, sc("Ctrl- (or 0-9 for dec. ascii, x for hex, or o for octal)"), doquote, NULL, NULL, NULL)) + if (mkqwna(bw->parent, sc("Ctrl- ( asci 0-9 十進位, x 十六進位, o 八進位)"), doquote, NULL, NULL, NULL)) return 0; else return -1; @@ -1089,7 +1089,7 @@ if (c >= '0' && c <= '9') { pdupown(bw->cursor, bw->b->marks + c - '0'); poffline(bw->b->marks[c - '0']); - snprintf(msgbuf, JOE_MSGBUFSIZE, "Mark %d set", c - '0'); + snprintf(msgbuf, JOE_MSGBUFSIZE, "設定第 %d 標記", c - '0'); msgnw(bw->parent, msgbuf); return 0; } else { @@ -1102,7 +1102,7 @@ { if (c >= '0' && c <= '9') return dosetmark(bw, c, NULL, NULL); - else if (mkqwna(bw->parent, sc("Set mark (0-9):"), dosetmark, NULL, NULL, NULL)) + else if (mkqwna(bw->parent, sc("設定標記 (0-9):"), dosetmark, NULL, NULL, NULL)) return 0; else return -1; @@ -1120,7 +1120,7 @@ bw->cursor->xcol = piscol(bw->cursor); return 0; } else { - snprintf(msgbuf, JOE_MSGBUFSIZE, "Mark %d not set", c - '0'); + snprintf(msgbuf, JOE_MSGBUFSIZE, "標記 %d 沒有設定完成", c - '0'); msgnw(bw->parent, msgbuf); return -1; } else { @@ -1133,7 +1133,7 @@ { if (c >= '0' && c <= '9') return dogomark(bw, c, NULL, NULL); - else if (mkqwna(bw->parent, sc("Goto bookmark (0-9):"), dogomark, NULL, NULL, NULL)) + else if (mkqwna(bw->parent, sc("跳到第幾書籤 (0-9):"), dogomark, NULL, NULL, NULL)) return 0; else return -1; @@ -1165,7 +1165,7 @@ break; } if (c == NO_MORE_DATA) { - msgnw(bw->parent, "Not found"); + msgnw(bw->parent, "找不到"); prm(q); return -1; } else { @@ -1212,7 +1212,7 @@ int umsg(BASE *b) { - if (wmkpw(b->parent, "Msg (^C to abort): ", NULL, domsg, NULL, NULL, NULL, NULL, NULL)) + if (wmkpw(b->parent, "訊息 (^C 中斷): ", NULL, domsg, NULL, NULL, NULL, NULL, NULL)) return 0; else return -1; @@ -1234,7 +1234,7 @@ int utxt(BASE *bw) { - if (wmkpw(bw->parent, "Insert (^C to abort): ", NULL, dotxt, NULL, NULL, utypebw, NULL, NULL)) + if (wmkpw(bw->parent, "插入 (^C 中斷): ", NULL, dotxt, NULL, NULL, utypebw, NULL, NULL)) return 0; else return -1; diff -ruN joe-2.9.8/uerror.c zh-joe-2.9.8/uerror.c --- joe-2.9.8/uerror.c Thu Mar 6 15:24:29 2003 +++ zh-joe-2.9.8/uerror.c Thu Nov 3 22:57:59 2005 @@ -191,7 +191,7 @@ { errbuf = bw->b; freeall(); - snprintf(msgbuf, JOE_MSGBUFSIZE, "Parsed %ld lines", parserr(bw->b)); + snprintf(msgbuf, JOE_MSGBUFSIZE, "顯示第 %ld 行", parserr(bw->b)); msgnw(bw->parent, msgbuf); return 0; } @@ -201,7 +201,7 @@ int omid; if (errptr->link.next == &errors) { - msgnw(bw->parent, "No more errors"); + msgnw(bw->parent, "錯誤顯示完畢"); return -1; } errptr = errptr->link.next; @@ -226,7 +226,7 @@ int omid; if (errptr->link.prev == &errors) { - msgnw(bw->parent, "No more errors"); + msgnw(bw->parent, "錯誤顯示完畢"); return -1; } errptr = errptr->link.prev; diff -ruN joe-2.9.8/ufile.c zh-joe-2.9.8/ufile.c --- joe-2.9.8/ufile.c Thu Mar 6 15:24:29 2003 +++ zh-joe-2.9.8/ufile.c Thu Nov 3 22:57:57 2005 @@ -69,37 +69,37 @@ if (bw->b->name && bw->b->name[0]) { s = bw->b->name; } else { - s = "(Unnamed)"; + s = "(未命名)"; } if (name) { if (saved) { - snprintf(msgbuf, JOE_MSGBUFSIZE, "File %s saved", name); + snprintf(msgbuf, JOE_MSGBUFSIZE, "檔案: %s 存檔完畢。", name); } else { - snprintf(msgbuf, JOE_MSGBUFSIZE, "File %s not saved", name); + snprintf(msgbuf, JOE_MSGBUFSIZE, "檔案: %s 並未儲存。", name); } } else if (bw->b->changed && bw->b->count == 1) { - snprintf(msgbuf, JOE_MSGBUFSIZE, "File %s not saved", s); + snprintf(msgbuf, JOE_MSGBUFSIZE, "檔案: %s 並未儲存。", s); } else if (saved) { - snprintf(msgbuf, JOE_MSGBUFSIZE, "File %s saved", s); + snprintf(msgbuf, JOE_MSGBUFSIZE, "檔案: %s 已經儲存。", s); } else { - snprintf(msgbuf, JOE_MSGBUFSIZE, "File %s not changed so no update needed", s); + snprintf(msgbuf, JOE_MSGBUFSIZE, "檔案 %s 並未改變,所以不需要更新資料。", s); } msgnw(bw->parent, msgbuf); if (!exmsg) { if (bw->b->changed && bw->b->count == 1) { - exmsg = vsncpy(NULL, 0, sc("File ")); + exmsg = vsncpy(NULL, 0, sc("檔案 ")); exmsg = vsncpy(sv(exmsg), sz(s)); - exmsg = vsncpy(sv(exmsg), sc(" not saved.")); + exmsg = vsncpy(sv(exmsg), sc(" 並未儲存。")); } else if (saved) { - exmsg = vsncpy(NULL, 0, sc("File ")); + exmsg = vsncpy(NULL, 0, sc("檔案 ")); exmsg = vsncpy(sv(exmsg), sz(s)); - exmsg = vsncpy(sv(exmsg), sc(" saved.")); + exmsg = vsncpy(sv(exmsg), sc(" 存檔完畢。")); } else { - exmsg = vsncpy(NULL, 0, sc("File ")); + exmsg = vsncpy(NULL, 0, sc("檔案 ")); exmsg = vsncpy(sv(exmsg), sz(s)); - exmsg = vsncpy(sv(exmsg), sc(" not changed so no update needed.")); + exmsg = vsncpy(sv(exmsg), sc(" 並未改變,所以不需要更新資料。")); } } } @@ -109,7 +109,7 @@ int ublksave(BW *bw) { if (markb && markk && markb->b == markk->b && (markk->byte - markb->byte) > 0 && (!square || piscol(markk) > piscol(markb))) { - if (wmkpw(bw->parent, "Name of file to write (^C to abort): ", &filehist, dowrite, "Names", NULL, cmplt, NULL, NULL)) { + if (wmkpw(bw->parent, "要儲存的檔名 (^C 中斷): ", &filehist, dowrite, "Names", NULL, cmplt, NULL, NULL)) { return 0; } else { return -1; @@ -260,7 +260,7 @@ if (notify) { *notify = 1; } - msgnw(bw->parent, "Couldn't make backup file... file not saved"); + msgnw(bw->parent, "無法產生備份檔... 檔案並未儲存。"); if (callback) { return callback(bw, -1); } else { @@ -268,7 +268,7 @@ } } if (c != 'y' && c != 'Y') { - if (mkqw(bw->parent, sc("Could not make backup file. Save anyway (y,n,^C)? "), saver, NULL, req, notify)) { + if (mkqw(bw->parent, sc("無法產生備份檔。 無論如何都要儲存 (y,n,^C)? "), saver, NULL, req, notify)) { return 0; } else { if (notify) @@ -356,7 +356,7 @@ genexmsg(bw, 0, s); vsrm(s); return -1; - } else if (mkqw(bw->parent, sc("File exists. Overwrite (y,n,^C)? "), dosave2, NULL, s, notify)) { + } else if (mkqw(bw->parent, sc("檔案已經存在。 要覆蓋\舊檔嗎?(y,n,^C) "), dosave2, NULL, s, notify)) { return 0; } else { return -1; @@ -381,7 +381,7 @@ { BW *pbw; - pbw = wmkpw(bw->parent, "Name of file to save (^C to abort): ", &filehist, dosave1, "Names", NULL, cmplt, NULL, NULL); + pbw = wmkpw(bw->parent, "要儲存的檔案名稱 (^C 中斷): ", &filehist, dosave1, "Names", NULL, cmplt, NULL, NULL); if (pbw && bw->b->name) { binss(pbw->cursor, bw->b->name); @@ -409,7 +409,7 @@ *notify = 1; } if (bw->pid) { - msgnw(bw->parent, "Process running in this window"); + msgnw(bw->parent, "視窗中有程式正在執行中"); return -1; } b = bfind(s); @@ -450,7 +450,7 @@ int okrepl(BW *bw) { if (bw->b->count == 1 && bw->b->changed) { - msgnw(bw->parent, "Can't replace modified file"); + msgnw(bw->parent, "無法取代已更改過的檔案。"); return -1; } else { return 0; @@ -459,7 +459,7 @@ int uedit(BW *bw) { - if (wmkpw(bw->parent, "Name of file to edit (^C to abort): ", &filehist, doedit, "Names", NULL, cmplt, NULL, NULL)) { + if (wmkpw(bw->parent, "欲編輯的檔案名稱 (^C 中斷): ", &filehist, doedit, "Names", NULL, cmplt, NULL, NULL)) { return 0; } else { return -1; @@ -480,7 +480,7 @@ *notify = 1; } if (bw->pid) { - msgnw(bw->parent, "Process running in this window"); + msgnw(bw->parent, "視窗中有程式正在執行中"); return -1; } b = bfind(s); @@ -517,7 +517,7 @@ B *b; if (bw->pid) { - msgnw(bw->parent, "Process running in this window"); + msgnw(bw->parent, "視窗中有程式正在執行中"); return -1; } b = bnext(); @@ -549,7 +549,7 @@ B *b; if (bw->pid) { - msgnw(bw->parent, "Process running in this window"); + msgnw(bw->parent, "視窗中有程式正在執行中"); return -1; } b = bprev(); @@ -576,7 +576,7 @@ int uinsf(BW *bw) { - if (wmkpw(bw->parent, "Name of file to insert (^C to abort): ", &filehist, doinsf, "Names", NULL, cmplt, NULL, NULL)) { + if (wmkpw(bw->parent, "欲插入的檔案名稱 (^C 中斷): ", &filehist, doinsf, "Names", NULL, cmplt, NULL, NULL)) { return 0; } else { return -1; @@ -624,7 +624,7 @@ } else if (bw->b->name && !exask) { return dosave(bw, vsncpy(NULL, 0, sz(bw->b->name)), exdone1, NULL); } else { - BW *pbw = wmkpw(bw->parent, "Name of file to save (^C to abort): ", &filehist, doex, "Names", NULL, cmplt, NULL, NULL); + BW *pbw = wmkpw(bw->parent, "欲儲存的檔案名稱 (^C 中斷): ", &filehist, doex, "Names", NULL, cmplt, NULL, NULL); if (pbw && bw->b->name) { binss(pbw->cursor, bw->b->name); @@ -647,7 +647,7 @@ if (bw->b->name) { return dosave1(bw, vsncpy(NULL, 0, sz(bw->b->name)), object, notify); } else { - BW *pbw = wmkpw(bw->parent, "Name of file to save (^C to abort): ", &filehist, dosave1, "Names", NULL, cmplt, object, notify); + BW *pbw = wmkpw(bw->parent, "欲儲存的檔案名稱 (^C 中斷): ", &filehist, dosave1, "Names", NULL, cmplt, object, notify); if (pbw) { return 0; @@ -662,7 +662,7 @@ } return 0; } else if (bw->b->count == 1 && bw->b->changed) { - if (mkqw(bw->parent, sc("Save changes to this file (y,n,^C)? "), nask, NULL, object, notify)) { + if (mkqw(bw->parent, sc("要儲存對這檔案的更改嗎?(y,n,^C) "), nask, NULL, object, notify)) { return 0; } else { return -1; @@ -687,7 +687,7 @@ static int nask2(BW *bw, int c, void *object, int *notify) { if (c == 'y' || c == 'Y') { - BW *pbw = wmkpw(bw->parent, "Name of file to save (^C to abort): ", &filehist, dosave1, "Names", NULL, cmplt, object, notify); + BW *pbw = wmkpw(bw->parent, "欲儲存的檔案名稱 (^C 中斷): ", &filehist, dosave1, "Names", NULL, cmplt, object, notify); if (pbw) { return 0; @@ -701,7 +701,7 @@ } return 0; } else if (bw->b->count == 1 && bw->b->changed) { - if (mkqw(bw->parent, sc("Save changes to this file (y,n,^C)? "), nask, NULL, object, notify)) { + if (mkqw(bw->parent, sc("要儲存對這檔案的更改嗎 (y,n,^C)? "), nask, NULL, object, notify)) { return 0; } else { return -1; @@ -755,7 +755,7 @@ return ukillpid(bw); } if (bw->b->count == 1 && bw->b->changed) { - if (mkqw(bw->parent, sc("Lose changes to this file (y,n,^C)? "), dolose, NULL, NULL, NULL)) { + if (mkqw(bw->parent, sc("放棄對這檔案的更改嗎 (y,n,^C)? "), dolose, NULL, NULL, NULL)) { return 0; } else { return -1; diff -ruN joe-2.9.8/uisrch.c zh-joe-2.9.8/uisrch.c --- joe-2.9.8/uisrch.c Thu Mar 6 15:24:29 2003 +++ zh-joe-2.9.8/uisrch.c Thu Nov 3 22:57:59 2005 @@ -154,7 +154,7 @@ struct isrch *isrch = (struct isrch *) joe_malloc(sizeof(struct isrch)); izque(IREC, link, &isrch->irecs); - isrch->pattern = vsncpy(NULL, 0, sc("I-find: ")); + isrch->pattern = vsncpy(NULL, 0, sc("即時搜尋:")); isrch->ofst = sLen(isrch->pattern); isrch->dir = dir; isrch->quote = 0; diff -ruN joe-2.9.8/umath.c zh-joe-2.9.8/umath.c --- joe-2.9.8/umath.c Thu Mar 6 15:24:29 2003 +++ zh-joe-2.9.8/umath.c Thu Nov 3 22:57:58 2005 @@ -22,7 +22,7 @@ static RETSIGTYPE fperr(int unused) { if (!merr) { - merr = "Float point exception"; + merr = "必須使用浮點數"; } REINSTALL_SIGHANDLER(SIGFPE, fperr); } @@ -88,7 +88,7 @@ ++ptr; else { if (!merr) - merr = "Missing )"; + merr = "找不到 )"; } } else if (*ptr == '-') { ++ptr; @@ -121,7 +121,7 @@ v->set = 1; } else { if (!merr) - merr = "Left side of = is not an l-value"; + merr = "等號\"=\"左邊的值不是一個 L-value"; } goto loop; } @@ -173,7 +173,7 @@ goto up; } } else if (*ptr) { - merr = "Extra junk after end of expr"; + merr = "運算式後有額外無用的運算式"; } } return result; diff -ruN joe-2.9.8/undo.c zh-joe-2.9.8/undo.c --- joe-2.9.8/undo.c Thu Mar 6 15:24:29 2003 +++ zh-joe-2.9.8/undo.c Thu Nov 3 22:57:58 2005 @@ -438,7 +438,7 @@ int unotmod(BW *bw) { bw->b->changed = 0; - msgnw(bw->parent, "Modified flag cleared"); + msgnw(bw->parent, "更改過的標誌已經清除"); return 0; } @@ -453,7 +453,7 @@ unmark(bw); return 0; } else { - msgnw(bw->parent, "No block"); + msgnw(bw->parent, "沒有標示區塊"); return -1; } } diff -ruN joe-2.9.8/usearch.c zh-joe-2.9.8/usearch.c --- joe-2.9.8/usearch.c Thu Mar 6 15:24:29 2003 +++ zh-joe-2.9.8/usearch.c Thu Nov 3 22:57:58 2005 @@ -324,7 +324,7 @@ } vsrm(s); if (srch->replace) { - if (wmkpw(bw->parent, "Replace with (^C to abort): ", &replhist, set_replace, srchstr, pfabort, utypebw, srch, notify)) + if (wmkpw(bw->parent, "要以什麼取代 (^C 中斷): ", &replhist, set_replace, srchstr, pfabort, utypebw, srch, notify)) return 0; else return -1; @@ -338,7 +338,7 @@ vsrm(srch->pattern); srch->pattern = s; - if ((pbw = wmkpw(bw->parent, "(I)gnore (R)eplace (B)ackwards Bloc(K) NNN (^C to abort): ", NULL, set_options, srchstr, pfabort, utypebw, srch, notify)) != NULL) { + if ((pbw = wmkpw(bw->parent, "(I)忽略 (R)取代 (B)往前搜尋 (K)搜尋區塊 (N)符合字串(^C 中斷): ", NULL, set_options, srchstr, pfabort, utypebw, srch, notify)) != NULL) { char buf[10]; if (srch->ignore) @@ -383,7 +383,7 @@ } srch = setmark(mksrch(NULL, NULL, 0, back, -1, repl, 0)); srch->addr = bw->cursor->byte; - if (wmkpw(bw->parent, "Find (^C to abort): ", &findhist, set_pattern, srchstr, pfabort, utypebw, srch, NULL)) + if (wmkpw(bw->parent, "找尋字串 (^C 中斷): ", &findhist, set_pattern, srchstr, pfabort, utypebw, srch, NULL)) return 0; else { rmsrch(srch); @@ -413,7 +413,7 @@ P *q; if (bw->b->rdonly) { - msgnw(bw->parent, "Read only"); + msgnw(bw->parent, "唯讀"); return -1; } if (markk) @@ -489,7 +489,7 @@ nungetc(c); return 0; } - if (mkqwnsr(bw->parent, sc("Replace (Y)es (N)o (R)est (B)ackup (^C to abort)?"), dopfrepl, pfsave, srch, notify)) + if (mkqwnsr(bw->parent, sc("取代 (Y)是 (N)否 (R)全部取代 (B)備份 (^C 中斷)?"), dopfrepl, pfsave, srch, notify)) return 0; else return pfsave(bw, srch); @@ -604,9 +604,9 @@ case 1: bye: if (!srch->flg && !srch->rest) { if (srch->valid && srch->block_restrict) - msgnw(bw->parent, "Not found (search restricted to marked block)"); + msgnw(bw->parent, "找不到 :( (搜尋範圍限定在所選定的區塊內)"); else - msgnw(bw->parent, "Not found"); + msgnw(bw->parent, "找不到 :("); ret = -1; } break; diff -ruN joe-2.9.8/ushell.c zh-joe-2.9.8/ushell.c --- joe-2.9.8/ushell.c Thu Mar 6 15:24:29 2003 +++ zh-joe-2.9.8/ushell.c Thu Nov 3 22:57:59 2005 @@ -39,13 +39,13 @@ close(bw->out); bw->out = -1; if (piseof(bw->cursor)) { - binss(bw->cursor, "** Program finished **\n"); + binss(bw->cursor, "** 程式執行完畢 **\n"); p_goto_eof(bw->cursor); bw->cursor->xcol = piscol(bw->cursor); } else { P *q = pdup(bw->b->eof); - binss(q, "** Program finished **\n"); + binss(q, "** 程式執行完畢 **\n"); prm(q); } } @@ -99,7 +99,7 @@ *notify = 1; } varm(s); - msgnw(bw->parent, "Sorry, no sub-processes in DOS (yet)"); + msgnw(bw->parent, "對不起!在 MS-DOS 下不能另外再執行子行程!"); return -1; #else MPX *m; @@ -108,7 +108,7 @@ *notify = 1; } if (bw->pid && orphan) { - msgnw(bw->parent, "Program already running in this window"); + msgnw(bw->parent, "程式已經在這個視窗中執行"); varm(s); return -1; } @@ -119,7 +119,7 @@ bw = (BW *) maint->curwin->object; if (!(m = mpxmk(&bw->out, name, s, cdata, bw, cdone, bw))) { varm(s); - msgnw(bw->parent, "No ptys available"); + msgnw(bw->parent, "沒有多餘的 ptys 可供使用"); return -1; } else { bw->pid = m->pid; @@ -159,7 +159,7 @@ int urun(BW *bw) { - if (wmkpw(bw->parent, "Program to run: ", &runhist, dorun, "Run", NULL, NULL, NULL, NULL)) { + if (wmkpw(bw->parent, "欲執行的程式名稱: ", &runhist, dorun, "Run", NULL, NULL, NULL, NULL)) { return 0; } else { return -1; @@ -187,7 +187,7 @@ int ukillpid(BW *bw) { if (bw->pid) { - if (mkqw(bw->parent, sc("Kill program (y,n,^C)?"), pidabort, NULL, NULL, NULL)) { + if (mkqw(bw->parent, sc("中斷正在執行的程式 (y,n,^C)?"), pidabort, NULL, NULL, NULL)) { return 0; } else { return -1; diff -ruN joe-2.9.8/utag.c zh-joe-2.9.8/utag.c --- joe-2.9.8/utag.c Thu Mar 6 15:24:29 2003 +++ zh-joe-2.9.8/utag.c Thu Nov 3 22:57:58 2005 @@ -37,7 +37,7 @@ } f = fopen("tags", "r"); if (!f) { - msgnw(bw->parent, "Couldn't open tags file"); + msgnw(bw->parent, "無法開啟標籤檔"); vsrm(s); vsrm(t); return -1; @@ -83,7 +83,7 @@ dofollows(); mid = omid; } else { - msgnw(bw->parent, "Invalid line number"); + msgnw(bw->parent, "不正確的行數"); } } else { if (buf[y] == '/' || buf[y] == '?') { @@ -116,7 +116,7 @@ } } } - msgnw(bw->parent, "Not found"); + msgnw(bw->parent, "找不到"); vsrm(s); vsrm(t); fclose(f); @@ -129,7 +129,7 @@ { BW *pbw; - pbw = wmkpw(bw->parent, "Tag search: ", &taghist, dotag, NULL, NULL, cmplt, NULL, NULL); + pbw = wmkpw(bw->parent, "標籤搜尋: ", &taghist, dotag, NULL, NULL, cmplt, NULL, NULL); if (pbw && isalnum_(brc(bw->cursor))) { P *p = pdup(bw->cursor); P *q = pdup(p); diff -ruN joe-2.9.8/vfile.c zh-joe-2.9.8/vfile.c --- joe-2.9.8/vfile.c Thu Mar 6 15:24:29 2003 +++ zh-joe-2.9.8/vfile.c Thu Nov 3 22:57:59 2005 @@ -191,7 +191,7 @@ pp->next = vp->next; goto gotit; } - write(2, "vfile: out of memory\n", 21); + write(2, "vfile: 記憶體不足\n", 21); exit(1); gotit: @@ -246,7 +246,7 @@ new->name = vsncpy(NULL, 0, sz(name)); new->fd = open(name, O_RDWR); if (!new->fd) { - fprintf(stderr, "Couldn\'t open file \'%s\'\n", name); + fprintf(stderr, "無法開啟檔案 \'%s\'\n", name); joe_free(new); return NULL; }