Fix formatting/cleaning

This commit is contained in:
Alexander S. Aganichev 2003-04-03 14:20:58 +00:00
parent 4e195466bd
commit 03de8fcc4b
6 changed files with 47 additions and 85 deletions

View File

@ -44,7 +44,7 @@ ulong getMsgId() {
ulong id; ulong id;
char *err; char *err;
if(CFG->seqmsgid and not (CFG->seqmsgid == MAYBE and *CFG->seqdir == NUL)) { if(CFG->seqmsgid and not ((CFG->seqmsgid == MAYBE) and (*CFG->seqdir == NUL))) {
id = GenMsgIdEx(CFG->seqdir, CFG->seqoutrun, getClassicMsgId, &err); id = GenMsgIdEx(CFG->seqdir, CFG->seqoutrun, getClassicMsgId, &err);
if(err) { if(err) {
LOG.printf("* Warning, SeqMsgId failed: %s, fall to classic algorythm!", err); LOG.printf("* Warning, SeqMsgId failed: %s, fall to classic algorythm!", err);

View File

@ -52,7 +52,7 @@
// ------------------------------------------------------------------M // ------------------------------------------------------------------M
#if defined(__UNIX__) #if defined(__UNIX__)
#if not defined(__BEOS__) #if !defined(__BEOS__)
#define O_TEXT 0 #define O_TEXT 0
#define O_BINARY 0 #define O_BINARY 0
#endif #endif

View File

@ -180,7 +180,7 @@ GKbd::GKbd() {
Init(); Init();
#if defined(__UNIX__) && !defined(__USE_NCURSES__) && !defined(__BEOS__) #if defined(__UNIX__) && !defined(__USE_NCURSES__) && !defined(__BEOS__)
gkbd_keymap_init(); gkbd_keymap_init();
@ -221,11 +221,11 @@ GKbd::GKbd() {
gkbd_define_keysym("\033[5~", Key_PgUp); gkbd_define_keysym("\033[5~", Key_PgUp);
gkbd_define_keysym("\033[6~", Key_PgDn); gkbd_define_keysym("\033[6~", Key_PgDn);
gkbd_define_keysym("\033[[A", Key_F1); gkbd_define_keysym("\033[[A", Key_F1);
gkbd_define_keysym("\033[[B", Key_F2); gkbd_define_keysym("\033[[B", Key_F2);
gkbd_define_keysym("\033[[C", Key_F3); gkbd_define_keysym("\033[[C", Key_F3);
gkbd_define_keysym("\033[[D", Key_F4); gkbd_define_keysym("\033[[D", Key_F4);
gkbd_define_keysym("\033[[E", Key_F5); gkbd_define_keysym("\033[[E", Key_F5);
gkbd_define_keysym("\033[17~", Key_F6); gkbd_define_keysym("\033[17~", Key_F6);
gkbd_define_keysym("\033[18~", Key_F7); gkbd_define_keysym("\033[18~", Key_F7);
gkbd_define_keysym("\033[19~", Key_F8); gkbd_define_keysym("\033[19~", Key_F8);
@ -306,7 +306,7 @@ GKbd::GKbd() {
gkbd_define_keysym(escseq, (n < 128) ? (scancode_table[n]|n) : n); gkbd_define_keysym(escseq, (n < 128) ? (scancode_table[n]|n) : n);
} }
// gkbd_define_keysym("^@", 0); ????????? // gkbd_define_keysym("^@", 0); ?????????
gkbd_define_keysym("\033[A", Key_Up); gkbd_define_keysym("\033[A", Key_Up);
gkbd_define_keysym("\033[B", Key_Dwn); gkbd_define_keysym("\033[B", Key_Dwn);
@ -319,13 +319,13 @@ GKbd::GKbd() {
gkbd_define_keysym("\033[5~", Key_PgUp); gkbd_define_keysym("\033[5~", Key_PgUp);
gkbd_define_keysym("\033[6~", Key_PgDn); gkbd_define_keysym("\033[6~", Key_PgDn);
// gkbd_define_keysym("\033[3~", Key_Del); // gkbd_define_keysym("\033[3~", Key_Del);
gkbd_define_keysym("\033[11~", Key_F1); gkbd_define_keysym("\033[11~", Key_F1);
gkbd_define_keysym("\033[12~", Key_F2); gkbd_define_keysym("\033[12~", Key_F2);
gkbd_define_keysym("\033[13~", Key_F3); gkbd_define_keysym("\033[13~", Key_F3);
gkbd_define_keysym("\033[14~", Key_F4); gkbd_define_keysym("\033[14~", Key_F4);
gkbd_define_keysym("\033[15~", Key_F5); gkbd_define_keysym("\033[15~", Key_F5);
gkbd_define_keysym("\033[16~", Key_F6); gkbd_define_keysym("\033[16~", Key_F6);
gkbd_define_keysym("\033[17~", Key_F7); gkbd_define_keysym("\033[17~", Key_F7);
gkbd_define_keysym("\033[18~", Key_F8); gkbd_define_keysym("\033[18~", Key_F8);
@ -1508,7 +1508,7 @@ gkey kbxget_raw(int mode) {
case Key_PgDn: k = Key_A_PgDn; break; case Key_PgDn: k = Key_A_PgDn; break;
case Key_PgUp: k = Key_A_PgUp; break; case Key_PgUp: k = Key_A_PgUp; break;
case Key_End: k = Key_A_End; break; case Key_End: k = Key_A_End; break;
// case Key_: k=Key_A_; break; // case Key_: k=Key_A_; break;
default: break; default: break;
} }
else if(shifts & (LSHIFT | RSHIFT)) else if(shifts & (LSHIFT | RSHIFT))
@ -1556,17 +1556,7 @@ gkey kbxget_raw(int mode) {
case Key_F12: k=Key_C_F12; break; case Key_F12: k=Key_C_F12; break;
} }
} }
} /*else if(k == Key_BS) { }
// Under Linux we could use TIOCLINUX fn. 6 to read shift states on console
// Of course it is very unportable but should produce good results :-)
int shifts = 6;
if(ioctl(fileno(stdin), TIOCLINUX, &shifts) == -1)
shifts = 0;
if(shifts & ALT)
k = Key_A_BS;
else if(shifts & GCTRL)
k = Key_C_BS;
}*/
#endif #endif
return k; return k;

View File

@ -41,12 +41,6 @@
#include <gsigunix.h> #include <gsigunix.h>
#include <gkbdunix.h> #include <gkbdunix.h>
#ifdef __BEOS__
//sz: some undocumented call that behaves in same manner as select ...
extern "C" int waiton( int, fd_set *, fd_set *, fd_set *, bigtime_t);
#endif
// ------------------------------------------------------------------ // ------------------------------------------------------------------
int gkbd_stdin = -1; int gkbd_stdin = -1;
@ -186,51 +180,31 @@ int gkbd_sys_input_pending(int tsecs) {
return select(gkbd_stdin+1, &read_fd_set, NULL, NULL, &wait); return select(gkbd_stdin+1, &read_fd_set, NULL, NULL, &wait);
#else #else
//bigtime_t t= bigtime_t(secs) * 1000000L + usecs; struct termios term, oterm;
///*return*/ waiton(gkbd_stdin+1, &read_fd_set, NULL, NULL, 0/*t * 1000*/); int fd = gkbd_stdin;
//return 0; int c = 0;
struct termios term, oterm; // get the terminal settings
int fd = gkbd_stdin; tcgetattr(fd, &oterm);
int c = 0;
/* get the terminal settings */ // get a copy of the settings, which we modify
tcgetattr(fd, &oterm); memcpy(&term, &oterm, sizeof(term));
/* get a copy of the settings, which we modify */ // put the terminal in non-canonical mode, any
memcpy(&term, &oterm, sizeof(term)); // reads timeout after 0.1 seconds or when a
// single character is read
term.c_lflag = term.c_lflag & (!ICANON);
term.c_cc[VMIN] = 0;
term.c_cc[VTIME] = 1;
tcsetattr(fd, TCSANOW, &term);
/* put the terminal in non-canonical mode, any int bytes = -1;
reads timeout after 0.1 seconds or when a ioctl(fd, TCWAITEVENT, &bytes);
single character is read */
term.c_lflag = term.c_lflag & (!ICANON);
term.c_cc[VMIN] = 0;
term.c_cc[VTIME] = 1;
tcsetattr(fd, TCSANOW, &term);
/* get input - timeout after 0.1 seconds or // reset the terminal to original state
when one character is read. If timed out tcsetattr(fd, TCSANOW, &oterm);
getchar() returns -1, otherwise it returns
the character */
/* c=getchar();
*/
int bytes = -1;
ioctl(fd, TCWAITEVENT, &bytes);
/* reset the terminal to original state */
tcsetattr(fd, TCSANOW, &oterm);
/* if we retrieved a character, put it back on
the input stream */
/* if (c != -1)
ungetc(c, stdin);
/* return 1 if the keyboard was hit, or 0 if it
was not hit */
/* return ((c!=-1)?1:0);
*/
return bytes;
return bytes;
#endif #endif
} }

View File

@ -86,12 +86,11 @@ void g_increase_priority(void) {
void g_set_ostitle(char* title, word dx) { void g_set_ostitle(char* title, word dx) {
NW(dx); NW(dx);
#ifndef __BEOS__ #ifndef __BEOS__
NW(title); NW(title);
#else #else
char fmt[]={'\x1b','\x5d','\x32','\x3b', '%', 's', '\x07', 0}; printf("\x1b\x5d\x32\x3b%s\x07", title);
fprintf(stdout, fmt, title);
fflush(stdout); fflush(stdout);
#endif #endif
} }

View File

@ -52,23 +52,22 @@ char* ggetosstring(void) {
struct utsname info; struct utsname info;
if(uname(&info) != -1) if(uname(&info) != -1) {
#if defined(__EMX__) #if defined(__EMX__)
sprintf(osstring, "%s %s.%s %s", info.sysname, info.version, info.release, info.machine); sprintf(osstring, "%s %s.%s %s", info.sysname, info.version, info.release, info.machine);
#elif defined(__DJGPP__) #elif defined(__DJGPP__)
sprintf(osstring, "%s %s.%s %s", info.sysname, info.release, info.version, info.machine); sprintf(osstring, "%s %s.%s %s", info.sysname, info.release, info.version, info.machine);
#elif defined(__BEOS__) #elif defined(__BEOS__)
{ BAppFileInfo appFileInfo;
BAppFileInfo appFileInfo; version_info sys_ver = {0};
version_info sys_ver = {0}; BFile file("/boot/beos/system/lib/libbe.so", B_READ_ONLY);
BFile file("/boot/beos/system/lib/libbe.so", B_READ_ONLY); appFileInfo.SetTo(&file);
appFileInfo.SetTo(&file); appFileInfo.GetVersionInfo(&sys_ver, B_APP_VERSION_KIND);
appFileInfo.GetVersionInfo(&sys_ver, B_APP_VERSION_KIND); sprintf(osstring, "%s %s %s", info.sysname, sys_ver.short_info, info.machine);
sprintf(osstring, "%s %s %s", info.sysname, sys_ver.short_info, info.machine); #else
}
#else
sprintf(osstring, "%s %s %s", info.sysname, info.release, info.machine); sprintf(osstring, "%s %s %s", info.sysname, info.release, info.machine);
#endif #endif
}
else else
strcpy(osstring, "unknown"); strcpy(osstring, "unknown");