• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

コミットメタ情報

リビジョンf881433f40d82bffc5c2986250bafa0dffae7991 (tree)
日時2019-11-19 20:16:22
作者IWAMOTO Kouichi <sue@iwmt...>
コミッターIWAMOTO Kouichi

ログメッセージ

add new-line mode

  • support new-line mode (SM/RM)
  • add -n command-line option for enable new-line mode.

変更サマリ

差分

--- a/termlog.c
+++ b/termlog.c
@@ -62,6 +62,8 @@ int lin, col, attr;
6262 int savelin, savecol, saveattr;
6363 int scrtop, scrend;
6464
65+int nlmode = FALSE;
66+
6567 int verbose = FALSE;
6668 int keepgr = FALSE;
6769
@@ -150,6 +152,9 @@ char ***avp;
150152 case 'm':
151153 keepgr = TRUE;
152154 break;
155+ case 'n':
156+ nlmode = TRUE;
157+ break;
153158 case 'v':
154159 verbose = TRUE;
155160 break;
@@ -188,11 +193,12 @@ done:
188193 void
189194 usage()
190195 {
191- printf("Usage: %s [-gCOLSxLINES] [-k[ejs]] [-m] [-v] file ...\n", progname);
196+ printf("Usage: %s [-gCOLSxLINES] [-k[ejs]] [-m] [-n] [-v] file ...\n", progname);
192197 printf("Options:\n");
193198 printf(" -g: set screen size (default: -g80x24)\n");
194199 printf(" -k: set input code (don't care if no kana exists)\n");
195200 printf(" -m: retain graphic renditions (reverse, underline)\n");
201+ printf(" -n: new-line mode\n");
196202 printf(" -v: verbose output\n");
197203
198204 }
@@ -302,6 +308,9 @@ FILE *fp;
302308 } else if (lin == lines) {
303309 lin = lines - 1;
304310 }
311+ if (nlmode) {
312+ col = 0;
313+ }
305314 break;
306315 case '\t': /* tab */
307316 if (col < cols)
@@ -442,7 +451,7 @@ csi(fp)
442451 FILE *fp;
443452 {
444453 int c, i, j, k, n, np, p[10];
445- int leader, ich = '\0';
454+ int leader = '\0', ich = '\0';
446455 cell *tmp;
447456
448457 c = getc(fp);
@@ -682,7 +691,22 @@ FILE *fp;
682691 attr = saveattr;
683692 break;
684693 case 'h': /* set mode */
694+ if (leader == '\0') {
695+ for (i=0; i<np; i++) {
696+ if (p[i] == 20) {
697+ nlmode = TRUE;
698+ }
699+ }
700+ }
701+ break;
685702 case 'l': /* reset mode */
703+ if (leader == '\0') {
704+ for (i=0; i<np; i++) {
705+ if (p[i] == 20) {
706+ nlmode = FALSE;
707+ }
708+ }
709+ }
686710 break;
687711 default:
688712 break;