void reset_bbs_message_date(struct bbs_user_account *bbs_user, int mail_pieces, struct bbs_board_info *bbs_info, const char *directory) { char s[80]; char t[10]; unsigned int new_message; print_cr(); print_str_cr("Reset last message read number"); sprintf(s,"Reset last message read to (1-%d): ",mail_pieces); print_string(s); get_string(t,5); if (!(*t)) { print_cr(); return; } new_message=atoi(t); if ((new_message<1) || (new_message>mail_pieces)) { print_str_cr("Message is out of range"); return; } bbs_user->last_entered_bbs = bbs_info[new_message-1].filedate-1; save_bbs_user(directory,user_lines[tswitch].number,bbs_user); print_str_cr("Last date reset"); }
void toggle_global_on(char *directory, struct bbs_user_account *bbs_user, int board_num) { char s[80]; bbs_user->newscan = !bbs_user->newscan; print_cr(); sprintf(s,"Global Newscan for Board [%02d] turned ",board_num); print_string(s); if (bbs_user->newscan) print_string("on"); else print_string("off"); print_cr(); save_bbs_user(directory,user_lines[tswitch].number,bbs_user); };
int get_file_list(char *directory, char *filename, int show, char *title) { char file_temp[80]; char file_in[70]; char file_out[70]; char out_line[80]; int count = 0; FILE *fileptr; if (show) { print_cr(); print_str_cr(title); print_cr(); }; sprintf(file_temp,"%s\\%s",directory,filename); lock_dos(272); if (!(fileptr = g_fopen(file_temp,"rb","FILES#1"))) { unlock_dos(); log_error(file_temp); return 0; }; call_on_logoff(close_file_list,fileptr); while (!feof(fileptr)) { fgets(file_in,67,fileptr); if (!feof(fileptr)) { fgets(file_in,67,fileptr); unlock_dos(); count++; if (show) { filter_control(file_in,file_out,67); sprintf(out_line,"%d. %s",count,file_out); print_str_cr(out_line); }; lock_dos(273); }; }; clear_call_on_logoff(); g_fclose(fileptr); unlock_dos(); return (count); };
void jump_board(int *board_num, struct board_info *new_board, struct bbs_board_info *bbs_info, char *directory, struct bbs_user_account *bbs_user, int *mail_pieces, int jump_to) { int new_board_num; struct board_info test_board; char s[10]; char tempdirectory[30]; if (jump_to == -1) { do { print_cr(); print_string("Jump to which board: (?=List) "); get_string(s,8); if (*s=='?') print_file("bbs\\boards.lst"); } while (*s == '?'); if (!(*s)) print_cr(); }; if (jump_to != -1) new_board_num = jump_to; else new_board_num = atoi(s); if ((new_board_num<1) || (new_board_num>MAX_BOARDS)) print_str_cr("Board number does not exist."); else { if (load_board_info(new_board_num,&test_board,tempdirectory)) { print_str_cr("Cannot access board."); } else { enter_board(new_board_num,new_board,bbs_info,directory, bbs_user,mail_pieces); *board_num = new_board_num; }; }; };
void send_a_bbs_message(int bbs_num,struct board_info *new_board, int bbs_mesg, struct bbs_board_info *board_info) { char s[40]; char subject[60]; FILE *fileptr; char directory[24]; if ((bbs_num<0) || (bbs_num>999)) return; print_cr(); special_code(1,tswitch); print_string("|*h1|*f4From:|*r1 "); print_str_cr(user_lines[tswitch].handle); print_string("|*r1|*h1|*f4Subject:|*f7 "); get_string(subject,57); print_cr(); special_code(0,tswitch); if (!(*subject)) { print_cr(); return; }; sprintf(s,"bbs\\tempfl.%02d",tswitch); lock_dos(); if ((fileptr=g_fopen(s,"wb","BBS#4"))==NULL) { log_error(s); unlock_dos(); return; }; g_fclose(fileptr); unlock_dos(); if (line_editor(s,MESSAGE_SIZE)) { find_bbs_directory(directory,bbs_num); create_bbs_message(directory,s,subject,user_lines[tswitch].number, user_lines[tswitch].handle,new_board,bbs_mesg,board_info); print_str_cr("Message posted."); }; }
void edit_bbs_message(char *directory, struct bbs_board_info *bbs_info, int *num_files, struct board_info *new_board) { int which_fl; char s[40]; char *data; if (!num_files) {print_str_cr("No messages to edit"); return;} sprintf(s,"Which mail message to edit: (1-%d): ",*num_files); print_cr(); print_string(s); get_editor_string(s,5); which_fl=str_to_num(s,&data); edit_a_bbs_message(directory,bbs_info,num_files,which_fl,new_board); };
void read_bbs_message(char *directory, struct bbs_board_info *bbs_info, int *num_files, struct board_info *new_board, int board_num, struct bbs_user_account *bbs_user) { int which_fl; char s[40]; char *data; if (!(*num_files)) {print_str_cr("No messages to read"); return; } sprintf(s,"Which mail message to read: (1-%d): ",*num_files); print_cr(); print_string(s); get_editor_string(s,5); which_fl=str_to_num(s,&data); if ((which_fl<1) || (which_fl>(*num_files))) return; /* which_fl--; */ read_a_bbs_message(directory,bbs_info,num_files,which_fl, new_board,board_num,bbs_user); };
void delete_a_bbs_message(char *directory,struct bbs_board_info *bbs_info, int *num_files, int which_fl, struct board_info *new_board) { char s[40]; char *data; int owner; if ((which_fl<1) || (which_fl>*num_files)) return; owner = str_to_num(bbs_info[which_fl-1].filename+1,&data); if (!((owner == user_lines[tswitch].number) || (test_bit(user_options[tswitch].privs,BBS_EDIT_PRV)) || (user_lines[tswitch].number == new_board->user_moderator))) { print_str_cr("You do not have delete privilege to that message."); return; }; sprintf(s,"%s\\%s",directory,bbs_info[which_fl-1].filename); print_cr(); lock_dos(); remove(s); unlock_dos(); print_str_cr("Message deleted."); }
void global_newscan(int *board_num, struct board_info *new_board, struct bbs_board_info *bbs_info, char *directory, struct bbs_user_account *bbs_user, int *mail_pieces) { int cur_board = 1; int is_still_boards = 1; struct board_info test_board; char tempdirectory[30]; char s[250]; int state; int key_pr; int key; int num_new_msg; int skip; while (is_still_boards) { if (state=load_board_info(cur_board,&test_board,tempdirectory)) { if (state==2) is_still_boards = 0; } else { enter_board(cur_board,new_board,bbs_info,directory, bbs_user,mail_pieces); *board_num = cur_board; if ((num_new_msg=is_new_messages(bbs_info,*mail_pieces,bbs_user)) && (bbs_user->newscan)) { check_for_privates(); print_cr(); sprintf(s,"#|*f2|*h1%02d|*r1 [|*f2|*h1%s|*r1] New: |*f4|*h1%02d|*r1 [|*h1R|*h0]ead [|*h1S|*h0]kip [|*h1Q|*h0]uit: ",cur_board,new_board->title,num_new_msg); skip = 0; switch (get_hot_key_prompt(s,"RSQP",'R',1)) { case 'R' : new_messages(directory,bbs_info,mail_pieces, new_board,cur_board,bbs_user); break; case 'P' : break; case 'S' : skip=1; break; case 'Q' : is_still_boards=0; break; } if (!skip) { print_cr(); sprintf(s,"#|*f2|*h1%02d|*r1 [|*f2|*h1%s|*r1] Post on board? [|*h1Y|*h0/|*h1N|*h0/|*h1Q|*h0] ",cur_board,new_board->title,num_new_msg); special_code(1,tswitch); print_string(s); special_code(0,tswitch); key_pr = 1; while (key_pr) { key=wait_ch(); if (key>'Z') key -= 32; if (key == 'Y') { print_chr('Y'); print_cr(); key_pr = 0; send_a_bbs_message(*board_num,new_board,*mail_pieces,bbs_info); find_bbs(directory,bbs_info,mail_pieces,new_board->limit_messages); }; if (key == 'Q') { print_chr('Q'); print_cr(); key_pr = 0; is_still_boards = 0; }; if ((key == 13) || (key == 'N')) { print_chr('N'); print_cr(); key = 'N'; key_pr = 0; }; }; }; }; }; cur_board++; }; };
void print_capabilities(const jvmtiCapabilities* cap) { print_cr("----- capabilities -----"); if (cap->can_tag_objects) print_cr("can_tag_objects"); if (cap->can_generate_field_modification_events) print_cr("can_generate_field_modification_events"); if (cap->can_generate_field_access_events) print_cr("can_generate_field_access_events"); if (cap->can_get_bytecodes) print_cr("can_get_bytecodes"); if (cap->can_get_synthetic_attribute) print_cr("can_get_synthetic_attribute"); if (cap->can_get_owned_monitor_info) print_cr("can_get_owned_monitor_info"); if (cap->can_get_current_contended_monitor) print_cr("can_get_current_contended_monitor"); if (cap->can_get_monitor_info) print_cr("can_get_monitor_info"); if (cap->can_get_constant_pool) print_cr("can_get_constant_pool"); if (cap->can_pop_frame) print_cr("can_pop_frame"); if (cap->can_force_early_return) print_cr("can_force_early_return"); if (cap->can_redefine_classes) print_cr("can_redefine_classes"); if (cap->can_retransform_classes) print_cr("can_retransform_classes"); if (cap->can_signal_thread) print_cr("can_signal_thread"); if (cap->can_get_source_file_name) print_cr("can_get_source_file_name"); if (cap->can_get_line_numbers) print_cr("can_get_line_numbers"); if (cap->can_get_source_debug_extension) print_cr("can_get_source_debug_extension"); if (cap->can_access_local_variables) print_cr("can_access_local_variables"); if (cap->can_maintain_original_method_order) print_cr("can_maintain_original_method_order"); if (cap->can_generate_single_step_events) print_cr("can_generate_single_step_events"); if (cap->can_generate_exception_events) print_cr("can_generate_exception_events"); if (cap->can_generate_frame_pop_events) print_cr("can_generate_frame_pop_events"); if (cap->can_generate_breakpoint_events) print_cr("can_generate_breakpoint_events"); if (cap->can_suspend) print_cr("can_suspend"); if (cap->can_redefine_any_class) print_cr("can_redefine_any_class"); if (cap->can_retransform_any_class) print_cr("can_retransform_any_class"); if (cap->can_get_current_thread_cpu_time) print_cr("can_get_current_thread_cpu_time"); if (cap->can_get_thread_cpu_time) print_cr("can_get_thread_cpu_time"); if (cap->can_generate_method_entry_events) print_cr("can_generate_method_entry_events"); if (cap->can_generate_method_exit_events) print_cr("can_generate_method_exit_events"); if (cap->can_generate_all_class_hook_events) print_cr("can_generate_all_class_hook_events"); if (cap->can_generate_compiled_method_load_events) print_cr("can_generate_compiled_method_load_events"); if (cap->can_generate_monitor_events) print_cr("can_generate_monitor_events"); if (cap->can_generate_vm_object_alloc_events) print_cr("can_generate_vm_object_alloc_events"); if (cap->can_generate_native_method_bind_events) print_cr("can_generate_native_method_bind_events"); if (cap->can_generate_garbage_collection_events) print_cr("can_generate_garbage_collection_events"); if (cap->can_generate_object_free_events) print_cr("can_generate_object_free_events"); }
void read_a_bbs_message(char *directory, struct bbs_board_info *bbs_info, int *num_files, int which_fl, struct board_info *new_board, int board_num, struct bbs_user_account *bbs_user) { char s[200]; int not_abort = 1; int testnum; if ((which_fl<1) || (which_fl>(*num_files))) return; which_fl--; while (not_abort) { print_cr(); sprintf(s,"|*f4|*h1Message:|*f7 #%03d on %s(%02d)",which_fl+1,new_board->title,board_num); special_code(1,tswitch); print_str_cr(s); special_code(0,tswitch); sprintf(s,"%s\\%s",directory,bbs_info[which_fl].filename); print_file_to_cntrl(s,tswitch,1,1,1,BBS_PAGING); check_for_privates(); print_cr(); sprintf(s,"[|*f2|*h1%02d |*r1of |*f2|*h1%02d|*r1] [|*h1A|*h0]gain [|*h1N|*h0]ext [|*h1J|*h0]ump [|*h1R|*h0]eply [|*h1Q|*h0]uit: ",which_fl+1,*num_files); switch (get_hot_key_prompt(s,"ANJRQ",'N',1)) { case 'N': which_fl++; if (which_fl == *num_files) { which_fl--; not_abort = 0; }; break; case 'A': break; case 'J': sprintf(s,"Which message to jump to: (1-%d) ",*num_files); print_string(s); get_string(s,10); if (!(*s)) print_cr(); else { testnum = atoi(s); if ((testnum>=1) && (testnum<=(*num_files))) which_fl = testnum-1; }; break; case 'D': print_cr(); print_string("Are you sure you want to delete? "); get_string(s,10); if (!(*s)) print_cr(); else if ((*s=='y') || (*s=='Y')) { delete_a_bbs_message(directory,bbs_info,num_files,which_fl, new_board); find_bbs(directory,bbs_info,num_files,new_board->limit_messages); if (which_fl>=(*num_files)) which_fl = *num_files - 1; } break; case 'R': send_a_bbs_message(board_num,new_board,*num_files,bbs_info); find_bbs(directory,bbs_info,num_files,new_board->limit_messages); break; case 'Q': not_abort = 0; break; }// end switch }//end while if (bbs_info[which_fl].filedate>bbs_user->last_entered_bbs) { bbs_user->last_entered_bbs = bbs_info[which_fl].filedate; save_bbs_user(directory,user_lines[tswitch].number,bbs_user); }; };
void list_bbs(char *directory, struct bbs_board_info *bbs_info, int num_files,struct bbs_user_account *bbs_user) { int file; int anyfile = 1; int key; int abort=0; char user_l[80]; char date_l[80]; char subject_l[120]; char num_l[120]; int count=0; FILE *fileptr; print_cr(); file=num_files; while ((file>0) && (!abort)) { file--; lock_dos(); if (open_bbs_file(directory,bbs_info,file,&fileptr)) { mail_line(user_l,20,40,fileptr); mail_line(subject_l,32,70,fileptr); mail_line(date_l,16,40,fileptr); g_fclose(fileptr); unlock_dos(); anyfile = 0; if (bbs_info[file].filedate > (bbs_user->last_entered_bbs)) sprintf(num_l,"*%02d: ",file+1); else sprintf(num_l," %02d: ",file+1); special_code(1,tswitch); print_string(num_l); print_string(user_l); print_chr(' '); print_string(date_l); print_chr(' '); print_string(subject_l); print_cr(); count++; special_code(0,tswitch); key = get_first_char(tswitch); if ((key == 27) || (key == 3)) { int_char(tswitch); file = -1; }; if (key == 19) { wait_ch(); wait_ch(); }; if (count>=24) { abort= do_page_break(); count=0; } lock_dos(); }; unlock_dos(); }; if (anyfile) print_str_cr("No BBS messages."); };
void last_ten_callers(char *string, char *name, int portnum) { FILE *fileptr; char s[80]; int num; int not_abort = 1; int key; char *data; int num_last = str_to_num(string,&data); if (num_last == -1) num_last = 10; if (num_last>99) num_last = 99; while( (*data==' ' || *data=='-' )&& *data!=0) data++; if (*data=='K' || *data=='k') { last_ten_kills(num_last,portnum); return; } print_cr(); sprintf(s,"Last %d callers",num_last); print_str_cr(s); num_last++; print_cr(); lock_dos(276); if (!(fileptr=g_fopen(USER_LOG_FILE,"rb","FILES#4"))) /* open the user log */ { log_error(USER_LOG_FILE); unlock_dos(); return; }; call_on_logoff(close_last_ten_callers,(void *)fileptr); num = 1; while (not_abort && (num<num_last)) { fseek(fileptr,-80*(long int)(num),SEEK_END); not_abort = (ftell(fileptr) != 0); if (not_abort) { sprintf(s,"%2d: ",num); unlock_dos(); print_string(s); lock_dos(276); fread(s,1,80,fileptr); unlock_dos(); print_str_cr(s); key = get_first_char(portnum); if ((key == 3) || (key == 27)) { int_char(portnum); not_abort = 0; }; lock_dos(277); }; num++; }; g_fclose(fileptr); clear_call_on_logoff(); unlock_dos(); print_cr(); };
void file_list_section(char *directory, char *filelist, char *title) { char filename[80]; char response[4]; int count_file; int which_fl; int flag = 1; int paging = 1; count_file = get_file_list(directory, filelist,1,title); print_str_cr("P. Toggle Paging On/Off"); while (flag) { check_for_privates(); sprintf(filename,"Which file to read: (1-%d,P,Q,?): ",count_file); print_cr(); print_string(filename); do { get_string(response,3); } while (!(*response)); if ((*response == 'P') || (*response == 'p')) { paging = !paging; print_cr(); print_string("Paging is turned "); if (paging) print_string("on"); else print_string("off"); print_cr(); } else if ((*response != 'Q') && (*response != 'q')) { if (*response=='?') { get_file_list(directory,filelist,1,title); print_str_cr("P. Toggle Paging On/Off"); } else { which_fl = atoi(response); if ((which_fl<1) || (which_fl>count_file)) { print_str_cr("--> File does not exist"); } else { get_file_list_name(directory,filelist,filename,which_fl); print_cr(); print_str_cr("Press ^C to abort file"); print_cr(); print_file_to_cntrl(filename,tswitch,1,1,1,paging); }; }; } else { flag = 0; print_cr(); }; }; };
void bbs_system(const char *str,const char *name, int portnum) { char directory[20]; struct bbs_board_info bbs_info[MAX_MESG_LIMIT]; struct board_info new_board; struct bbs_user_account bbs_user; int mail_pieces; int board_num = 1; int flag = 1; int num; char *point; char command[7]; char s[100]; if (user_lines[tswitch].number<0) { print_str_cr("--> BBS access denied. Guests not allowed."); return; } if (enter_board(board_num,&new_board,bbs_info,directory, &bbs_user,&mail_pieces)) { print_str_cr("--> BBS access denied."); return; }; while (flag) { check_for_privates(); print_cr(); sprintf(s,"#|*f2|*h1%02d|*r1 [|*f2|*h1%s|*r1] [|*f2|*h11-%d|*r1] BBS Command (|*h1?|*h0 for Menu): ",board_num,new_board.title,mail_pieces); prompt_get_string(s,command,4); if (*command>'Z') *command -= 32; if ((num=str_to_num(command,&point))>0) { if (num<=mail_pieces) { read_a_bbs_message(directory,bbs_info,&mail_pieces,num, &new_board,board_num,&bbs_user); }; } else switch (*command) { case 'N': new_messages(directory,bbs_info,&mail_pieces, &new_board,board_num,&bbs_user); break; case 'G': global_newscan(&board_num,&new_board,bbs_info,directory, &bbs_user,&mail_pieces); break; case 'Q': flag = 0; break; case 'J': jump_board(&board_num,&new_board,bbs_info,directory, &bbs_user,&mail_pieces,str_to_num(command+1,&point)); break; case 'L': list_bbs(directory,bbs_info,mail_pieces,&bbs_user); break; case 'R': if ((num=str_to_num(command+1,&point))==-1) read_bbs_message(directory,bbs_info,&mail_pieces, &new_board,board_num,&bbs_user); else read_a_bbs_message(directory,bbs_info, &mail_pieces,num,&new_board,board_num,&bbs_user); break; case 'X': reset_bbs_message_date(&bbs_user,mail_pieces, bbs_info,directory); break; case 'P': send_a_bbs_message(board_num,&new_board, mail_pieces,bbs_info); find_bbs(directory,bbs_info,&mail_pieces, new_board.limit_messages); break; case 'D': if ((num=str_to_num(command+1,&point))==-1) delete_bbs_message(directory,bbs_info, &mail_pieces,&new_board); else delete_a_bbs_message(directory,bbs_info, &mail_pieces,num,&new_board); find_bbs(directory,bbs_info,&mail_pieces, new_board.limit_messages); break; case 'E': if ((num=str_to_num(command+1,&point))==-1) edit_bbs_message(directory,bbs_info, &mail_pieces,&new_board); else edit_a_bbs_message(directory,bbs_info, &mail_pieces,num,&new_board); break; case 'T': toggle_global_on(directory,&bbs_user,board_num); break; case '?': print_file("help\\bbs.hlp"); }; }; print_str_cr("--> GinsuTalk: Returning to System"); };
FILE *g_fopen_excl(const char *filename, const char *mode, const char *description, int excl) { void *file_pointer; HFILE fd; APIRET ret; struct open_mode_table *entry = mode_table; int modes = OPEN_ACCESS_READWRITE; int openflags = OPEN_SHARE_DENYNONE; ULONG action; HFILE handle; USHORT rc; int waiting_temp=0; int time_init = time(NULL); if (checkblacklist(filename)) return NULL; while (entry->mode_string) { if (!strcmp(mode,entry->mode_string)) { modes = entry->modes; openflags = entry->openflags; break; } entry++; } switch (excl) { case PRIVATE_ACCESS: modes |= OPEN_SHARE_DENYREADWRITE; break; case PRIVATE_READ_ACCESS: modes |= OPEN_SHARE_DENYREAD; break; case PRIVATE_WRITE_ACCESS: modes |= OPEN_SHARE_DENYWRITE; break; default: modes |= OPEN_SHARE_DENYNONE; break; } while ((rc = DosOpen(filename,&handle,&action,0,FILE_NORMAL,openflags,modes,NULL)) !=0) { if ((time(NULL)-time_init) > 8) return (NULL); //if (rc == ERROR_FILE_NOT_FOUND) // return (NULL); if (rc != ERROR_SHARING_VIOLATION) return (NULL); DosSleep(500); if (!waiting_temp) print_string("Waiting..."); else { print_chr('.'); waiting_temp++; } } if (waiting_temp) print_cr(); file_pointer = fdopen(handle,mode); if (file_pointer) { if (add_file_entry(file_pointer,tswitch,filename,0,description)==-1) { fclose(file_pointer); file_pointer = NULL; } } else DosClose(handle); return (file_pointer); };
void xmlBuffer::print_jshort (jshort v) { xmlElement j(this, "jshort", xmlElement::delayed_LF); char buf[25]; snprintf(buf,sizeof(buf),"%d",v); print_cr(buf); }