home *** CD-ROM | disk | FTP | other *** search
- #include <iibclib.h>
- #include <iibdb.h>
-
- static char emp[] = "Press any key to continue";
-
- int scroll( int direction,
- int rulh,
- int culh,
- int rbrh,
- int cbrh,
- int scrl_lines,
- int attrib)
-
- {
- union REGS inregs;
-
- inregs.h.ah = (unsigned char) direction;
- inregs.h.al = (unsigned char) scrl_lines;
- inregs.h.ch = (unsigned char)(rulh-1);
- inregs.h.cl = (unsigned char)(culh-1);
- inregs.h.dh = (unsigned char)(rbrh-1);
- inregs.h.dl = (unsigned char)(cbrh-1);
- inregs.h.bh = (unsigned char)(attrib);
-
- int86(0x10,&inregs,&inregs);
-
- return(0);
-
- } /* end scroll */
- /*---------------------------------------------------------------------------*/
-
-
- void print_message(char *message,
- int rulh,
- int culh)
-
- {
- int m_length;
-
- m_length = strlen(message);
- _settextwindow(rulh,culh,rulh,80-culh+1);
- _clearscreen(_GWINDOW);
- _settextposition(1,2);
- _outtext(message);
- _settextposition(1,culh + m_length + 3);
- _outtext(emp);
- my_wait();
- _clearscreen(_GWINDOW);
- } /* end print_message */
- /*---------------------------------------------------------------------------*/
-
-
- void frame(int rulh,
- int culh,
- int rows,
- int columns,
- int frground,
- long bkground)
-
- {
- int i;
- int rbrh;
- int cbrh;
- char frame_char[2];
-
- frame_char[0] = '\0';
- frame_char[1] = '\0';
-
- _settextcolor(frground);
- _setbkcolor(bkground);
- _settextwindow(1,1,25,80);
-
- rbrh = rulh + rows - 1;
- cbrh = culh + columns - 1;
-
- frame_char[0] = '═';
- for (i=culh+1;i<=cbrh;i++ )
- {
- _settextposition(rulh,i);
- _outtext(frame_char);
- _settextposition(rbrh,i);
- _outtext(frame_char);
- } /* endfor */
-
- frame_char[0] = '║';
- for (i=rulh+1; i<rbrh; i++)
- {
- _settextposition(i,culh);
- _outtext(frame_char);
- _settextposition(i,cbrh);
- _outtext(frame_char);
- } /* endfor */
-
- frame_char[0] = '╔';
- _settextposition(rulh,culh);
- _outtext(frame_char);
-
- frame_char[0] = '╚';
- _settextposition(rbrh,culh);
- _outtext(frame_char);
-
- frame_char[0] = '╗';
- _settextposition(rulh,cbrh);
- _outtext(frame_char);
-
- frame_char[0] = '╝';
- _settextposition(rbrh,cbrh);
- _outtext(frame_char);
- } /* end frame */
- /*---------------------------------------------------------------------------*/
-
-
- void show_option(int row,
- int col,
- char *message,
- char justify_flag,
- int frgrd_clr,
- long bkgrd_clr)
-
- {
- _wrapon(_GWRAPOFF);
- switch (justify_flag)
- {
- case 'l':
- case 'L':
- _settextwindow(row,col,row,col+strlen(message)-1);
- break;
- case 'c':
- case 'C':
- _settextwindow(row,col-strlen(message)/2,row,col+strlen(message)/2);
- break;
- case 'r':
- case 'R':
- _settextwindow(row,col-strlen(message)+1,row,col);
- break;
- default :
- _settextposition(1,1);
- } /* endswitch */
- _settextcolor(frgrd_clr);
- _setbkcolor(bkgrd_clr);
- _settextposition(1,1);
- _outtext(message);
- _settextcolor(env.frgrd[0]);
- _setbkcolor(env.bkgrd[0]);
- _settextwindow(1,1,25,80);
- } /* end show_option */
- /*---------------------------------------------------------------------------*/
-
-
- char box_message(int bell_flag,
- int shadow_flag,
- char *message1,
- char *message2,
- char *message3)
-
- {
- char choice;
-
- if (bell_flag)
- {
- putchar(BELL);
- } /* endif */
- if (shadow_flag)
- {
- _setbkcolor(0L);
- _settextwindow(11,12,16,72);
- _clearscreen(_GWINDOW);
- } /* endif */
- _settextcolor(15);
- _setbkcolor(4L);
- _settextwindow(10,10,15,70);
- _clearscreen(_GWINDOW);
- _settextposition(2,2);
- _outtext(message1);
- _settextposition(3,2);
- _outtext(message2);
- _settextposition(4,2);
- _outtext(message3);
- choice = (char)getch();
- _settextcolor(env.frgrd[0]);
- _setbkcolor(env.bkgrd[0]);
- _settextwindow(1,1,25,80);
- _clearscreen(_GWINDOW);
- return(choice);
- } /* end box_message */
- /*---------------------------------------------------------------------------*/
-
-
- void display_message(char *message)
-
- {
-
- _settextcolor(env.frgrd[0]);
- _setbkcolor(env.bkgrd[0]);
- _settextwindow(1,1,25,80);
- _clearscreen(_GWINDOW);
- _setbkcolor(0L);
- _settextwindow(11,12,16,72);
- _clearscreen(_GWINDOW);
- _settextcolor(env.frgrd[5]);
- _setbkcolor(env.bkgrd[5]);
- _settextwindow(10,10,15,70);
- _clearscreen(_GWINDOW);
- _settextposition(3,2);
- _outtext(message);
- _settextcolor(env.frgrd[0]);
- _setbkcolor(env.bkgrd[0]);
- } /* end display_message */
- /* ------------------------------------------------------------------ */
-
-
- int set_cursor_off()
-
- {
- union REGS inregs;
-
- inregs.h.ah = 1;
- inregs.h.ch = 32;
- inregs.h.cl = 0;
-
- int86(0x10,&inregs,&inregs);
-
- return(0);
-
- } /* end set_cursor_off */
- /* ------------------------------------------------------------------ */
-
-
- int set_cursor_on(int start_line,
- int end_line)
-
- {
- union REGS inregs;
-
- inregs.h.ah = 1;
- inregs.h.ch = (unsigned char)start_line;
- inregs.h.cl = (unsigned char)end_line;
-
- int86(0x10,&inregs,&inregs);
-
- return(0);
-
- } /* end set_cursor_on */
- /* ------------------------------------------------------------------ */
-
- void my_wait()
-
- {
- while (!kbhit())
- {
- ;
- } /* endwhile */
- getche();
- } /* end my_wait() */
- /*---------------------------------------------------------------------------*/
-
-
- int get_string( int frame_flag,
- char *field,
- int new_or_old,
- int all_upper,
- int rulh,
- int culh,
- int length)
-
- {
- char temp_buf[80];
- char input = '\0';
- int i;
- int quit = 0;
- int clean_flag = 1;
- int t_changed = 0;
- int insert_flag = 0;
- int goon = 1;
- int cur_pos = 0;
- int input_count = 0;
- int r_code;
-
- _settextcolor(env.frgrd[5]);
- _setbkcolor(env.bkgrd[5]);
-
- if (frame_flag)
- {
- _settextwindow(rulh,culh,rulh,culh+length+1);
- _wrapon(_GWRAPOFF);
- _clearscreen(_GWINDOW);
- _settextposition(1,1);
- _outtext("[");
- _settextposition(1,length+2);
- _outtext("]");
- _settextwindow(rulh,culh+1,rulh,culh+length);
- }
- else
- {
- _settextwindow(rulh,culh,rulh,culh+length-1);
- _wrapon(_GWRAPOFF);
- _clearscreen(_GWINDOW);
- } /* endif */
-
- if (new_or_old == OLD)
- {
- input_count = cur_pos = strlen(field);
- }
- else
- {
- field[0] = '\0';
- } /* endif */
-
- do
- {
- if (frame_flag)
- {
- _settextwindow(rulh,culh+1,rulh,culh+length);
- _clearscreen(_GWINDOW);
- _settextwindow(rulh,culh+1,rulh,culh+length+2);
- _settextposition(1,1);
- }
- else
- {
- _settextwindow(rulh,culh,rulh,culh+length-1);
- _clearscreen(_GWINDOW);
- _settextwindow(rulh,culh,rulh,culh+length);
- _settextposition(1,1);
- } /* endif */
- _outtext(field);
- _settextposition(1,cur_pos + 1);
- clean_flag = 0;
- t_changed = 0;
-
- input = (char)getch();
-
- if (input == '\0')
- {
- input = (char)getch();
- switch (input)
- {
- case INS_KEY:
- if (insert_flag)
- {
- show_option(25,80,"INSERT = OFF",'R',env.frgrd[2],env.bkgrd[2]);
- insert_flag = 0;
- }
- else
- {
- show_option(25,80,"INSERT = ON ",'R',env.frgrd[2],env.bkgrd[2]);
- insert_flag = 1;
- } /* endif */
- _settextwindow(rulh,culh+1,rulh,culh+length);
- _settextcolor(env.frgrd[5]);
- _setbkcolor(env.bkgrd[5]);
- break;
- case UP_ARROW:
- putchar(BELL);
- break;
- case DOWN_ARROW:
- putchar(BELL);
- break;
- case HOME:
- cur_pos= 0;
- break;
- case END:
- cur_pos=input_count;
- break;
- case LEFT_ARROW:
- if (cur_pos > 0)
- {
- cur_pos--;
- }
- else
- {
- putchar(BELL);
- } /* endif */
- break;
- case RIGHT_ARROW:
- if (cur_pos < input_count)
- {
- cur_pos++;
- }
- else
- {
- putchar(BELL);
- } /* endif */
- break;
- case DEL_KEY:
- if (input_count == 0 || cur_pos == input_count)
- {
- putchar(BELL);
- }
- else
- {
- strcpy(temp_buf,field);
- for (i=0; i < cur_pos - 1; i++)
- {
- field[i] = temp_buf[i];
- } /* endfor */
- for (i = cur_pos; i < input_count; i++)
- {
- field[i] = temp_buf[i+1];
- } /* endfor */
- input_count--;
- t_changed++;
- field[input_count] = '\0';
- } /* endif */
- break;
- case F1:
- field[input_count] = '\0';
- quit = 1;
- r_code = strlen(field);
- break;
- default :
- putchar(BELL);
- break;
- } /* endswitch */
- }
- else
- {
- if (input == '\033')
- {
- field[0] = '\0';
- quit = 1;
- r_code = -1;
- }
- else
- {
- if (input == '\015')
- {
- field[input_count] = '\0';
- quit = 1;
- r_code = strlen(field);
- }
- else
- {
- if (input == ',')
- {
- putchar(BELL);
- }
- else
- {
- if (input == '\b')
- {
- if (input_count == 0 || cur_pos == 0)
- {
- putchar(BELL);
- }
- else
- {
- if (cur_pos < input_count)
- {
- strcpy(temp_buf,field);
- for (i=0; i < cur_pos - 2; i++)
- {
- field[i] = temp_buf[i];
- } /* endfor */
- for (i = cur_pos - 1; i < input_count; i++)
- {
- field[i] = temp_buf[i+1];
- } /* endfor */
- } /* endif */
- cur_pos--;
- input_count--;
- t_changed++;
- field[input_count] = '\0';
- } /* endif */
- }
- else
- {
- if (input_count < length)
- {
- if (input_count == cur_pos)
- {
- if (all_upper)
- {
- field[input_count] = (char) toupper(input);
- }
- else
- {
- field[input_count] = input;
- } /* endif */
- field[input_count+1] = '\0';
- input_count++;
- cur_pos++;
- t_changed++;
- }
- else
- {
- if (insert_flag)
- {
- strcpy(temp_buf,field);
- for (i=0; i <= cur_pos - 1; i++)
- {
- field[i] = temp_buf[i];
- } /* endfor */
- if (all_upper)
- {
- field[cur_pos] = (char) toupper(input);
- }
- else
- {
- field[cur_pos] = input;
- } /* endif */
- for (i = cur_pos + 1; i <= input_count; i++)
- {
- field[i] = temp_buf[i-1];
- } /* endfor */
- input_count++;
- cur_pos++;
- field[input_count] = '\0';
- t_changed++;
- }
- else
- {
- putchar(BELL);
- } /* endif */
- } /* endif */
- }
- else
- {
- putchar(BELL);
- } /* endif */
- } /* endif */
- } /* endif */
- } /* endif */
- } /* endif */
- } /* endif */
- } while (!quit); /* enddo */
-
- _settextcolor(env.frgrd[0]);
- _setbkcolor(env.bkgrd[0]);
- _settextwindow(1,1,25,80);
- return(r_code);
-
- } /* end get_string */
- /* ------------------------------------------------------------------ */
-
-
- char yes_or_no(char *question,
- int rulh,
- int culh)
-
- {
- char temp;
- int q_length;
-
- q_length = strlen(question);
- _settextwindow(rulh,culh,rulh,q_length + 10);
- _clearscreen(_GWINDOW);
- _settextposition(1,2);
- _outtext(question);
- _settextposition(1,q_length);
- _outtext(" (y/n) ?: ");
- temp = (char)getchar();
- if(temp == 'y'|| temp == 'Y' || temp == 'n'|| temp == 'N')
- {
- return((char)tolower((int)temp));
- }
- else
- {
- yes_or_no(question,rulh,culh);
- } /* endif */
-
- } /* end yes_or_no() */
- /*---------------------------------------------------------------------------*/
-
-
- void jump_to_dos()
-
- {
- _clearscreen(_GWINDOW);
- _settextposition(1,1);
- _outtext("Do not load any new TSR (Terminate and Stay Resident) programs.\n");
- _outtext("Type \'exit\' and press <RETURN> to return to this programs.\n");
- _outtext(emp);
- my_wait();
- putenv("PROMPT=DOS SHELL (Type exit to return to program)$_$p$g");
- _clearscreen(_GCLEARSCREEN);
- system("command");
-
- } /* end jump_to_dos */
- /*---------------------------------------------------------------------------*/
-
-
- int handler()
- {
- signal(SIGINT, SIG_IGN);
- signal(SIGINT,handler);
- return(0);
- } /* end handler */
- /*---------------------------------------------------------------------------*/
-
-
- int get_menu_option(struct menu_line *my_line,
- int line_number,
- char *top_msg,
- char *bottom_msg,
- char *help_file,
- int rulh,
- int culh)
-
- {
- int cur_line = 0;
- int old_cur_line;
- int cbrh = 0;
- int rbrh = 0;
-
- unsigned int page_width = 0;
- int i,j;
- int quit =0;
- int r_code = 0;
-
- char input;
-
- rbrh = rulh + line_number + 3;
- for (i=0; i<line_number; i++)
- {
- if (cbrh < (int) strlen(my_line[i].line))
- {
- cbrh = strlen(my_line[i].line);
- } /* endif */
- } /* endfor */
-
- cbrh = culh + cbrh + 3;
- cur_line = 1;
- old_cur_line = 1;
- page_width = cbrh - culh - 1;
-
- frame(rulh,culh,rbrh - rulh + 1,page_width + 2,env.frgrd[2],env.bkgrd[2]);
-
- if (strlen(top_msg) < page_width)
- {
- show_option(rulh,(cbrh+culh)/2,top_msg,'C',env.frgrd[1],env.bkgrd[1]);
- } /* endif */
- if (strlen(bottom_msg) < page_width)
- {
- show_option(rbrh,(cbrh+culh)/2,bottom_msg,'C',env.frgrd[1],env.bkgrd[1]);
- } /* endif */
- _settextwindow(rulh + 1,culh + 1,rbrh - 1,cbrh - 1);
- _settextcolor(env.frgrd[7]);
- _setbkcolor(env.bkgrd[7]);
- _clearscreen(_GWINDOW);
- set_cursor_off();
- _settextwindow(rulh + 2,culh + 2,rbrh - 2,cbrh - 2);
- for (j=0 ; j < line_number; j++)
- {
- _settextcolor(env.frgrd[7]);
- _setbkcolor(env.bkgrd[7]);
- _settextposition(j+1,1);
- _outtext(my_line[j].line);
- _settextcolor(env.frgrd[7]);
- _setbkcolor(env.bkgrd[7]);
- } /* endfor */
-
- do
- {
-
- time(&t_one);
-
- _settextwindow(rulh + 2,culh + 2,rbrh - 2,cbrh - 2);
-
- _settextcolor(env.frgrd[7]);
- _setbkcolor(env.bkgrd[7]);
- _settextposition(old_cur_line,1);
- _outtext(my_line[old_cur_line-1].line);
-
- _settextcolor(env.frgrd[8]);
- _setbkcolor(env.bkgrd[8]);
- _settextposition(cur_line,1);
- _outtext(my_line[cur_line-1].line);
-
- _settextcolor(env.frgrd[7]);
- _setbkcolor(env.bkgrd[7]);
-
- while (!kbhit())
- {
- time(&t_two);
- if (difftime(t_two,t_one) >= 1.00)
- {
- _strtime(time_buffer);
- show_option(1,80,time_buffer,'R',env.frgrd[1],env.bkgrd[1]);
- t_one = t_two;
- } /* endif */
- } /* endwhile */
-
- input = (char)getch();
- if (input == '\0')
- {
- input = (char)getch();
- switch (input)
- {
- case '\043':
- case '\073':
- if (help_file != NULL)
- {
- _setactivepage(1);
- _setvisualpage(1);
- _clearscreen(_GCLEARSCREEN);
- if (show_small_file(help_file,0,help_file,NULL,NULL,1,1,25,80))
- {
- box_message(1,1,"Help file not present.",emp,NULL);
- } /* endif */
- _setactivepage(0);
- _setvisualpage(0);
- set_cursor_off();
- } /* endif */
- break;
- case PAGE_UP:
- old_cur_line = cur_line;
- cur_line = 1;
- break;
- case UP_ARROW:
- old_cur_line = cur_line;
- cur_line--;
- if (cur_line <= 0)
- {
- cur_line = line_number;
- } /* endif */
- break;
- case PAGE_DOWN:
- old_cur_line = cur_line;
- cur_line = line_number;
- break;
- case DOWN_ARROW:
- old_cur_line = cur_line;
- cur_line++;
- if (cur_line > line_number)
- {
- cur_line = 1;
- } /* endif */
- break;
- case HOME:
- old_cur_line = cur_line;
- cur_line = 1;
- break;
- case END:
- old_cur_line = cur_line;
- cur_line = line_number;
- break;
- default :
- break;
- } /* endswitch */
- }
- else
- {
- if (isdigit(input) != 0)
- {
- old_cur_line = cur_line;
- cur_line = (int)input - 48;
- if (cur_line > line_number || cur_line < 0)
- {
- putchar(BELL);
- cur_line = old_cur_line;
- }
- else
- {
- if (cur_line == 0)
- {
- cur_line = line_number;
- } /* endif */
- quit = 1;
- r_code = cur_line;
- break;
- } /* endif */
- }
- else
- {
- switch (input)
- {
- case '\033':
- case 'Q':
- case 'q':
- quit = 1;
- r_code = -1;
- break;
- case '\015':
- quit = 1;
- r_code = cur_line;
- break;
- default :
- break;
- } /* endswitch */
- } /* endif */
- } /* endif */
- } while (!quit); /* enddo */
-
- _settextwindow(1,1,25,80);
- _settextcolor(env.frgrd[0]);
- _setbkcolor(env.bkgrd[0]);
- _clearscreen(_GWINDOW);
-
- set_cursor_on(7,7);
- return(r_code);
-
- } /* end get_menu_option */
- /*---------------------------------------------------------------------------*/
-
-
- int get_password(char *field,
- int all_upper,
- int rulh,
- int culh,
- int length)
-
- {
- char temp_buf[80];
- char input = '\0';
- int i,j;
- int quit = 0;
- int clean_flag = 1;
- int t_changed = 0;
- int insert_flag = 0;
- int goon = 1;
- int cur_pos = 0;
- int input_count = 0;
-
- _settextcolor(env.frgrd[5]);
- _setbkcolor(env.bkgrd[5]);
-
- _settextwindow(rulh,culh,rulh,culh+length+1);
- _wrapon(_GWRAPOFF);
- _clearscreen(_GWINDOW);
- _settextposition(1,1);
- _outtext("[");
- _settextposition(1,length+2);
- _outtext("]");
- _settextwindow(rulh,culh+1,rulh,culh+length);
-
- do
- {
- _settextwindow(rulh,culh+1,rulh,culh+length);
- _clearscreen(_GWINDOW);
- _settextwindow(rulh,culh+1,rulh,culh+length+2);
- for (j=0; j<input_count; j++)
- {
- _settextposition(1,j+1);
- _outtext("*");
- } /* endfor */
- _settextposition(1,cur_pos + 1);
- clean_flag = 0;
- t_changed = 0;
-
- input = (char)getch();
-
- if (input == '\0')
- {
- input = (char)getch();
- switch (input)
- {
- case INS_KEY:
- if (insert_flag)
- {
- show_option(25,80,"INSERT = OFF",'R',env.frgrd[1],env.bkgrd[1]);
- insert_flag = 0;
- }
- else
- {
- show_option(25,80,"INSERT = ON ",'R',env.frgrd[1],env.bkgrd[1]);
- insert_flag = 1;
- } /* endif */
- _settextwindow(rulh,culh+1,rulh,culh+length);
- _settextcolor(env.frgrd[5]);
- _setbkcolor(env.bkgrd[5]);
- break;
- case UP_ARROW:
- putchar(BELL);
- break;
- case DOWN_ARROW:
- putchar(BELL);
- break;
- case HOME:
- cur_pos= 0;
- break;
- case END:
- cur_pos=input_count;
- break;
- case LEFT_ARROW:
- if (cur_pos > 0)
- {
- cur_pos--;
- }
- else
- {
- putchar(BELL);
- } /* endif */
- break;
- case RIGHT_ARROW:
- if (cur_pos < input_count)
- {
- cur_pos++;
- }
- else
- {
- putchar(BELL);
- } /* endif */
- break;
- case DEL_KEY:
- if (input_count == 0 || cur_pos == input_count)
- {
- putchar(BELL);
- }
- else
- {
- strcpy(temp_buf,field);
- for (i=0; i < cur_pos - 1; i++)
- {
- field[i] = temp_buf[i];
- } /* endfor */
- for (i = cur_pos; i < input_count; i++)
- {
- field[i] = temp_buf[i+1];
- } /* endfor */
- input_count--;
- t_changed++;
- field[input_count] = '\0';
- } /* endif */
- break;
- default :
- putchar(BELL);
- break;
- } /* endswitch */
- }
- else
- {
- if (input == '\033')
- {
- field[0] = '\0';
- quit = 1;
- }
- else
- {
- if (input == '\015')
- {
- field[input_count] = '\0';
- quit = 1;
- }
- else
- {
- if (input == '\b')
- {
- if (input_count == 0 || cur_pos == 0)
- {
- putchar(BELL);
- }
- else
- {
- if (cur_pos < input_count)
- {
- strcpy(temp_buf,field);
- for (i=0; i < cur_pos - 2; i++)
- {
- field[i] = temp_buf[i];
- } /* endfor */
- for (i = cur_pos - 1; i < input_count; i++)
- {
- field[i] = temp_buf[i+1];
- } /* endfor */
- } /* endif */
- cur_pos--;
- input_count--;
- t_changed++;
- field[input_count] = '\0';
- } /* endif */
- }
- else
- {
- if (input_count < length)
- {
- if (input_count == cur_pos)
- {
- if (all_upper)
- {
- field[input_count] = (char) toupper(input);
- }
- else
- {
- field[input_count] = input;
- } /* endif */
- field[input_count+1] = '\0';
- input_count++;
- cur_pos++;
- t_changed++;
- }
- else
- {
- if (insert_flag)
- {
- strcpy(temp_buf,field);
- for (i=0; i <= cur_pos - 1; i++)
- {
- field[i] = temp_buf[i];
- } /* endfor */
- if (all_upper)
- {
- field[cur_pos] = (char) toupper(input);
- }
- else
- {
- field[cur_pos] = input;
- } /* endif */
- for (i = cur_pos + 1; i <= input_count; i++)
- {
- field[i] = temp_buf[i-1];
- } /* endfor */
- input_count++;
- cur_pos++;
- field[input_count] = '\0';
- t_changed++;
- }
- else
- {
- putchar(BELL);
- } /* endif */
- } /* endif */
- }
- else
- {
- putchar(BELL);
- } /* endif */
- } /* endif */
- } /* endif */
- } /* endif */
- } /* endif */
- } while (!quit); /* enddo */
-
- _settextcolor(env.frgrd[0]);
- _setbkcolor(env.bkgrd[0]);
- _settextwindow(1,1,25,80);
- return(0);
-
- } /* end get_password */
- /*---------------------------------------------------------------------------*/
-
-
- int show_small_file(char *file_name,int name_flag,
- char *msg,char *r_title1,char *r_title2,
- int rulh,int culh,int rbrh,int cbrh)
-
- {
- int in_file = 0;
- char bigbuff[257];
- int color_mask = 0;
-
- long file_length = 0L;
- long file_position = 0L;
-
- unsigned int max_line_length = 0;
-
- int i;
- int line_number = 1;
- int quit =0;
-
- struct long_file_line *my_line = NULL;
-
- my_line = (struct long_file_line *)calloc(line_number,sizeof(struct long_file_line));
- if (my_line == NULL)
- {
- box_message(1,1,"Memory allocation error",emp,NULL);
- free(my_line);
- return(2);
- } /* endif */
-
- in_file = sopen(file_name,O_RDONLY|O_BINARY,SH_DENYNO);
- if (in_file == -1)
- {
- free(my_line);
- _settextcolor(env.frgrd[0]);
- _setbkcolor(env.bkgrd[0]);
- return(11);
- }
- else
- {
- display_message("Reading File. Please Wait !");
- file_length = filelength(in_file);
- file_position = lseek(in_file,file_position,SEEK_SET);
- while (file_position < file_length - 1)
- {
- bigbuff[0] = '\0';
- read(in_file,bigbuff,256);
- i = 0;
- while (bigbuff[i] != '\r')
- {
- my_line[line_number-1].line[i] = bigbuff[i];
- i++;
- } /* endwhile */
- my_line[line_number-1].line[i] = '\0';
- my_line[line_number-1].line[i+1] = '\0';
- if (max_line_length < strlen(my_line[line_number-1].line))
- {
- max_line_length = strlen(my_line[line_number-1].line);
- } /* endif */
- line_number++;
- my_line = (struct long_file_line *)realloc(my_line,line_number*sizeof(struct long_file_line));
- if (my_line == NULL)
- {
- box_message(1,1,"Memory allocation error",emp,NULL);
- free(my_line);
- close(in_file);
- return(2);
- } /* endif */
- file_position = file_position + i + 2;
- file_position = lseek(in_file,file_position,SEEK_SET);
- } /* endwhile */
- close(in_file);
- } /* endif */
-
- line_number = line_number - 1;
- show_lines(file_name,name_flag,my_line,line_number,max_line_length,msg,r_title1,r_title2,rulh,culh,rbrh,cbrh);
-
- free(my_line);
-
- _settextcolor(env.frgrd[0]);
- _setbkcolor(env.bkgrd[0]);
-
- set_cursor_on(7,7);
- return(0);
-
- } /* end show_small_file */
- /* ------------------------------------------------------------------ */
-
- int show_lines(char *file_name,int name_flag,
- struct long_file_line *lines,int number_of_lines,
- unsigned int max_line_length,
- char *msg,char *r_title1,char *r_title2,
- int rulh,int culh,int rbrh,int cbrh)
- {
- int color_mask = 0;
- int page_length = 0;
- unsigned int page_width = 0;
- int i,j;
- int scrl_lines;
- int top_line = 0;
- int old_top = 0;
- int quit =0;
- int d_flag;
- int start;
- char screen_line[81];
- unsigned int start_col = 0;
- unsigned int old_start_col = 0;
-
- char title[78];
- char bottom_title[78];
- char input;
-
- strcpy(title,"[ ");
- strcat(title,msg);
- strcat(title," ]");
- strcpy(bottom_title,"Arrow Keys [PgUp] [PgDn] [Home] [End] = Move , P/p = print, [Esc] = quit");
-
- page_length = rbrh - rulh - 2;
-
- if (number_of_lines < page_length)
- {
- page_length = number_of_lines;
- rbrh = rulh + number_of_lines + 2;
- } /* endif */
-
- scrl_lines = page_length;
- start = 1;
- top_line = 0;
- d_flag = UP;
-
- page_width = cbrh - culh - 1;
-
- _settextwindow(1,1,25,80);
- _settextcolor(env.frgrd[3]);
- _setbkcolor(env.bkgrd[3]);
- _clearscreen(_GWINDOW);
-
- frame(rulh,culh,rbrh - rulh,page_width + 2,env.frgrd[2],env.bkgrd[2]);
-
- if (strlen(title) < page_width)
- {
- show_option(rulh,40,title,'C',env.frgrd[1],env.bkgrd[1]);
- } /* endif */
-
- if (strlen(bottom_title) < page_width)
- {
- show_option(rbrh-1,40,bottom_title,'C',env.frgrd[1],env.bkgrd[1]);
- } /* endif */
-
- _settextwindow(rulh + 1,culh + 1,rbrh - 2,cbrh - 1);
- _settextcolor(env.frgrd[3]);
- _setbkcolor(env.bkgrd[3]);
- _clearscreen(_GWINDOW);
- set_cursor_off();
-
- color_mask = 16*(int)env.bkgrd[3] + env.frgrd[3];
-
- do
- {
- if (scrl_lines != 0)
- {
- scroll(d_flag,rulh + 1,culh + 1,rbrh - 2,cbrh - 1,scrl_lines,color_mask);
- for (j=0 ; j < scrl_lines; j++)
- {
- _settextposition(start+j,1);
- i = 0;
- screen_line[i] = '\0';
- while (start_col + i < strlen(lines[j+top_line+start-1].line))
- {
- screen_line[i] = lines[j+top_line+start-1].line[start_col + i];
- i++;
- } /* endwhile */
- screen_line[i] = '\0';
- _outtext(screen_line);
- } /* endfor */
- } /* endif */
-
- input = (char)getch();
- old_top = top_line;
- old_start_col = start_col;
- if (input == '\0')
- {
- input = (char)getch();
- switch (input)
- {
- case PAGE_UP:
- d_flag = DOWN;
- start = 1;
- top_line -= page_length - 1;
- scrl_lines = abs(old_top - top_line);
- if (top_line < 0)
- {
- top_line = 0;
- scrl_lines = page_length;
- } /* endif */
- if (top_line == old_top)
- {
- scrl_lines = 0;
- } /* endif */
- break;
- case UP_ARROW:
- d_flag = DOWN;
- start = 1;
- top_line -= 1;
- if (top_line < 0)
- {
- top_line = 0;
- } /* endif */
- scrl_lines = abs(old_top - top_line);
- break;
- case PAGE_DOWN:
- d_flag = UP;
- start = 1;
- top_line += page_length ;
- scrl_lines = abs(old_top - top_line);
- if (top_line > number_of_lines - page_length)
- {
- top_line = number_of_lines - page_length;
- scrl_lines = page_length;
- } /* endif */
- if (top_line == old_top)
- {
- scrl_lines = 0;
- } /* endif */
- break;
- case DOWN_ARROW:
- d_flag = UP;
- start = page_length;
- top_line += 1;
- if (top_line > number_of_lines - page_length)
- {
- top_line = number_of_lines - page_length;
- } /* endif */
- scrl_lines = abs(old_top - top_line);
- break;
- case LEFT_ARROW:
- d_flag = UP;
- scrl_lines = page_length;
- start = 1;
- if (start_col > 0)
- {
- start_col = start_col -1;
- }
- else
- {
- start_col = 0;
- } /* endif */
- if (start_col == old_start_col)
- {
- scrl_lines = 0;
- } /* endif */
- break;
- case C_LEFT:
- d_flag = UP;
- scrl_lines = page_length;
- start = 1;
- start_col = 0;
- if (start_col == old_start_col)
- {
- scrl_lines = 0;
- } /* endif */
- break;
- case RIGHT_ARROW:
- d_flag = UP;
- scrl_lines = page_length;
- start = 1;
- if (max_line_length > page_width)
- {
- if (start_col < max_line_length - page_width)
- {
- start_col = start_col +1;
- }
- else
- {
- start_col = max_line_length - page_width;
- } /* endif */
- }
- else
- {
- start_col = 0;
- } /* endif */
- if (start_col == old_start_col)
- {
- scrl_lines = 0;
- } /* endif */
- break;
- case C_RIGHT:
- d_flag = UP;
- scrl_lines = page_length;
- start = 1;
- if (max_line_length > page_width)
- {
- start_col = max_line_length - page_width;
- }
- else
- {
- start_col = 0;
- } /* endif */
- if (start_col == old_start_col)
- {
- scrl_lines = 0;
- } /* endif */
- break;
- case HOME:
- d_flag = DOWN;
- start = 1;
- scrl_lines = page_length;
- top_line = 0;
- if (top_line == old_top && start_col == 0)
- {
- scrl_lines = 0;
- } /* endif */
- start_col = 0;
- break;
- case END:
- d_flag = UP;
- start = 1;
- scrl_lines = page_length;
- top_line = number_of_lines - page_length;
- if (top_line == old_top && start_col == 0)
- {
- scrl_lines = 0;
- } /* endif */
- start_col = 0;
- break;
- default :
- scrl_lines = 0;
- break;
- } /* endswitch */
- }
- else
- {
- switch (input)
- {
- case '\033':
- quit = 1;
- break;
- case 'p':
- case 'P':
- print_file(file_name,name_flag,r_title1,r_title2,max_line_length);
- quit = 1;
- break;
- default :
- scrl_lines = 0;
- break;
- } /* endswitch */
- } /* endif */
- } while (!quit); /* enddo */
-
- _settextcolor(env.frgrd[0]);
- _setbkcolor(env.bkgrd[0]);
- set_cursor_on(7,7);
- return(0);
-
- } /* end show_lines */
- /* ------------------------------------------------------------------ */
-
- void read_setup_file(struct video_info *env)
-
- {
- char user_field[21][61];
- int handle1;
- long f_position = 0L;
- long file_length = 0L;
- char bigbuff[151];
- char *filename;
-
- int counter = 0;
- int i,j,k;
-
- if ((filename = getenv("PDTSETUP")) == NULL)
- {
- filename = "setup.ini";
- } /* endif */
-
-
- handle1 = open(filename,O_RDONLY|O_BINARY,SH_DENYNO);
-
- if (handle1 == -1)
- {
- box_message(1,1,"cannot open setup file.",emp,NULL);
- exit(1);
- }
- else
- {
- file_length = filelength(handle1);
- f_position = lseek(handle1,f_position,SEEK_SET);
- bigbuff[0] = '\0';
- read(handle1,bigbuff,(int)file_length);
- i = 0;
- while (bigbuff[i] != '\r')
- {
- i++;
- } /* endwhile */
- bigbuff[i] = '\0';
- j = 0;
- counter = 0;
- for (k=0; k <= i;k++)
- {
- if (bigbuff[k] == ','|| bigbuff[k] == '\0')
- {
- user_field[counter][j] = '\0';
- counter++;
- j = 0;
- }
- else
- {
- user_field[counter][j] = bigbuff[k];
- j++;
- } /* endif */
- } /* endfor */
- close(handle1);
- } /* endif */
- env->bkgrd[0] = atol(user_field[0]);
- env->frgrd[0] = atoi(user_field[1]);
- env->bkgrd[1] = atol(user_field[2]);
- env->frgrd[1] = atoi(user_field[3]);
- env->bkgrd[2] = atol(user_field[4]);
- env->frgrd[2] = atoi(user_field[5]);
- env->bkgrd[3] = atol(user_field[6]);
- env->frgrd[3] = atoi(user_field[7]);
- env->bkgrd[4] = atol(user_field[8]);
- env->frgrd[4] = atoi(user_field[9]);
- env->bkgrd[5] = atol(user_field[10]);
- env->frgrd[5] = atoi(user_field[11]);
- env->bkgrd[6] = atol(user_field[12]);
- env->frgrd[6] = atoi(user_field[13]);
- env->bkgrd[7] = atol(user_field[14]);
- env->frgrd[7] = atoi(user_field[15]);
- env->bkgrd[8] = atol(user_field[16]);
- env->frgrd[8] = atoi(user_field[17]);
- env->bkgrd[9] = atol(user_field[18]);
- env->frgrd[9] = atoi(user_field[19]);
- strcpy(env->plant,user_field[20]);
- } /* end read_setup_file */
- /*---------------------------------------------------------------------------*/
-
-
- int verify_user(char *users_file,char *user_id,
- char *password,
- char *desired_access)
-
- {
- int r_code = 0;
- int found_it = 0;
- int i,j,k;
- char bigbuff[80];
- char user_field[3][30];
-
- int handle1 = 0;
- long f_position = 0L;
- long file_length = 0L;
- int counter = 0;
-
- display_message("Verifying user id and password");
- _settextcolor(env.frgrd[0]);
- _setbkcolor(env.bkgrd[0]);
- handle1 = sopen(users_file,O_RDONLY|O_BINARY,SH_DENYNO);
-
- if (handle1 == -1)
- {
- box_message(1,1,"Could not open users database.",emp,NULL);
- r_code = -1;
- }
- else
- {
- file_length = filelength(handle1);
- f_position = lseek(handle1,f_position,SEEK_SET);
- while (f_position < file_length - 1 && !found_it)
- {
- bigbuff[0] = '\0';
- read(handle1,bigbuff,80);
- i = 0;
- while (bigbuff[i] != '\r')
- {
- i++;
- } /* endwhile */
- bigbuff[i] = '\0';
- j = 0;
- counter = 0;
- for (k=0; k <= i;k++)
- {
- if (bigbuff[k] == ','|| bigbuff[k] == '\0')
- {
- user_field[counter][j] = '\0';
- counter++;
- j = 0;
- }
- else
- {
- if (bigbuff[k] != ' ')
- {
- user_field[counter][j] = bigbuff[k];
- j++;
- } /* endif */
- } /* endif */
- } /* endfor */
-
- if (strcmp(user_field[0],user_id) == 0 && strcmp(user_field[1],password) == 0)
- {
- if (strcmp(desired_access,"R") == 0)
- {
- found_it = 1;
- r_code = 1;
- }
- else
- {
- if (strcmp(user_field[2],desired_access) == 0)
- {
- found_it = 1;
- r_code = 1;
- }
- else
- {
- if (strcmp(desired_access,"W") == 0 && strcmp(user_field[2],"E") == 0)
- {
- found_it = 1;
- r_code = 1;
- }
- else
- {
- box_message(1,1,"Access level is not sufficient for this function.","Contact the help desk",emp);
- r_code = 0;
- } /* endif */
- } /* endif */
- } /* endif */
- }
- else
- {
- f_position = f_position + i + 2;
- f_position = lseek(handle1,f_position,SEEK_SET);
- } /* endif */
- } /* endwhile */
- close(handle1);
- } /* endif */
- return(r_code);
- } /* end verify_user */
- /*---------------------------------------------------------------------------*/
-
-
- int print_file(char *file_name,
- int name_flag,
- char *r_title1,
- char *r_title2,
- int line_length)
-
- {
-
- FILE *out_file = NULL;
- int in_file = 0;
- char bigbuff[257];
-
- long file_length = 0L;
- long file_position = 0L;
-
- int i;
- int p_quit =0;
- int p_flag = 1;
- int go_on = 1;
- int start_pos = 0;
- int i1,i2;
- char line[257];
-
- char printer_kind;
-
- in_file = sopen(file_name,O_RDONLY|O_BINARY,SH_DENYNO);
- if (in_file == -1)
- {
- return(11);
- }
- else
- {
- out_file = fopen("prn","w");
- if (out_file == NULL)
- {
- box_message(1,1,"Could not open printer.",emp,NULL);
- }
- else
- {
- p_flag = 1;
- while (!p_quit)
- {
- printer_kind = box_message(0,1,"Press H for HP LASER JET.","Press I for IBM PRO PRINTER.","Esc to quit");
- switch (printer_kind)
- {
- case '\033':
- p_quit = 1;
- p_flag = 0;
- break;
- case 'H':
- case 'h':
- fprintf(out_file,"E");
- fprintf(out_file,"(10U");
- if (line_length > 75)
- {
- fprintf(out_file,"(s16.66H");
- } /* endif */
- fprintf(out_file,"&l8D");
- p_quit = 1;
- break;
- case 'I':
- case 'i':
- fprintf(out_file,"%c",18);
- fprintf(out_file,"%c%c",27,79);
- if (line_length > 75)
- {
- fprintf(out_file,"%c",15);
- } /* endif */
- fprintf(out_file,"%c%c%c",27,78,6);
- p_quit = 1;
- break;
- default :
- ;
- } /* endswitch */
- } /* endwhile */
- if (p_flag)
- {
- _setbkcolor(0L);
- _settextwindow(11,12,16,72);
- _clearscreen(_GWINDOW);
- _settextcolor(env.frgrd[5]);
- _setbkcolor(env.bkgrd[5]);
- _settextwindow(10,10,15,70);
- _clearscreen(_GWINDOW);
- _settextposition(3,2);
- _outtext("File is being sent to the printer.");
- fprintf(out_file,"\n\n");
- if (r_title1 != NULL)
- {
- fprintf(out_file,"\t\t\t%s\n",r_title1);
- } /* endif */
- if (r_title2 != NULL)
- {
- fprintf(out_file,"\t\t\t%s\n",r_title2);
- } /* endif */
- if (name_flag)
- {
- fprintf(out_file,"\t File name: %s",file_name);
- fprintf(out_file,"\n\n");
- } /* endif */
- file_length = filelength(in_file);
- file_position = lseek(in_file,file_position,SEEK_SET);
- while (file_position < file_length - 1)
- {
- bigbuff[0] = '\0';
- read(in_file,bigbuff,256);
- i = 0;
- while (bigbuff[i] != '\r')
- {
- i++;
- } /* endwhile */
- bigbuff[i] = '\n';
- bigbuff[i+1] = '\0';
- file_position = file_position + i + 2;
- file_position = lseek(in_file,file_position,SEEK_SET);
- start_pos = 0;
- go_on = 1;
- while (go_on)
- {
- for (i1=0; i1<=line_length; i1++)
- {
- if (bigbuff[start_pos+i1] == '\n')
- {
- go_on = 0;
- line[i1] = bigbuff[start_pos+i1];
- line[i1+1] = '\0';
- i1 = line_length;
- }
- else
- {
- line[i1] = bigbuff[start_pos+i1];
- line[i1+1] = '\0';
- } /* endif */
- } /* endfor */
- for (i2=0; i2<line_length; i2++)
- {
- if (line[line_length - i2] == ',' || !go_on)
- {
- line[line_length - i2 + 1] = '\0';
- if (line[line_length - i2] == ',')
- {
- line[line_length - i2 + 1] = '\n';
- } /* endif */
- line[line_length - i2 + 2] = '\0';
- i2 = line_length;
- } /* endif */
- } /* endfor */
- start_pos = start_pos + strlen(line) - 1;
- fprintf(out_file,"\t%s",line);
- } /* endwhile */
- } /* endwhile */
- close(in_file);
-
- fprintf(out_file,"\f");
- if (printer_kind == 'H' || printer_kind == 'h')
- {
- fprintf(out_file,"E");
- }
- else
- {
- fprintf(out_file,"%c",18);
- fprintf(out_file,"%c%c",27,79);
- } /* endif */
- fflush(out_file);
- fclose(out_file);
- } /* endif */
- } /* endif */
- close(in_file);
- } /* endif */
- _settextcolor(env.frgrd[0]);
- _setbkcolor(env.bkgrd[0]);
- return(0);
- } /* end print_file */
- /*---------------------------------------------------------------------------*/
-
-
- int file_sort(char *file_name,
- int rec_length,
- int sort_field)
-
- {
- int file_handle = 0;
- long file_length = 0L;
- long rec_count;
-
- file_handle = sopen(file_name,O_RDWR|O_BINARY,SH_DENYNO);
- if (file_handle == -1)
- {
- return(11);
- }
- else
- {
- display_message("Sorting be patient !");
- file_length = filelength(file_handle);
- if (file_length != 0)
- {
- rec_count = file_length/(rec_length + 2);
- fsort(file_handle,0L,rec_count-1,sort_field,rec_length);
- } /* endif */
- } /* endif */
- close(file_handle);
-
- } /* end file_sort */
- /*---------------------------------------------------------------------------*/
-
-
- void fsort(int file_handle,
- long top,
- long bottom,
- int sort_field,
- int rec_length)
-
- {
- key_field[0] = '\0';
- mid_field[0] = '\0';
- top_field[0] = '\0';
- bot_field[0] = '\0';
-
- li = top;
- lj = bottom;
-
- get_key_field(file_handle,(long)(li+lj)/2,rec_length,sort_field,key_field);
- strcpy(mid_field,key_field);
-
- do
- {
- loop1 = 1;
- loop2 = 1;
- while (loop1)
- {
- get_key_field(file_handle,li,rec_length,sort_field,key_field);
- strcpy(top_field,key_field);
- if (strcmp(top_field,mid_field) < 0 && li < bottom)
- {
- li++;
- }
- else
- {
- loop1 = 0;
- } /* endif */
- } /* endwhile */
- while (loop2)
- {
- get_key_field(file_handle,lj,rec_length,sort_field,key_field);
- strcpy(bot_field,key_field);
- if (strcmp(bot_field,mid_field) > 0 && lj > top)
- {
- lj--;
- }
- else
- {
- loop2 = 0;
- } /* endif */
- } /* endwhile */
- if (li<=lj)
- {
- swap_records(file_handle,li,lj,rec_length);
- li++;
- lj--;
- } /* endif */
- } while (li <= lj); /* enddo */
-
- if (top < lj)
- {
- fsort(file_handle,top,lj,sort_field,rec_length);
- } /* endif */
-
- if (li < bottom)
- {
- fsort(file_handle,li,bottom,sort_field,rec_length);
- } /* endif */
- } /* end fsort */
- /*---------------------------------------------------------------------------*/
-
-
- void get_key_field(int file_handle,
- long rec_num,
- int rec_length,
- int sort_field,
- char *key_field)
-
- {
- char bigbuff[256];
- char user_field[15][61];
- int j,k,counter;
-
- bigbuff[0] = '\0';
- lseek(file_handle,rec_num*(rec_length+2),SEEK_SET);
- read(file_handle,bigbuff,rec_length + 2);
- bigbuff[rec_length + 2] = '\0';
- j = 0;
- counter = 0;
- for (k=0; k <= rec_length + 2;k++)
- {
- if (bigbuff[k] == ','|| bigbuff[k] == '\0')
- {
- user_field[counter][j] = '\0';
- counter++;
- j = 0;
- }
- else
- {
- user_field[counter][j] = bigbuff[k];
- j++;
- } /* endif */
- } /* endfor */
- strcpy(key_field,user_field[sort_field]);
- } /* end get_key_field */
- /*---------------------------------------------------------------------------*/
-
-
- void swap_records(int file_handle,
- long i,
- long j,
- int rec_length)
-
- {
- char bigbuff1[256];
- char bigbuff2[256];
-
- bigbuff1[0] = '\0';
- lseek(file_handle,i*(rec_length+2),SEEK_SET);
- read(file_handle,bigbuff1,rec_length + 2);
- bigbuff1[rec_length + 2] = '\0';
-
- bigbuff2[0] = '\0';
- lseek(file_handle,j*(rec_length+2),SEEK_SET);
- read(file_handle,bigbuff2,rec_length + 2);
- bigbuff2[rec_length + 2] = '\0';
-
- lseek(file_handle,j*(rec_length+2),SEEK_SET);
- write(file_handle,bigbuff1,rec_length + 2);
-
- lseek(file_handle,i*(rec_length+2),SEEK_SET);
- write(file_handle,bigbuff2,rec_length + 2);
- } /* swap_records */
- /*---------------------------------------------------------------------------*/
-
-
- int show_file(char *file_name,int name_flag,int rec_length,
- char *msg,char *r_title1,char *r_title2,
- int rulh,int culh,int rbrh,int cbrh)
- {
- int in_file = 0;
- char bigbuff[256];
- int color_mask = 0;
-
- long file_length = 0L;
- long file_position = 0L;
-
- int page_length = 0;
- int line_number = 0;
- int page_width = 0;
- int i,j;
- int top_line = 0;
- int old_top = 0;
- int quit =0;
- int d_flag;
- int scrl_lines;
- int start;
- int p_flag=1;
- int p_quit=0;
- char screen_line[81];
- int start_col = 0;
- int old_start_col = 0;
- int max_line_length = 0;
- long file_lines = 0;
-
- char title[78];
- char bottom_title[78];
- char input;
-
- struct long_file_line huge *my_line = NULL;
- max_line_length = rec_length;
-
- strcpy(title,"[ ");
- strcat(title,msg);
- strcat(title," ]");
-
- in_file = sopen(file_name,O_RDONLY|O_BINARY,SH_DENYNO);
- if (in_file == -1)
- {
- _settextcolor(env.frgrd[0]);
- _setbkcolor(env.bkgrd[0]);
- return(11);
- }
- else
- {
- display_message("Reading File. Please Wait !");
- file_length = filelength(in_file);
- file_position = lseek(in_file,file_position,SEEK_SET);
-
- file_lines = file_length/(rec_length + 2);
- if (file_lines > 512)
- {
- file_lines = 1024;
- } /* endif */
-
- my_line = (struct long_file_line huge *)halloc(file_lines,sizeof(struct long_file_line));
- if (my_line == NULL)
- {
- box_message(1,1,"Memory allocation error",emp,NULL);
- close(in_file);
- return(2);
- } /* endif */
- while (file_position < file_length - 1)
- {
- bigbuff[0] = '\0';
- read(in_file,bigbuff,255);
- i = 0;
- while (bigbuff[i] != '\r')
- {
- my_line[line_number].line[i] = bigbuff[i];
- i++;
- } /* endwhile */
- my_line[line_number].line[i] = '\0';
- my_line[line_number].line[i+1] = '\0';
- line_number++;
- file_position = file_position + i + 2;
- file_position = lseek(in_file,file_position,SEEK_SET);
- } /* endwhile */
- close(in_file);
- } /* endif */
-
- page_length = rbrh - rulh - 2;
-
- if (line_number < page_length)
- {
- page_length = line_number;
- rbrh = rulh + line_number + 2;
- } /* endif */
-
- scrl_lines = page_length;
- start = 1;
- top_line = 0;
- d_flag = UP;
-
- page_width = cbrh - culh - 1;
-
- _settextwindow(1,1,25,80);
- _settextcolor(env.frgrd[3]);
- _setbkcolor(env.bkgrd[3]);
- _clearscreen(_GWINDOW);
- frame(rulh,culh,rbrh - rulh,page_width + 2,env.frgrd[2],env.bkgrd[2]);
- strcpy(bottom_title,"Arrow Keys [PgUp] [PgDn] [Home] [End] = Move , P/p = print, [Esc] = quit");
- show_option(1,40,title,'C',env.frgrd[1],env.bkgrd[1]);
- show_option(25,40,bottom_title,'C',env.frgrd[1],env.bkgrd[1]);
-
- _settextwindow(rulh + 1,culh + 1,rbrh - 2,cbrh - 1);
- _settextcolor(env.frgrd[3]);
- _setbkcolor(env.bkgrd[3]);
- _clearscreen(_GWINDOW);
- set_cursor_off();
-
- color_mask = 16*(int)env.bkgrd[3] + env.frgrd[3];
-
- do
- {
- if (scrl_lines != 0)
- {
- scroll(d_flag,rulh + 1,culh + 1,rbrh - 2,cbrh - 1,scrl_lines,color_mask);
- for (j=0 ; j < scrl_lines; j++)
- {
- _settextposition(start+j,1);
- i = 0;
- screen_line[i] = '\0';
- while (start_col + i < max_line_length)
- {
- screen_line[i] = my_line[j+top_line+start-1].line[start_col + i];
- i++;
- } /* endwhile */
- screen_line[i] = '\0';
- _outtext(screen_line);
- } /* endfor */
- } /* endif */
-
- input = (char)getch();
- old_top = top_line;
- old_start_col = start_col;
- if (input == '\0')
- {
- input = (char)getch();
- switch (input)
- {
- case PAGE_UP:
- d_flag = DOWN;
- start = 1;
- top_line -= page_length - 1;
- scrl_lines = abs(old_top - top_line);
- if (top_line < 0)
- {
- top_line = 0;
- scrl_lines = page_length;
- } /* endif */
- if (top_line == old_top)
- {
- scrl_lines = 0;
- } /* endif */
- break;
- case UP_ARROW:
- d_flag = DOWN;
- start = 1;
- top_line -= 1;
- if (top_line < 0)
- {
- top_line = 0;
- } /* endif */
- scrl_lines = abs(old_top - top_line);
- break;
- case PAGE_DOWN:
- d_flag = UP;
- start = 1;
- top_line += page_length ;
- scrl_lines = abs(old_top - top_line);
- if (top_line > line_number - page_length)
- {
- top_line = line_number - page_length;
- scrl_lines = page_length;
- } /* endif */
- if (top_line == old_top)
- {
- scrl_lines = 0;
- } /* endif */
- break;
- case DOWN_ARROW:
- d_flag = UP;
- start = page_length;
- top_line += 1;
- if (top_line > line_number - page_length)
- {
- top_line = line_number - page_length;
- } /* endif */
- scrl_lines = abs(old_top - top_line);
- break;
- case LEFT_ARROW:
- d_flag = UP;
- scrl_lines = page_length;
- start = 1;
- if (start_col > 0)
- {
- start_col = start_col -1;
- }
- else
- {
- start_col = 0;
- } /* endif */
- if (start_col == old_start_col)
- {
- scrl_lines = 0;
- } /* endif */
- break;
- case C_LEFT:
- d_flag = UP;
- scrl_lines = page_length;
- start = 1;
- start_col = 0;
- if (start_col == old_start_col)
- {
- scrl_lines = 0;
- } /* endif */
- break;
- case RIGHT_ARROW:
- d_flag = UP;
- scrl_lines = page_length;
- start = 1;
- if (max_line_length > page_width)
- {
- if (start_col < max_line_length - page_width)
- {
- start_col = start_col +1;
- }
- else
- {
- start_col = max_line_length - page_width;
- } /* endif */
- }
- else
- {
- start_col = 0;
- } /* endif */
- if (start_col == old_start_col)
- {
- scrl_lines = 0;
- } /* endif */
- break;
- case C_RIGHT:
- d_flag = UP;
- scrl_lines = page_length;
- start = 1;
- if (max_line_length > page_width)
- {
- start_col = max_line_length - page_width;
- }
- else
- {
- start_col = 0;
- } /* endif */
- if (start_col == old_start_col)
- {
- scrl_lines = 0;
- } /* endif */
- break;
- case HOME:
- d_flag = DOWN;
- start = 1;
- scrl_lines = page_length;
- top_line = 0;
- if (top_line == old_top && start_col == 0)
- {
- scrl_lines = 0;
- } /* endif */
- start_col = 0;
- break;
- case END:
- d_flag = UP;
- start = 1;
- scrl_lines = page_length;
- top_line = line_number - page_length;
- if (top_line == old_top && start_col == 0)
- {
- scrl_lines = 0;
- } /* endif */
- start_col = 0;
- break;
- default :
- scrl_lines = 0;
- break;
- } /* endswitch */
- }
- else
- {
- switch (input)
- {
- case '\033':
- quit = 1;
- break;
- case 'p':
- case 'P':
- print_file(file_name,name_flag,r_title1,r_title2,max_line_length);
- quit = 1;
- break;
- default :
- scrl_lines = 0;
- break;
- } /* endswitch */
- } /* endif */
- } while (!quit); /* enddo */
-
- hfree(my_line);
- _settextcolor(env.frgrd[0]);
- _setbkcolor(env.bkgrd[0]);
- set_cursor_on(7,7);
- return(0);
- } /* end show_file */
- /*---------------------------------------------------------------------------*/
-
-
- int compress(char *f_name,char *old_name,int size)
-
- {
-
- int handle1,handle2;
- char tmp_name[9];
- char bigbuff[257];
- char temp[257];
- int i;
- long file_length = 0L;
- long f_position = 0L;
- int r_counter = 0;
-
- strcpy(tmp_name,"IIXXXXXX");
- if (mktemp(tmp_name) == NULL )
- {
- box_message(1,1,"Could not create temp name in compress.",
- "Contact The Help Desk",emp);
- }
- else
- {
- handle1 = sopen(f_name,O_RDONLY|O_BINARY,SH_DENYNO);
- handle2 = open(tmp_name,O_CREAT|O_RDWR,S_IWRITE);
-
- if (handle1 == -1)
- {
- return(-1);
- }
- else
- {
- file_length = filelength(handle1);
- if (file_length > size)
- {
- display_message("Compressing File. Please Wait !");
- f_position = lseek(handle1,f_position,SEEK_SET);
- while (f_position < file_length - 1)
- {
- if (locking(handle1,LK_LOCK,256L) != -1)
- {
- read(handle1,bigbuff,256);
- lseek(handle1,f_position,SEEK_SET);
- locking(handle1,LK_UNLCK,256L);
- i = 0;
- while (bigbuff[i] != '\r')
- {
- temp[i] = bigbuff[i];
- i++;
- } /* endwhile */
- temp[i] = '\n';
- if (temp[0] != '#' && temp[8] != '#')
- {
- write(handle2,temp,i+1);
- } /* endif */
- f_position = f_position + i + 2;
- f_position = lseek(handle1,f_position,SEEK_SET);
- }
- else
- {
- box_message(1,1,"Compress 2265: Locking Failed.",emp,NULL);
- close(handle1);
- close(handle2);
- return(11);
- } /* endif */
- } /* endwhile */
-
- close(handle1);
- close(handle2);
-
- if (access(old_name,02) == 0)
- {
- remove(old_name);
- } /* endif */
- else
- {
- if (errno == EACCES)
- {
- chmod(old_name,S_IREAD|S_IWRITE);
- remove(old_name);
- } /* endif */
- } /* endif */
-
- r_counter = 0;
- while (r_counter < 50)
- {
- if (rename(f_name,old_name) != 0)
- {
- r_counter++;
- }
- else
- {
- rename(tmp_name,f_name);
- return(0);
- } /* endif */
- } /* endwhile */
- if (r_counter >= 50)
- {
- remove(tmp_name);
- return(12);
- } /* endif */
- } /* endif */
- } /* endif */
- } /* endif */
- } /* end compress */
- /*---------------------------------------------------------------------------*/
-
-
- int obtain_string( int frame_flag,
- char *field,
- int new_or_old,
- int all_upper,
- int rulh,
- int culh,
- int length,
- struct list_info *list,
- int list_count,
- char *msg,
- int return_field,
- char *comp_str)
-
- {
- char temp_buf[80];
- char input = '\0';
- int i;
- int quit = 0;
- int clean_flag = 1;
- int t_changed = 0;
- int insert_flag = 0;
- int goon = 1;
- int cur_pos = 0;
- int input_count = 0;
- int r_code;
-
- _settextwindow(1,1,25,80);
- _settextcolor(env.frgrd[5]);
- _setbkcolor(env.bkgrd[5]);
-
- if (frame_flag)
- {
-
- _settextwindow(rulh,culh,rulh,culh+length+1);
- _wrapon(_GWRAPOFF);
- _clearscreen(_GWINDOW);
- _settextposition(1,1);
- _outtext("[");
- _settextposition(1,length+2);
- _outtext("]");
- _settextwindow(rulh,culh+1,rulh,culh+length);
- }
- else
- {
- _settextwindow(rulh,culh,rulh,culh+length-1);
- _wrapon(_GWRAPOFF);
- _clearscreen(_GWINDOW);
- } /* endif */
-
- if (new_or_old == OLD)
- {
- input_count = cur_pos = strlen(field);
- }
- else
- {
- field[0] = '\0';
- } /* endif */
-
- do
- {
- if (frame_flag)
- {
- _settextwindow(rulh,culh+1,rulh,culh+length);
- _clearscreen(_GWINDOW);
- _settextwindow(rulh,culh+1,rulh,culh+length+2);
- _settextposition(1,1);
- }
- else
- {
- _settextwindow(rulh,culh,rulh,culh+length-1);
- _clearscreen(_GWINDOW);
- _settextwindow(rulh,culh,rulh,culh+length);
- _settextposition(1,1);
- } /* endif */
- _outtext(field);
- _settextposition(1,cur_pos + 1);
- clean_flag = 0;
- t_changed = 0;
-
- input = (char)getch();
-
- if (input == '\0')
- {
- input = (char)getch();
- switch (input)
- {
- case INS_KEY:
- if (insert_flag)
- {
- show_option(25,80,"INSERT = OFF",'R',env.frgrd[2],env.bkgrd[2]);
- insert_flag = 0;
- }
- else
- {
- show_option(25,80,"INSERT = ON ",'R',env.frgrd[2],env.bkgrd[2]);
- insert_flag = 1;
- } /* endif */
- _settextwindow(rulh,culh+1,rulh,culh+length);
- _settextcolor(env.frgrd[5]);
- _setbkcolor(env.bkgrd[5]);
- break;
- case UP_ARROW:
- putchar(BELL);
- break;
- case DOWN_ARROW:
- putchar(BELL);
- break;
- case HOME:
- cur_pos= 0;
- break;
- case END:
- cur_pos=input_count;
- break;
- case LEFT_ARROW:
- if (cur_pos > 0)
- {
- cur_pos--;
- }
- else
- {
- putchar(BELL);
- } /* endif */
- break;
- case RIGHT_ARROW:
- if (cur_pos < input_count)
- {
- cur_pos++;
- }
- else
- {
- putchar(BELL);
- } /* endif */
- break;
- case DEL_KEY:
- if (input_count == 0 || cur_pos == input_count)
- {
- putchar(BELL);
- }
- else
- {
- strcpy(temp_buf,field);
- for (i=0; i < cur_pos - 1; i++)
- {
- field[i] = temp_buf[i];
- } /* endfor */
- for (i = cur_pos; i < input_count; i++)
- {
- field[i] = temp_buf[i+1];
- } /* endfor */
- input_count--;
- t_changed++;
- field[input_count] = '\0';
- } /* endif */
- break;
- case F1:
- if (list_count)
- {
- _setvisualpage(1);
- _setactivepage(1);
- _settextcolor(env.frgrd[0]);
- _setbkcolor(env.bkgrd[0]);
- _clearscreen(_GCLEARSCREEN);
- display_message("Getting List. Please wait");
- temp_buf[0] = '\0';
- if (field[0] == ' ')
- {
- field[0] = '\0';
- } /* endif */
- t_changed = list_field(list,
- list_count,
- msg,
- return_field,
- temp_buf,
- 2,1,24,80,
- comp_str);
- _setactivepage(0);
- _setvisualpage(0);
- _settextcolor(env.frgrd[5]);
- _setbkcolor(env.bkgrd[5]);
- _settextwindow(1,1,25,80);
- if (t_changed)
- {
- strcpy(field,temp_buf);
- input_count = strlen(temp_buf);
- cur_pos = strlen(temp_buf);
- if (frame_flag)
- {
- _settextwindow(rulh,culh,rulh,culh+length+1);
- _wrapon(_GWRAPOFF);
- _clearscreen(_GWINDOW);
- _settextposition(1,1);
- _outtext("[");
- _settextposition(1,length+2);
- _outtext("]");
- _settextwindow(rulh,culh+1,rulh,culh+length);
- }
- else
- {
- _settextwindow(rulh,culh,rulh,culh+length-1);
- _wrapon(_GWRAPOFF);
- _clearscreen(_GWINDOW);
- } /* endif */
- _settextposition(1,1);
- _outtext(field);
- _settextposition(1,cur_pos);
- } /* endif */
- }
- else
- {
- putchar(BELL);
- } /* endif */
- break;
- default :
- putchar(BELL);
- break;
- } /* endswitch */
- }
- else
- {
- if (input == '\033')
- {
- field[0] = '\0';
- quit = 1;
- r_code = -1;
- }
- else
- {
- if (input == '\015')
- {
- field[input_count] = '\0';
- quit = 1;
- r_code = strlen(field);
- }
- else
- {
- if (input == ',')
- {
- putchar(BELL);
- }
- else
- {
- if (input == '\b')
- {
- if (input_count == 0 || cur_pos == 0)
- {
- putchar(BELL);
- }
- else
- {
- if (cur_pos < input_count)
- {
- strcpy(temp_buf,field);
- for (i=0; i < cur_pos - 2; i++)
- {
- field[i] = temp_buf[i];
- } /* endfor */
- for (i = cur_pos - 1; i < input_count; i++)
- {
- field[i] = temp_buf[i+1];
- } /* endfor */
- } /* endif */
- cur_pos--;
- input_count--;
- t_changed++;
- field[input_count] = '\0';
- } /* endif */
- }
- else
- {
- if (input_count < length)
- {
- if (input_count == cur_pos)
- {
- if (all_upper)
- {
- field[input_count] = (char) toupper(input);
- }
- else
- {
- field[input_count] = input;
- } /* endif */
- field[input_count+1] = '\0';
- input_count++;
- cur_pos++;
- t_changed++;
- }
- else
- {
- if (insert_flag)
- {
- strcpy(temp_buf,field);
- for (i=0; i <= cur_pos - 1; i++)
- {
- field[i] = temp_buf[i];
- } /* endfor */
- if (all_upper)
- {
- field[cur_pos] = (char) toupper(input);
- }
- else
- {
- field[cur_pos] = input;
- } /* endif */
- for (i = cur_pos + 1; i <= input_count; i++)
- {
- field[i] = temp_buf[i-1];
- } /* endfor */
- input_count++;
- cur_pos++;
- field[input_count] = '\0';
- t_changed++;
- }
- else
- {
- putchar(BELL);
- } /* endif */
- } /* endif */
- }
- else
- {
- putchar(BELL);
- } /* endif */
- } /* endif */
- } /* endif */
- } /* endif */
- } /* endif */
- } /* endif */
- } while (!quit); /* enddo */
-
- _settextcolor(env.frgrd[0]);
- _setbkcolor(env.bkgrd[0]);
- _settextwindow(1,1,25,80);
- return(r_code);
-
- } /* end obtain_string */
- /*---------------------------------------------------------------------------*/
-
-
- int list_field(struct list_info *list,
- int list_count,
- char *msg,
- int return_field,
- char *line_buff,
- int rulh,int culh,int rbrh,int cbrh,
- char *comp_str)
-
- {
-
- char user_field[15][61];
- int counter = 0;
- int k;
- struct file_line *my_line;
- char choice1;
- int line_number = 1;
- int i,j;
- int r_code;
- int page_length = 0;
- int page_width = 0;
- int top_line = 0;
- int old_top = 0;
- int quit =0;
- int d_flag;
- int start;
- int in_len = 39;
- int show_flag = 0;
-
- int scrl_lines = 0;
- int cur_line = 1;
- int old_cur_line = 1;
-
- int color_mask = 0;
-
- my_line = (struct file_line *)calloc(line_number,sizeof(struct file_line));
- if (my_line == NULL)
- {
- box_message(1,1,"Memory allocation error",emp,NULL);
- set_cursor_on(7,7);
- return(2);
- } /* endif */
-
- display_message("Reading List. Please wait.");
- for (i=0; i<list_count-1; i++)
- {
- if (comp_str[0] == '\0')
- {
- show_flag = 1;
- strcpy(my_line[line_number-1].line,list[i].id);
- strcat(my_line[line_number-1].line,"│");
- strcat(my_line[line_number-1].line,list[i].name);
- line_number++;
- my_line = (struct file_line *)realloc(my_line,line_number*sizeof(struct file_line));
- if (my_line == NULL)
- {
- box_message(1,1,"Memory allocation error",emp,NULL);
- set_cursor_on(7,7);
- return(2);
- } /* endif */
- }
- else
- {
- if (strncmp(list[i].name,comp_str,strlen(comp_str)) == 0)
- {
- show_flag = 1;
- strcpy(my_line[line_number-1].line,list[i].id);
- strcat(my_line[line_number-1].line,"│");
- strcat(my_line[line_number-1].line,list[i].name);
- line_number++;
- my_line = (struct file_line *)realloc(my_line,line_number*sizeof(struct file_line));
- if (my_line == NULL)
- {
- box_message(1,1,"Memory allocation error",emp,NULL);
- set_cursor_on(7,7);
- return(2);
- } /* endif */
- } /* endif */
- } /* endif */
- } /* endfor */
-
- if (show_flag)
- {
- line_number = line_number - 1;
- page_length = rbrh - rulh - 1;
-
- if (line_number < page_length)
- {
- page_length = line_number;
- rbrh = rulh + line_number + 1;
- } /* endif */
-
- scrl_lines = page_length;
- cur_line = 1;
- old_cur_line = 1;
- start = 1;
- top_line = 0;
- d_flag = UP;
-
- page_width = cbrh - culh - 1;
-
- color_mask = 16*(int)env.bkgrd[3] + env.frgrd[3];
-
- _settextwindow(1,1,25,80);
- _clearscreen(_GWINDOW);
- frame(rulh,culh,rbrh - rulh + 1,page_width + 2,env.frgrd[2],env.bkgrd[2]);
- _settextcolor(env.frgrd[0]);
- _setbkcolor(env.bkgrd[0]);
- show_option(1,40,msg,'C',env.frgrd[1],env.bkgrd[1]);
- show_option(25,40,"Use PgUp PgDn Home End to highlight selection, F10 = Select, Esc = quit",'C',env.frgrd[1],env.bkgrd[1]);
- _settextwindow(rulh + 1,culh + 1,rbrh - 1,cbrh - 1);
- _clearscreen(_GWINDOW);
- _settextcolor(env.frgrd[3]);
- _setbkcolor(env.bkgrd[3]);
-
- do
- {
-
- if (scrl_lines != 0)
- {
- scroll(d_flag,rulh + 1,culh + 1,rbrh - 1,cbrh - 1,scrl_lines,color_mask);
- for (j=0 ; j < scrl_lines; j++)
- {
- _settextposition(start+j,1);
- _outtext(my_line[j+top_line+start-1].line);
- } /* endfor */
- } /* endif */
-
- _settextcolor(env.frgrd[3]);
- _settextposition(old_cur_line,1);
- _outtext(my_line[top_line+old_cur_line-1].line);
- _settextcolor(env.frgrd[1]);
- _settextposition(cur_line,1);
- _outtext(my_line[top_line+cur_line-1].line);
- _settextcolor(env.frgrd[3]);
- _settextposition(cur_line,1);
-
- strcpy(line_buff,my_line[top_line+cur_line-1].line);
-
- choice1 = (char)getch();
- old_top = top_line;
- if (choice1 == '\0')
- {
- choice1 = (char)getch();
- switch (choice1)
- {
- case PAGE_UP:
- d_flag = DOWN;
- if (old_top > 0)
- {
- start = 1;
- top_line -= page_length - 1;
- if (top_line < 0)
- {
- top_line = 0;
- } /* endif */
- scrl_lines = page_length;
- old_cur_line = cur_line;
- cur_line = 1;
- }
- else
- {
- scrl_lines = 0;
- if (cur_line == 1)
- {
- putchar(BELL);
- }
- else
- {
- old_cur_line = cur_line;
- cur_line = 1;
- } /* endif */
- } /* endif */
- break;
- case UP_ARROW:
- d_flag = DOWN;
- if (cur_line == 1)
- {
- start = 1;
- old_cur_line = cur_line + 1;
- top_line -= 1;
- if (top_line < 0)
- {
- top_line = 0;
- putchar(BELL);
- } /* endif */
- }
- else
- {
- old_cur_line = cur_line;
- cur_line--;
- } /* endif */
- scrl_lines = abs(old_top - top_line);
- break;
- case PAGE_DOWN:
- d_flag = UP;
- if (old_top < line_number - page_length)
- {
- start = 1;
- top_line += page_length - 1;
- if (top_line > line_number - page_length)
- {
- top_line = line_number - page_length;
- } /* endif */
- scrl_lines = page_length;
- old_cur_line = cur_line;
- cur_line = page_length;
- }
- else
- {
- scrl_lines = 0;
- if (cur_line == page_length)
- {
- putchar(BELL);
- }
- else
- {
- old_cur_line = cur_line;
- cur_line = page_length;
- } /* endif */
- } /* endif */
- break;
- case DOWN_ARROW:
- d_flag = UP;
- if (cur_line == page_length)
- {
- old_cur_line = cur_line-1;
- start = page_length;
- top_line += 1;
- if (top_line > line_number - page_length)
- {
- top_line = line_number - page_length;
- putchar(BELL);
- } /* endif */
- }
- else
- {
- old_cur_line = cur_line;
- cur_line++;
- } /* endif */
- scrl_lines = abs(old_top - top_line);
- break;
- case HOME:
- d_flag = DOWN;
- if (top_line > 0)
- {
- start = 1;
- scrl_lines = page_length;
- top_line = 0;
- old_cur_line = cur_line;
- cur_line = 1;
- }
- else
- {
- scrl_lines = 0;
- if (cur_line == 1)
- {
- putchar(BELL);
- }
- else
- {
- old_cur_line = cur_line;
- cur_line =1;
- } /* endif */
- } /* endif */
- break;
- case END:
- d_flag = UP;
- if (old_top < line_number - page_length)
- {
- start = 1;
- scrl_lines = page_length;
- top_line = line_number - page_length;
- if (top_line == old_top)
- {
- scrl_lines = 0;
- } /* endif */
- old_cur_line = cur_line;
- cur_line = page_length;
- }
- else
- {
- scrl_lines = 0;
- if (cur_line == page_length)
- {
- putchar(BELL);
- }
- else
- {
- old_cur_line = cur_line;
- cur_line = page_length;
- } /* endif */
- } /* endif */
- break;
- case F10:
- quit = 1;
- r_code = cur_line;
- counter = 0;
- j = 0;
- for (k=0; k <= in_len;k++)
- {
- if (line_buff[k] == '│'|| line_buff[k] == '\0')
- {
- user_field[counter][j] = '\0';
- counter++;
- j = 0;
- }
- else
- {
- user_field[counter][j] = line_buff[k];
- j++;
- } /* endif */
- } /* endfor */
- strcpy(line_buff,user_field[return_field - 1]);
- break;
- default :
- break;
- } /* endswitch */
- }
- else
- {
- switch (choice1)
- {
- case '\033':
- quit = 1;
- r_code = 0;
- break;
- case '\015':
- d_flag = UP;
- if (cur_line == page_length)
- {
- start = page_length;
- top_line += 1;
- if (top_line > line_number - page_length)
- {
- top_line = line_number - page_length;
- putchar(BELL);
- } /* endif */
- }
- else
- {
- old_cur_line = cur_line;
- cur_line++;
- } /* endif */
- scrl_lines = abs(old_top - top_line);
- break;
- default :
- break;
- } /* endswitch */
- } /* endif */
- } while (!quit); /* enddo */
- } /* endif */
- free(my_line);
- set_cursor_on(7,7);
- return(r_code);
- } /* end list_field */
- /* ------------------------------------------------------------------ */
-
-
- void do_titles(int fg_color,
- char *c_name,
- char *p_name,
- char *proj_name,
- char *d_buff,
- long bk_color)
-
- {
-
- _settextcolor(fg_color);
- _setbkcolor(bk_color);
- _settextwindow(1,1,25,80);
- _clearscreen(_GWINDOW);
-
- show_option(1,40,c_name,'C',env.frgrd[1],env.bkgrd[1]);
- show_option(2,40,p_name,'C',env.frgrd[1],env.bkgrd[1]);
- show_option(3,40,proj_name,'C',env.frgrd[1],env.bkgrd[1]);
- show_option(1,1,d_buff,'L',env.frgrd[1],env.bkgrd[1]);
- } /* end do_titles */