int main(int argc, char *argv[]) { if (argc < 2) { csprint("Usage: display.c32 <textfile>\n", 0x07); exit(1); } init_help(NULL); // No base dir, so all filenames must be absolute runhelp(argv[1]); close_help(); return 0; }
void init_builtin_commands() { LOG_D("command/init") << "Populating command map"; init_app(); init_audio(); init_automation(); init_edit(); init_grid(); init_help(); init_keyframe(); init_recent(); init_subtitle(); init_time(); init_timecode(); init_tool(); init_video(); init_visual_tools(); }
int main (int argc, char *argv[]) { vc_component *v = NULL; fpos_t *fpos = NULL; long pos = 0; FILE *fp = NULL; ITEM *it = NULL; int entry_number = 0; bool done = FALSE; int win_state = WINDOW_INDEX; int command = 0; set_defaults (); process_command_line_args (argc, argv); /* * process_environment_variables(); * process_configuration_file(); */ signal (SIGINT, finish); /* catch interrupt for exiting */ signal (SIGWINCH, resize); /* catch interrupt for resizing */ initscr (); keypad (stdscr, TRUE); /* enable keypad for use of arrow keys */ nonl (); /* tell curses not to do NL->CR/NL on output */ cbreak (); /* take input chars immediately */ noecho (); init_index (data_path); set_index_help_fcn (show_index_help); init_view (); set_view_help_fcn (show_view_help); init_edit (); set_edit_help_fcn (show_edit_help); init_help (); while (!done) { switch (win_state) { case WINDOW_INDEX: /*------------------- display the index -------------------*/ display_index (); command = process_index_commands (); switch (command) { case INDEX_COMMAND_VIEW: win_state = WINDOW_VIEW; break; case INDEX_COMMAND_RAW_VIEW: win_state = WINDOW_RAW_VIEW; break; case INDEX_COMMAND_EDIT: win_state = WINDOW_EDIT; break; case INDEX_COMMAND_ADD: win_state = WINDOW_ADD; break; case INDEX_COMMAND_DELETE: win_state = WINDOW_DELETE; break; case INDEX_COMMAND_QUIT: done = TRUE; break; default: break; } break; case WINDOW_RAW_VIEW: /*------------------------------------------------- view the currently selected item with the pager -------------------------------------------------*/ it = get_current_item (); /* only display if there is an item that is selected */ if (NULL == it) { v = NULL; } else { fpos = (fpos_t *) item_userptr (it); fp = fopen (data_path, "r"); fsetpos (fp, fpos); v = parse_vcard_file (fp); fclose (fp); } if (v != NULL) { raw_view (v); vc_delete_deep (v); v = NULL; } win_state = WINDOW_INDEX; break; case WINDOW_VIEW: /*---------------------------------- view the currently selected item ----------------------------------*/ it = get_current_item (); /* only display if there is an item that is selected */ if (NULL == it) { v = NULL; } else { fpos = (fpos_t *) item_userptr (it); fp = fopen (data_path, "r"); fsetpos (fp, fpos); v = parse_vcard_file (fp); fclose (fp); } if (v != NULL) { entry_number = get_entry_number (it); view_vcard (entry_number, v); command = process_view_commands (); switch (command) { case VIEW_COMMAND_EDIT: win_state = WINDOW_EDIT; break; case VIEW_COMMAND_INDEX: win_state = WINDOW_INDEX; break; case VIEW_COMMAND_PREVIOUS: select_previous_item (); win_state = WINDOW_VIEW; break; case VIEW_COMMAND_NEXT: select_next_item (); win_state = WINDOW_VIEW; break; default: break; } } else { win_state = WINDOW_INDEX; } vc_delete_deep (v); v = NULL; break; case WINDOW_EDIT: /*-------------- edit a vcard --------------*/ it = get_current_item (); /* only display if there is an item that is selected */ if (NULL != it) { fpos = (fpos_t *) item_userptr (it); fp = fopen (data_path, "r"); fsetpos (fp, fpos); pos = ftell (fp); fclose (fp); fp = NULL; if (EDIT_SUCCESSFUL == edit_entry (data_path, pos)) { refresh_index (); } } win_state = WINDOW_INDEX; break; case WINDOW_ADD: if (ADD_SUCCESSFUL == add_entry (data_path)) { refresh_index (); } win_state = WINDOW_INDEX; break; case WINDOW_DELETE: it = get_current_item (); /* only delete if there is an item that is selected */ if (NULL != it) { fpos = (fpos_t *) item_userptr (it); fp = fopen (data_path, "r"); fsetpos (fp, fpos); pos = ftell (fp); fclose (fp); fp = NULL; if (DELETE_SUCCESSFUL == delete_entry (data_path, pos)) { refresh_index (); } } win_state = WINDOW_INDEX; break; default: break; } } finish (0); exit (EXIT_SUCCESS); return (0); }
/********************************************************************* Main processing loop. get a key record from the input queue. if a key was input from keyboard (owner == TRUE), then look at the key record and try to call a function. If no function, then just input it into the sheet. if input was from clipboard (owner == FALSE), then don't try to call a function, just put it in the sheet. v 3.0 9-12-94 still needs work. sigh.. ************************************************************************/ static void edit_loop (void) { USHORT key; bool ok = FALSE; // temp for load_key USHORT cmd_result = 0x0000; // returned from do_command UCHAR lokey, hikey; // low and high byte of KEY USHORT USHORT keystate; struct key_rec edit_key_rec; #ifndef NO_COMMANDO //char commando_cwd[FNAME_LEN]; //strcpy (commando_cwd, cwd); #endif #ifndef NO_HELP DEF_HELP(EDIT_HELP,1,-1,-1); init_help (Help); NEW_HELP; #endif for (;;) { get_next: edit_key_rec = view_getkey(); key = edit_key_rec.value; keystate = edit_key_rec.state; lokey = LOUCHAR(key); hikey = HIUCHAR(key); // DBG_INI(dout<<"edit.cpp line "<<__LINE__<<" shell_command.s = °"<<settings.shell_command.s<<"°"<<endl); switch (key) { case kESC: if (pulldown_menu() && tryquit ()) { return; } else { lokey = 0x00; // "eat" the ESC key } break; default: DBG_KEY(dout<<'\n'<<"edit key = "<<hex<<key<<" high = "<<hikey); DBG_KEY(dout<<" low = "<< lokey<<" keystate = "<<keystate<<dec<<endl); if(edit_key_rec.owner == TRUE) { // keyboard key if((CTL_KEY(keystate)) || ((lokey == 0x00)||(lokey == 0xE0))) { if(key != 0x0000) { cmd_result = do_command(mykey_rec); DBG_KEY(dout<<" edit_key after do_command() "<<endl); } if(cmd_result == CMD_QUIT) { DBG_KEY(dout<<" edit key QUIT cmd_result = "<<hex<<cmd_result<<dec<<endl); return; } if(cmd_result == CMD_HANDLED) { DBG_KEY(dout<<" edit key ignoring cmd_result = "<<hex<<cmd_result<<dec<<endl); goto get_next; } } if((lokey != 0xE0) && (lokey >0)) { // ignore any ext key not handled DBG_KEY(dout<<" edit_key calling view_addkey() "<<endl); view_addkey(lokey); break; } } else { DBG_KEY(dout<<" edit key not owner"<<endl); if((lokey < 255) && (lokey >0)) { // ignore any ext key not handled // DBG_KEY(dout<<" edit_loop addkey key = "<<hex<<lokey<<dec<<endl); view_addkey(lokey); break; } } } // end switch/case } // end for(;;) #pragma warn -aus // eliminate 'OLD_HELP'assigned but not used }