void fullscreen_editor (void) { char *p = "\026\001\020\234^X=Down ^E=Up ^S=Left ^D=Right ^Z=Save ^K?=Help"; cls(); change_attr (BLUE|_LGREY); del_line (); m_print (" * %s\n", sys.msg_name); msg_attrib (&msg, last_msg + 1, 0, 0); change_attr (RED|_BLUE); del_line (); cpos (5, (usr.width ? usr.width : 80) - strlen (p) - 1 + 4); m_print (p); change_attr (CYAN|_BLACK); m_print (bbstxt[B_ONE_CR]); fulleditor = 1; XON_DISABLE (); _BRK_DISABLE (); edit_file ("MSGTMP", usr.len - 5, usr.width ? (usr.width - 1) : 79); fulleditor = 0; XON_ENABLE (); _BRK_ENABLE (); }
void Program::exchange_line(int line1, int line2){ Line * lg1,*lg2; lg1=find_line(line1); lg2=find_line(line2); del_line(line1); add_line_at(lg2,line1); del_line(line2); add_line_at(lg1,line2); }
/*** Join two lines and strip spaces on the next ***/ void join_strip( Project p ) { LINE *ln; if((ln = p->edited->next) != NULL) { STRPTR data; ULONG i; inv_curs(p, FALSE); p->nbc = p->edited->size; for(i=0, data=ln->stream; TypeChar[*data] == SPACE && i<ln->size; i++, data++); reg_group_by(&p->undo); if(i != ln->size) { /* Do not add a blank if there is already one */ if( p->nbc > 0 && TypeChar[ p->edited->stream[ p->nbc-1 ] ] != SPACE ) add_char(&p->undo, p->edited, p->nbc, ' '); if( insert_str(&p->undo, p->edited, p->edited->size, data, ln->size-i) == 0 ) ThrowError(Wnd, ErrMsg(ERR_NOMEM)); } /* ln can't be the first */ del_line(&p->undo, NULL, ln); p->max_lines--; reg_group_by(&p->undo); prop_adj(p); /* Refresh screen */ p->nbrc = p->nbrwc = x2pos(p->edited, p->nbc); REDRAW_CURLINE( p ); draw_info( p ); scroll_up(p, p->edited->next, p->ycurs, center_horiz(p)); inv_curs(p,TRUE); } }
void title_transition (Context* context, int state) { if (context->title->profile_name != NULL) { free(context->title->profile_name); context->title->profile_name = NULL; } if (context->title->profile_line != NULL) { del_line(context->glyphs, context->title->profile_line); context->title->profile_line = NULL; } if (context->title->user_bufs != NULL) { int i = 0; for (; i < MAX_PROFILES; i++) { if (context->title->user_bufs[i] == NULL) { continue; } context->video[1] = vertex_buffer_delete( context->video[1] , context->title->user_bufs[i] ); } free(context->title->user_bufs); context->title->user_bufs = NULL; } context->title->state = state; clear_lines( context->glyphs , context->title->lines , TITLE_MAX_LINES ); switch (state) { case TITLE_STATE_MAIN: context->title->lines = init_title(context); break; case TITLE_STATE_LOAD_PROFILE: context->title->lines = init_load_profile(context); break; case TITLE_STATE_NEW_PROFILE: context->title->lines = init_new_profile(context); break; case TYRIAN_GAME_LEVEL: context->engine = engine_init_level(context); break; } }
void clrscr_s (void) { int i; for (i = 0; i < (usr.len - 5); i++) { gotoxy_s (1, i + 1); del_line (); } gotoxy_s (1, 1); }
void paste_line(t_cmdline *cmd) { char *keep; if ((keep = cmd->keep)) { del_line(cmd); while (*keep) { insrt_line(cmd, *keep); keep++; } } }
int get_next_line(int const fd, char **line) { static char *dst = NULL; int i; if (fd < 0 || !line) return (-1); i = get_line_len(fd, &dst); if (i == -1) return (0); if (i == -2) return (-1); *line = ft_strsub(dst, 0, i); dst = del_line(dst, i + 1); return (1); }
static gboolean press_key(IMAGE *ima, GdkEventKey * event){ gboolean ret = FALSE; if(event->state & (GDK_CONTROL_MASK)){ switch(event->keyval){ // ctrl+n inserts a line case 'n': case 'N': newline(ima); ret = TRUE; break; // ctrl+d deletes current line case 'd': case 'D': ret = del_line(ima); break; // ctrl+w closes the window case 'w': case 'W': close_dlg(); } } return ret; }
/*** Remove an entire line ***/ void amiga_k(Project p) { LINE *del = p->edited; if(p->ccp.select) return; /* In there a next line, move cursor to */ if( del->next ) { p->edited=del->next; p->max_lines--; if(p->show==del) p->show=del->next; prop_adj(p); } /* Adjust cursor position */ inv_curs(p,FALSE); del_line(&p->undo, &p->the_line, del); p->nbrc = adjust_rc(p->edited, p->nbrwc, &p->nbc, FALSE); REDRAW_CURLINE(p); scroll_up(p, p->edited->next, p->ycurs, center_horiz(p)); inv_curs(p,TRUE); }
void cut_line(t_cmdline *cmd) { int i; int d; i = cmd->cursor; d = cmd->delt_select; if (cmd->keep) free(cmd->keep); if (d > i) { cmd->keep = ft_strnew(d - i); ft_strncpy(cmd->keep, cmd->buffer + i, d - i); } else { cmd->keep = ft_strnew(i - d); ft_strncpy(cmd->keep, cmd->buffer + d, i - d); } del_line(cmd); }
void user_configuration() { cls(); del_line(); m_print(bbstxt[B_CONFIG_HEADER]); m_print(bbstxt[B_CONFIG_NAME],usr.name); m_print(bbstxt[B_CONFIG_ALIAS], usr.handle, usr.voicephone); m_print(bbstxt[B_CONFIG_CITY], usr.city, usr.dataphone); m_print(bbstxt[B_CONFIG_LENGTH], usr.len, usr.formfeed ? bbstxt[B_YES] : bbstxt[B_NO], usr.nulls); m_print(bbstxt[B_CONFIG_MORE], usr.more ? bbstxt[B_YES] : bbstxt[B_NO], usr.scanmail ? bbstxt[B_YES] : bbstxt[B_NO], usr.tabs ? bbstxt[B_YES] : bbstxt[B_NO]); m_print(bbstxt[B_CONFIG_ANSI], usr.ansi ? bbstxt[B_YES] : bbstxt[B_NO], usr.use_lore ? bbstxt[B_NO] : bbstxt[B_YES], usr.color ? bbstxt[B_YES] : bbstxt[B_NO]); m_print(bbstxt[B_CONFIG_AVATAR], usr.avatar ? bbstxt[B_YES] : bbstxt[B_NO], usr.full_read ? bbstxt[B_YES] : bbstxt[B_NO], usr.hotkey ? bbstxt[B_YES] : bbstxt[B_NO]); m_print(bbstxt[B_CONFIG_IBMSET], usr.ibmset ? bbstxt[B_YES] : bbstxt[B_NO]); m_print(bbstxt[B_CONFIG_LANGUAGE], &config->language[usr.language].descr[1]); m_print(bbstxt[B_CONFIG_SIGN],usr.signature); }
int main(int argc, char *argv[]) { int lbreak, last; char line[MAXLINE]; struct lines saved_lines; saved_lines.next_line = NULL; if (argc == 1) { lbreak = DEFAULT_BREAK_LINE; } else { if (strcmp(argv[1], "-help") == 0) { printf("\nUsage: -help for help\n -bp n to break point where n is the size\nNo arguments a default value will be set\n"); return 0; } else if (strcmp(argv[1], "-bp") == 0) { lbreak = getvalue(argv[2]); if (lbreak < 0) { printf("Wrong argument\n"); return -1; } } else { printf("Wrong argument\n"); return -1; } } while ((last = read_line(line))) { save_line(&saved_lines, line); del_line(line); if (last == LAST_LINE) { break; } } line_sort(&saved_lines, lbreak); print(&saved_lines); return 0; }
void main() { int a; int x,y; in_box(); c_block_n=8; randomize(); num=random(7); while(1) { del_line(); if(c_block_n==8) { c_block_n=num; num=random(7); for(x=0; x<5; x++) { for(y=0; y<5; y++) { c_block[x][y]=block[c_block_n][x][y]; } } x_b=6/2; y_b=0; if(!clash()) { gotoxy(27,10); printf("GAME OVER"); gotoxy(23,11); printf("press ESC to exit"); gotoxy(22,12); printf("press 1 to new game"); while(1) { a=getch(); if(a==49) { system("cls"); gotoxy(25,10); printf("NEW GAME LOADING"); gotoxy(23,12); printf("press KEY to new game"); getch(); system("cls"); in_box(); break; } else if(a==27) { exit(1); } else { continue; } } } } Time++; out_box(); if(Time>=stage[score/50]) { down(); Time=0; continue; } if(kbhit()) { key(); } } }???耀?呻??耀b??潤???耀x??????耀????耀??祝???耀????耀????耀??????耀???f耀????耀???耀???耀????向??耀????耀?吝?
void title_handle_key_evt (struct android_app* app, AInputEvent* event) { Context* context = (Context*) app->userData; int32_t key_code, i; if (AKeyEvent_getAction(event) != AKEY_EVENT_ACTION_UP) { return; } key_code = AKeyEvent_getKeyCode(event); switch (context->title->state) { case TITLE_STATE_LOAD_PROFILE: if (key_code == AKEY_CODE_BACK) { title_transition(context, TITLE_STATE_MAIN); } break; case TITLE_STATE_NEW_PROFILE: if (key_code == AKEY_CODE_BACK) { title_transition(context, TITLE_STATE_MAIN); } else if ( key_code >= AKEY_CODE_A && key_code <= AKEY_CODE_Z && ( context->title->profile_name == NULL || strlen(context->title->profile_name) <= PROFILE_MAX_LEN ) ) { char c = key_code - AKEY_CODE_A + 'A'; if (context->title->profile_name == NULL) { context->title->profile_name = (char*) malloc((PROFILE_MAX_LEN + 1) * sizeof(char)); context->title->profile_line = (Line*) malloc(sizeof(Line)); context->title->profile_line->v_bufs = (vertex_buffer**) malloc(PROFILE_MAX_LEN * sizeof(vertex_buffer*)); context->title->profile_line->x = 0; context->title->profile_line->y = SCREEN_TOP + GLYPH_SIZE + LINE_GAP; context->title->profile_line->len = 0; context->title->profile_name[0] = c; context->title->profile_name[1] = '\0'; } else { context->title->profile_name[ context->title->profile_line->len ] = c; context->title->profile_name[ context->title->profile_line->len+1 ] = '\0'; } write_char(context->glyphs, context->title->profile_line, c); } else if (key_code == AKEY_CODE_DEL) { if (context->title->profile_name == NULL) { return; } if (context->title->lines[1] != NULL) { del_line(context->glyphs, context->title->lines[1]); } if (strlen(context->title->profile_name) == 1) { free(context->title->profile_name); context->title->profile_name = NULL; del_line(context->glyphs, context->title->profile_line); } else { del_char(context->glyphs, context->title->profile_line); context->title->profile_name[ context->title->profile_line->len ] = '\0'; } } else if (key_code == AKEY_CODE_ENTER) { int valid = 1; int idx = 0; for (i = 0; i < MAX_PROFILES; i++) { if (context->profiles[i] == NULL) { break; } if ( strcasecmp( context->profiles[i]->name , context->title->profile_name ) == 0 ) { valid = 0; } idx++; } if (!valid) { context->title->lines[1] = write_line( context->glyphs , 0 , SCREEN_TOP + (GLYPH_SIZE + LINE_GAP) * 3 , "Name in use" ); } else { context->profiles[i] = new_profile( context->app , context->title->profile_name , 0 , 0 ); context->profile = context->profiles[idx]; title_transition(context, TITLE_STATE_MAIN); } } break; } }
void Program::flush(){ while(!is_empty()){ del_line(0); } }
int main(int argc, char **argv) { FILE *in; char str[1024], r[128], t[128]; int i, j, k, n; char *s, *u; if (argc != 3) { fprintf(stderr, "usage: cnvasm <input-asm> <output-asm>\n"); return EXIT_SUCCESS; } lines = (char **) malloc(sizeof(char *)); if (!(in = fopen(argv[1], "r"))) { perror(argv[1]); exit(EXIT_FAILURE); } printf("- Finetuning %s\n", argv[1]); printf("- Reading code lines: "); while (!feof(in)) { fgets(str, 1024, in); add_line(lineno, str); } printf("done\n"); /* * This is the stack trick. Watch for the comments to see how this * works. */ n = find_line(".rodata"); if (n > -1) { printf("- Copying data fields to the text segment: "); /* * After locating the .rodata section, find the .text section * and the end of the code ending with .Lfe. (this is a.out * syntax). */ k = find_line_from(".text", n); j = find_line_from(".Lfe", k); /* * Copy each line from the .rodata section starting with .LC * to the text section after the .Lfe mark. In order words * use a part of the code that is not executed. The code ends * at .Lfe. */ for (i = k - 1; i > n; i--) { s = get_line(i); if ((u = strstr(s, ".LC"))) { strcpy(s, u + 1); } add_line(j, s); printf("."); } printf(" done\n"); /* * Remove the lines copied above from the .rodata section */ printf("- Removing data fields in the data segment: "); for (i = k - 1; i >= n; i--) { del_line(i); printf("."); } printf(" done\n"); /* * Find all instruction that used the addresses from .rodata. */ printf("- Patching data field addresses (pushl): "); for (j = 0, i = 0; (i = find_line_from("pushl $.LC", i)) > -1; j++, i++) { /* * This loop looks for simple "pushl $.LC?" instructions. * if one is found it is replaced by a sequence of instructions. * See below. */ strncpy(r, strchr(get_line(i), '$') + 2, 128); r[strlen(r) - 1] = 0; /* * Find the line that holds the data for the found .LC? data. * Remember, those have been copied to the text segment just * before. */ snprintf(t, 128, "%s:", r); n = find_line(t); /* * Add the call before the definition of .LC? */ snprintf(t, 128, "\tcall BF%d\n", j); add_line(n + 1, t); /* * Replace the pushl with a jmp and a label. */ snprintf(t, 128, "\tjmp %s\n", r); set_line(i, t); snprintf(t, 128, "BF%d:\n", j); add_line(i + 1, t); printf("."); } printf(" done\n"); printf("- Patching data field addresses (movl): "); for (i = 0; (i = find_line_from("movl $.LC", i)) > -1; j++, i++) { /* * This loop looks for simple "movl $.LC?" instructions. * if one is found it is replaced by a sequence of instructions. * See below. */ strncpy(r, strchr(get_line(i), '$') + 2, 128); r[3] = 0; /* * Find the line that holds the data for the found .LC? data. * Remember, those have been copied to the text segment just * before. */ snprintf(t, 128, "%s:", r); n = find_line(t); /* * Add a call before the definition of .LC? */ snprintf(t, 128, "\tcall BF%d\n", j); add_line(n + 1, t); /* * Replace the movl with a jmp, a label and a final popl * that retrieves the address from the stack and gets it back * to the register used in the inital movl. */ snprintf(t, 128, "\tjmp %s\n", r); strncpy(r, strchr(get_line(i), '%'), 128); r[strlen(r) - 1] = 0; set_line(i, t); snprintf(t, 128, "BF%d:\n", j); add_line(i + 1, t); snprintf(t, 128, "\tpopl %s\n", r); add_line(i + 2, t); printf("."); } printf(" done\n"); } /* * Add the magic entry point and a pushl dx instruction. Most other * register are pushed by default, dx isn't. */ printf("- Adding magic entry point.\n"); k = find_line("main:"); add_line(k + 1, "\tpushl %edx\n"); add_line(k + 1, "\tmovl 0xaffeaffe,%ebp\n"); /* * Prepare the end of the code to hold a placeholder for host_entry * and restore the dx register by issuing a popl edx. */ printf("- Adding magic exit point.\n"); k = find_line_from("\tret", k); set_line(k, "\tjmp *%ebp\n"); add_line(k, "\tmovl $0xdeadbeef,%ebp\n"); add_line(k, "\tpop %edx\n"); fclose(in); /* * Write the new file. */ if (!(in = fopen(argv[2], "w"))) { perror(argv[2]); exit(EXIT_FAILURE); } for (i = 0; i < lineno; i++) fputs(get_line(i), in); fclose(in); return EXIT_SUCCESS; }
void display_screen (int toprow, int width, int len) { int i, crow, m; char *p, linea[128], adjusted[26], *a; p = txtptr; crow = 0; // strcat(txtptr,"\n");// fix volante :-)) for (i = 0; i < 26; i++) { oldrow[i] = screenrow[i]; screenrow[i] = NULL; adjusted[i] = 0; } do { if (crow && *p == '\n') p++; if (crow >= toprow) screenrow[crow - toprow] = p; i = 0; while (i < width && *p != '\0' && *p != '\n') linea[i++] = *p++; linea[i] = '\0'; if (i >= width && strchr (linea, ' ') != NULL) { while (*p != ' ') { p--; i--; } linea[i] = '\0'; while (*p == ' ') p++; } if (crow >= toprow) { if ((crow - toprow + 1) >= 26) break; } crow++; } while (*p != '\0'); crow = -1; for (i = 0; i < len; i++) { if (screenrow[i] == NULL) break; if (ptr >= screenrow[i] && (ptr < screenrow[i + 1] || screenrow[i + 1] == NULL)) crow = i + 1; if (screenrow[i] != oldrow[i]) { if (i && !adjusted[i - 1]) { i--; m = (int)(screenrow[i + 1] - screenrow[i]); strncpy (linea, screenrow[i], m); if (linea[m - 1] == '\n') m--; linea[m] = '\0'; gotoxy_s (1, i + 1); del_line (); if ((a = strchr (linea, '>')) == NULL) change_attr (CYAN|_BLACK); else if ((int)(linea - a) <= 5) change_attr (YELLOW|_BLACK); m_print ("%s", linea); i++; } if (screenrow[i + 1] == NULL) m = strlen (screenrow[i]); else m = (int)(screenrow[i + 1] - screenrow[i]); strncpy (linea, screenrow[i], m); if (linea[m - 1] == '\n') m--; linea[m] = '\0'; gotoxy_s (1, i + 1); del_line (); if ((a = strchr (linea, '>')) == NULL) change_attr (CYAN|_BLACK); else if ((int)(linea - a) <= 5) change_attr (YELLOW|_BLACK); m_print ("%s", linea); adjusted[i] = 1; } } if (crow == -1) crow = i + 1; if (crow <= len) { crow--; if (screenrow[crow + 1] == NULL) m = strlen (screenrow[crow]); else m = (int)(screenrow[crow + 1] - screenrow[crow]); strncpy (linea, screenrow[crow], m); if (linea[m - 1] == '\n') m--; linea[m] = '\0'; if (cy != crow) strcpy (editrow, linea); m = (int)(ptr - screenrow[crow]); if (!adjusted[crow] && strcmp (editrow, linea)) { if ((a = strchr (linea, '>')) == NULL) change_attr (CYAN|_BLACK); else if ((int)(linea - a) <= 5) change_attr (YELLOW|_BLACK); if (m) { if (m < cx) gotoxy_s (m, crow + 1); m_print ("%s", &linea[m - 1]); } else { gotoxy_s (m + 1, crow + 1); m_print ("%s", &linea[m]); } del_line (); strcpy (editrow, linea); if (linea[m] || m < cx) gotoxy_s (m + 1, crow + 1); } else { strcpy (editrow, linea); gotoxy_s (m + 1, crow + 1); } } // txtptr[strlen(txtptr)-1]='\0'; // fix volante per eliminare piccolo bachetto.. #ifdef __OS2__ UNBUFFER_BYTES (); VioUpdate (); #endif cx = m; cy = crow; }
void edit_file (char *name, int len, int width) { int fd, i, startrow, m; char insert, *p, savefile = 0, endrun = 0; #ifdef __OS2__ if ((txtptr = malloc (MAX_SIZE)) == NULL) return; #else if ((txtptr = farmalloc (MAX_SIZE)) == NULL) return; #endif memset (txtptr, 0, MAX_SIZE); for (i = 0; i < 26; i++) { oldrow[i] = NULL; screenrow[i] = NULL; } if ((fd = sh_open (name, SH_DENYRW, O_RDONLY|O_TEXT, S_IREAD|S_IWRITE)) != -1) { i = read (fd, txtptr, MAX_SIZE - 1); txtptr[i] = '\0'; close (fd); unlink (name); ptr = txtptr; while (*ptr) { if (*ptr == 0x01) *ptr = '@'; ptr++; } } clrscr_s (); ptr = txtptr; startrow = 0; width--; insert = 1; editrow[0] = '\0'; display_screen (startrow, width, len); while (!endrun && CARRIER) { if ((i = readkey ()) == -1) continue; if (i == 0x1A || i == 0x2C1A) { savefile = 1; break; } switch (i) { // Home case 0x4700: if (ptr != screenrow[cy]) { ptr = screenrow[cy]; display_screen (startrow, width, len); } break; // End case 0x4F00: if (screenrow[cy + 1] == NULL) { p = strchr (screenrow[cy], '\0'); if (ptr != p) { ptr = p; display_screen (startrow, width, len); } } else if (ptr != screenrow[cy + 1] - 1) { ptr = screenrow[cy + 1] - 1; display_screen (startrow, width, len); } break; // Freccia su' case CTRLE: case 0x4800: if (cy <= 0) { if (startrow <= 0) break; if (startrow >= 10) startrow -= 10; else startrow = 0; } else cy--; if (screenrow[cy + 1] == NULL) m = strlen (screenrow[cy]); else m = (int)(screenrow[cy + 1] - screenrow[cy]); if (m && screenrow[cy][m - 1] == '\n') m--; if (cx > m) cx = m; ptr = screenrow[cy] + cx; cy++; display_screen (startrow, width, len); break; // Freccia giu' case CTRLX: case 0x5000: if (screenrow[cy + 1] == NULL) break; if (cy >= (len - 1)) { startrow += 10; clrscr_s (); } cy++; if (screenrow[cy + 1] == NULL) m = strlen (screenrow[cy]); else m = (int)(screenrow[cy + 1] - screenrow[cy]); if (m && screenrow[cy][m - 1] == '\n') m--; if (cx > m) cx = m; ptr = screenrow[cy] + cx; cy--; display_screen (startrow, width, len); break; // Freccia sinistra case CTRLS: case 0x4B00: if (cx && ptr > txtptr) { ptr--; display_screen (startrow, width, len); } break; // Freccia destra case CTRLD: case 0x4D00: if (ptr + 1 < screenrow[cy + 1]) { ptr++; display_screen (startrow, width, len); } break; // CTRL-Y case 0x19: case 0x1519: if (screenrow[cy + 1] == NULL) { if (*ptr != '\0') { *ptr = '\0'; display_screen (startrow, width, len); } } else { strcpy (screenrow[cy], screenrow[cy + 1]); for (i=cy;i<26;i++) screenrow[i]=NULL; display_screen (startrow, width, len); } break; // Delete case 0x5300: case 0x7f: if (ptr >= txtptr) { strcpy (ptr, &ptr[1]); for (i = 0; i < 26; i++) screenrow[i] = NULL; display_screen (startrow, width, len); } break; // Backspace case 0x08: case 0x0E08: if (ptr > txtptr) { ptr--; strcpy (ptr, &ptr[1]); for (i = cy + 1; i < 26; i++) { if (screenrow[i] == NULL) break; screenrow[i]--; } if (cy <= 0 && cx <= 0) { if (startrow >= 10) startrow -= 10; else startrow = 0; clrscr_s (); display_screen (startrow, width, len); } else display_screen (startrow, width, len); } break; // Caratteri speciali (^K) case CTRLK: cpos (5, 2); m_print2 ("\026\001\020\234^K"); while ((i = readkey ()) == -1) { if (!CARRIER) break; } i &= 0xFF; i = toupper (i); if (i != 0x1B) { if (i < 32) m_print2 ("^%c", i + 0x40); else m_print2 ("%c", i); } switch (i) { case CTRLS: case 'S': endrun = 1; savefile = 1; break; case CTRLQ: case 'Q': endrun = 1; savefile = 0; break; case '?': if (!read_editor_help ()) break; clrscr_s (); for (i = 0; i < 26; i++) screenrow[i] = NULL; break; } cpos (5, 2); m_print2 ("\026\001\020\234 \026\001\003"); display_screen (startrow, width, len); break; // Redraw dello schermo case 0x0C: cls (); change_attr (BLUE|_LGREY); del_line (); m_print (" * %s\n", sys.msg_name); msg_attrib (&msg, last_msg + 1, 0, 0); change_attr (RED|_BLUE); del_line (); cpos (5, (usr.width ? usr.width : 80) - 18); m_print ("\026\001\020\234^Z=Save ^K?=Help"); change_attr (CYAN|_BLACK); m_print (bbstxt[B_ONE_CR]); for (i = 0; i < 26; i++) screenrow[i] = NULL; display_screen (startrow, width, len); break; // Caratteri speciali (^Q) case CTRLQ: cpos (5, 2); m_print2 ("\026\001\020\234^Q"); while ((i = readkey ()) == -1) { if (!CARRIER) break; } i &= 0xFF; i = toupper (i); if (i != 0x1B) { if (i < 32) m_print2 ("^%c", i + 0x40); else m_print2 ("%c", i); } switch (i) { case CTRLS: case 'S': if (ptr != screenrow[cy]) ptr = screenrow[cy]; break; case CTRLD: case 'D': if (ptr != screenrow[cy + 1] - 1) ptr = screenrow[cy + 1] - 1; break; } cpos (5, 2); m_print2 ("\026\001\020\234 \026\001\003"); display_screen (startrow, width, len); break; // Enter case 0x0D: case 0x1C0D: i = '\n'; // Fall through // Carattere normale default: if ((i &= 0xFF) < 32 && i != '\n') break; if (insert) { p = &ptr[strlen (ptr)]; while (p >= ptr) { *(p + 1) = *p; p--; } *ptr++ = i; for (i = cy + 1; i < 26; i++) { if (screenrow[i] == NULL) break; screenrow[i]++; } } else { if (*ptr == '\0') { *ptr++ = i; *ptr = '\0'; } else *ptr++ = i; } display_screen (startrow, width, len); if (cy >= (len)) { startrow += 10; clrscr_s (); display_screen (startrow, width, len); } break; } } cls (); if (savefile) { if ((fd = sh_open (name, SH_DENYRW, O_WRONLY|O_TEXT|O_CREAT|O_TRUNC, S_IREAD|S_IWRITE)) != -1) { write (fd, txtptr, strlen (txtptr)); close (fd); } } #ifdef __OS2__ free (txtptr); #else farfree (txtptr); #endif }