summaryrefslogtreecommitdiffstats
path: root/mbbsd/cal.c
diff options
context:
space:
mode:
Diffstat (limited to 'mbbsd/cal.c')
-rw-r--r--mbbsd/cal.c81
1 files changed, 0 insertions, 81 deletions
diff --git a/mbbsd/cal.c b/mbbsd/cal.c
index 4d5bfe13..5c2b7cdc 100644
--- a/mbbsd/cal.c
+++ b/mbbsd/cal.c
@@ -467,84 +467,3 @@ ccount(float *a, float b, int cmode)
}
}
-int
-cal()
-{
- float a = 0;
- char flo = 0, ch = 0;
- char mode[6] = {' ', '=', '+', '-', '*', '/'}, cmode = 0;
- char b[20] = "0";
-
- move(b_lines - 1, 0);
- clrtoeol();
- outs("[ 0] [ ] ");
- move(b_lines, 0);
- clrtoeol();
- outs("\033[44m 小計算機 \033[31;47m (0123456789+-*/=) "
- "\033[30m輸入 \033[31m "
- "(Q)\033[30m 離開 \033[m");
- while (1) {
- ch = igetch();
- switch (ch) {
- case '\r':
- ch = '=';
- case '=':
- case '+':
- case '-':
- case '*':
- case '/':
- ccount(&a, atof(b), cmode);
- flo = 0;
- b[0] = '0';
- b[1] = 0;
- move(b_lines - 1, 0);
- prints("[%13.2f] [%c] ", a, ch);
- break;
- case '.':
- if (!flo)
- flo = 1;
- else
- break;
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- case '0':
- if (strlen(b) > 13)
- break;
- if (flo || b[0] != '0')
- snprintf(b, sizeof(b), "%s%c", b, ch);
- else
- b[0] = ch;
- move(b_lines - 1, 0);
- prints("[%13s] [%c]", b, mode[(int)cmode]);
- break;
- case 'q':
- return 0;
- }
-
- switch (ch) {
- case '=':
- a = 0;
- cmode = 0;
- break;
- case '+':
- cmode = 2;
- break;
- case '-':
- cmode = 3;
- break;
- case '*':
- cmode = 4;
- break;
- case '/':
- cmode = 5;
- break;
- }
- }
-}