LJ Archive

Listing 2. Defining Key-Command Macro

int
call_sc_perl_macro(mac_num)
int mac_num;
{
 char macro[15];
 sprintf(macro,"sc_macro_%c",mac_num);
 if( perl_get_cv(macro,NULL) ) {
  perl_call_va(macro,NULL);
  return 0;
 }
 else {
  return 1;
 }
}
/* In Key stroke processing Loop. */
case ctl('k'):
 error("Select a macro to run 1 - 9 ");
 (void) refresh();
 if( call_sc_perl_macro(nmgetch()) ) {
  error("macro not defined!!");
 }
LJ Archive