[BACK]Return to keymap.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / mg

Diff for /src/usr.bin/mg/keymap.c between version 1.3 and 1.4

version 1.3, 2000/04/13 06:12:15 version 1.4, 2000/09/01 14:59:08
Line 1 
Line 1 
 /*  /*
  * Keyboard maps.  This is character set dependent.   * Keyboard maps.  This is character set dependent.  The terminal specific
  * The terminal specific parts of building the   * parts of building the keymap has been moved to a better place.
  * keymap has been moved to a better place.  
  */   */
   
 #include        "def.h"  #include        "def.h"
 #include        "kbd.h"  #include        "kbd.h"
   
 /*  static int       name_fent      __P((char *, int));
  * defined by "macro.c"  
  */  
 #ifndef NO_MACRO  
 extern int      definemacro();  /* Begin macro                   */  
 extern int      finishmacro();  /* End macro                     */  
 extern int      executemacro(); /* Execute macro                 */  
 #endif  
   
 /*  /*
  * Defined by "main.c".   * initial keymap declarations, deepest first
  */   */
 extern int      ctrlg();        /* Abort out of things           */  
 extern int      quit();         /* Quit                          */  
   
 /*  
  * Defined by "match.c"  
  */  
 extern int      showmatch();    /* Hack to show matching paren   */  
   
 /* defined by "modes.c" */  
   
 extern int      indentmode();   /* set auto-indent mode          */  
 extern int      fillmode();     /* set word-wrap mode            */  
 extern int      blinkparen();   /* Fake blink-matching-paren var */  
 #ifdef  NOTAB  
 extern int      notabmode();    /* no tab mode                   */  
 #endif  
 extern int      overwrite();    /* overwrite mode                */  
 extern int      set_default_mode();     /* set default modes             */  
   
 /*  
  * defined by "paragraph.c" - the paragraph justification code.  
  */  
 extern int      gotobop();      /* Move to start of paragraph.   */  
 extern int      gotoeop();      /* Move to end of paragraph.     */  
 extern int      fillpara();     /* Justify a paragraph.          */  
 extern int      killpara();     /* Delete a paragraph.           */  
 extern int      setfillcol();   /* Set fill column for justify. */  
 extern int      fillword();     /* Insert char with word wrap.   */  
   
 /*  
  * Defined by "random.c".  
  */  
 extern int      showcpos();     /* Show the cursor position      */  
 extern int      twiddle();      /* Twiddle characters            */  
 extern int      quote();        /* Insert literal                */  
 extern int      openline();     /* Open up a blank line          */  
 extern int      newline();      /* Insert newline                */  
 extern int      deblank();      /* Delete blank lines            */  
 extern int      justone();      /* Delete extra whitespace       */  
 extern int      delwhite();     /* Delete all whitespace         */  
 extern int      indent();       /* Insert newline, then indent   */  
 extern int      forwdel();      /* Forward delete                */  
 extern int      backdel();      /* Backward delete in            */  
 extern int      killline();     /* Kill forward                  */  
 extern int      yank();         /* Yank back from killbuffer.    */  
 #ifdef NOTAB  
 extern int      space_to_tabstop();  
 #endif  
   
 #ifdef  REGEX  
 /*  
  * Defined by "re_search.c"  
  */  
 extern int      re_forwsearch();/* Regex search forward          */  
 extern int      re_backsearch();/* Regex search backwards        */  
 extern int      re_searchagain();       /* Repeat regex search command   */  
 extern int      re_queryrepl(); /* Regex query replace           */  
 extern int      setcasefold();  /* Set case fold in searches     */  
 extern int      delmatchlines();/* Delete all lines matching     */  
 extern int      delnonmatchlines();     /* Delete all lines not matching */  
 extern int      cntmatchlines();/* Count matching lines          */  
 extern int      cntnonmatchlines();     /* Count nonmatching lines       */  
 #endif  
   
 /*  
  * Defined by "region.c".  
  */  
 extern int      killregion();   /* Kill region.                  */  
 extern int      copyregion();   /* Copy region to kill buffer.   */  
 extern int      lowerregion();  /* Lower case region.            */  
 extern int      upperregion();  /* Upper case region.            */  
 #ifdef  PREFIXREGION  
 extern int      prefixregion(); /* Prefix all lines in region    */  
 extern int      setprefix();    /* Set line prefix string        */  
 #endif  
   
 /*  
  * Defined by "search.c".  
  */  
 extern int      forwsearch();   /* Search forward                */  
 extern int      backsearch();   /* Search backwards              */  
 extern int      searchagain();  /* Repeat last search command    */  
 extern int      forwisearch();  /* Incremental search forward    */  
 extern int      backisearch();  /* Incremental search backwards */  
 extern int      queryrepl();    /* Query replace                 */  
   
 /*  
  * Defined by "spawn.c".  
  */  
 extern int      spawncli();             /* Run CLI in a subjob.          */  
 #ifdef  VMS  
 extern int      attachtoparent();       /* Attach to parent process      */  
 #endif  
   
 /* defined by "version.c" */  
   
 extern int      showversion();  /* Show version numbers, etc.    */  
   
 /*  
  * Defined by "window.c".  
  */  
 extern int      reposition();   /* Reposition window             */  
 extern int      refresh();      /* Refresh the screen            */  
 extern int      nextwind();     /* Move to the next window       */  
 #ifdef  GOSMACS  
 extern int      prevwind();     /* Move to the previous window   */  
 #endif  
 extern int      onlywind();     /* Make current window only one */  
 extern int      splitwind();    /* Split current window          */  
 extern int      delwind();      /* Delete current window         */  
 extern int      enlargewind();  /* Enlarge display window.       */  
 extern int      shrinkwind();   /* Shrink window.                */  
   
 /*  
  * Defined by "word.c".  
  */  
 extern int      backword();     /* Backup by words               */  
 extern int      forwword();     /* Advance by words              */  
 extern int      upperword();    /* Upper case word.              */  
 extern int      lowerword();    /* Lower case word.              */  
 extern int      capword();      /* Initial capitalize word.      */  
 extern int      delfword();     /* Delete forward word.          */  
 extern int      delbword();     /* Delete backward word.         */  
   
 #ifdef  AMIGA  
 #ifdef  DO_ICONIFY  
 extern int      tticon();  
 #endif  
 #ifdef  DO_MENU  
 extern int      amigamenu();    /* Menu function                 */  
 #endif  
 #ifdef  MOUSE  
 extern int      amigamouse();   /* Amiga mouse functions         */  
 extern int      mgotobob();  
 extern int      mforwdel();  
 extern int      mdelwhite();  
 extern int      mdelwind();  
 extern int      mgotoeob();  
 extern int      menlargewind();  
 extern int      mkillline();  
 extern int      mkillregion();  
 extern int      mdelfword();  
 extern int      mreposition();  
 extern int      mbackpage();  
 extern int      mforwpage();  
 extern int      mshrinkwind();  
 extern int      msplitwind();  
 extern int      myank();  
 #endif                          /* MOUSE */  
   
 extern int      togglewindow(); /* Defined by "ttyio.c"          */  
 extern int      togglezooms();  /* ""         ""                 */  
   
 #ifdef  CHANGE_FONT  
 extern int      setfont();      /* Defined by "ttyio.c"          */  
 #endif  
   
 #ifdef  CHANGE_COLOR  
 /* functions to mess with the mode line rendition, window colors */  
 extern int      ttmode();       /* Defined by "tty.c"            */  
 extern int      tttext();       /* ""                            */  
 extern int      textforeground();       /* ""                            */  
 extern int      textbackground();       /* ""                            */  
 extern int      modeforeground();       /* ""                            */  
 extern int      modebackground();       /* ""                            */  
 #endif  
   
 /*  
  * This file contains map segment definitions for adding function keys to  
  * keymap declarations.  Currently you can add things to the fundamental  
  * mode keymap and the dired mode keymap.  See the declaration of  
  * diredmap and fundmap for details.  
  */  
 #include "amiga_maps.c"  
   
 #endif                          /* AMIGA */  
   
 /* initial keymap declarations, deepest first */  
   
 #ifndef NO_HELP  #ifndef NO_HELP
 static PF       cHcG[] = {  static PF cHcG[] = {
         ctrlg,                  /* ^G */          ctrlg,                  /* ^G */
         help_help,              /* ^H */          help_help,              /* ^H */
 };  };
 static PF       cHa[] = {  
   static PF cHa[] = {
         apropos_command,        /* a */          apropos_command,        /* a */
         wallchart,              /* b */          wallchart,              /* b */
         desckey,                /* c */          desckey,                /* c */
 };  };
   
 static struct KEYMAPE (2 + IMAPEXT) helpmap = {  static struct KEYMAPE (2 + IMAPEXT) helpmap = {
         2,          2,
         2 + IMAPEXT,          2 + IMAPEXT,
         rescan,          rescan,
         {          {
                 {                  {
                         CCHR('G'), CCHR('H'), cHcG, (KEYMAP *) NULL                          CCHR('G'), CCHR('H'), cHcG, (KEYMAP *)NULL
                 },                  },
                 {                  {
                         'a', 'c', cHa, (KEYMAP *) NULL                          'a', 'c', cHa, (KEYMAP *)NULL
                 },                  },
         }          }
 };  };
 #endif  #endif /* !NO_HELP */
   
 static struct KEYMAPE (1 + IMAPEXT) extramap1 = {  static struct KEYMAPE (1 + IMAPEXT) extramap1 = {
         0,          0,
Line 252 
Line 69 
         rescan          rescan
 };  };
   
 static PF       cX4cF[] = {  static PF cX4cF[] = {
         poptofile,              /* ^f */          poptofile,              /* ^f */
         ctrlg,                  /* ^g */          ctrlg,                  /* ^g */
 };  };
 static PF       cX4b[] = {  static PF cX4b[] = {
         poptobuffer,            /* b */          poptobuffer,            /* b */
         rescan,                 /* c */          rescan,                 /* c */
         rescan,                 /* d */          rescan,                 /* d */
Line 269 
Line 86 
         rescan,          rescan,
         {          {
                 {                  {
                         CCHR('F'), CCHR('G'), cX4cF, (KEYMAP *) NULL                          CCHR('F'), CCHR('G'), cX4cF, (KEYMAP *)NULL
                 },                  },
                 {                  {
                         'b', 'f', cX4b, (KEYMAP *) NULL                          'b', 'f', cX4b, (KEYMAP *)NULL
                 },                  },
         }          }
 };  };
   
 static PF       cXcB[] = {  static PF cXcB[] = {
         listbuffers,            /* ^B */          listbuffers,            /* ^B */
         quit,                   /* ^C */          quit,                   /* ^C */
         rescan,                 /* ^D */          rescan,                 /* ^D */
Line 285 
Line 102 
         filevisit,              /* ^F */          filevisit,              /* ^F */
         ctrlg,                  /* ^G */          ctrlg,                  /* ^G */
 };  };
 static PF       cXcL[] = {  
   static PF cXcL[] = {
         lowerregion,            /* ^L */          lowerregion,            /* ^L */
         rescan,                 /* ^M */          rescan,                 /* ^M */
         rescan,                 /* ^N */          rescan,                 /* ^N */
Line 300 
Line 118 
         filewrite,              /* ^W */          filewrite,              /* ^W */
         swapmark,               /* ^X */          swapmark,               /* ^X */
 };  };
   
 #ifndef NO_MACRO  #ifndef NO_MACRO
 static PF       cXlp[] = {  static PF cXlp[] = {
         definemacro,            /* ( */          definemacro,            /* ( */
         finishmacro,            /* ) */          finishmacro,            /* ) */
 };  };
 #endif  #endif /* !NO_MACRO */
 static PF       cX0[] = {  
   static PF cX0[] = {
         delwind,                /* 0 */          delwind,                /* 0 */
         onlywind,               /* 1 */          onlywind,               /* 1 */
         splitwind,              /* 2 */          splitwind,              /* 2 */
         rescan,                 /* 3 */          rescan,                 /* 3 */
         prefix,                 /* 4 */          prefix,                 /* 4 */
 };  };
 static PF       cXeq[] = {  
   static PF cXeq[] = {
         showcpos,               /* = */          showcpos,               /* = */
 };  };
 static PF       cXcar[] = {  
   static PF cXcar[] = {
         enlargewind,            /* ^ */          enlargewind,            /* ^ */
         rescan,                 /* _ */          rescan,                 /* _ */
         rescan,                 /* ` */          rescan,                 /* ` */
Line 325 
Line 147 
         rescan,                 /* c */          rescan,                 /* c */
 #ifndef NO_DIRED  #ifndef NO_DIRED
         dired,                  /* d */          dired,                  /* d */
 #else  #else /* !NO_DIRED */
         rescan,                 /* d */          rescan,                 /* d */
 #endif  #endif /* !NO_DIRED */
 #ifndef NO_MACRO  #ifndef NO_MACRO
         executemacro,           /* e */          executemacro,           /* e */
 #else  #else /* !NO_MACRO */
         rescan,                 /* e */          rescan,                 /* e */
 #endif  #endif /* !NO_MACRO */
         setfillcol,             /* f */          setfillcol,             /* f */
         rescan,                 /* g */          rescan,                 /* g */
         rescan,                 /* h */          rescan,                 /* h */
Line 348 
Line 170 
         rescan,                 /* r */          rescan,                 /* r */
         savebuffers,            /* s */          savebuffers,            /* s */
 };  };
   
 #ifndef NO_MACRO  #ifndef NO_MACRO
 static struct KEYMAPE (6 + IMAPEXT) cXmap = {  static struct KEYMAPE (6 + IMAPEXT) cXmap = {
         6,          6,
         6 + IMAPEXT,          6 + IMAPEXT,
 #else  #else /* !NO_MACRO */
 static struct KEYMAPE (5 + IMAPEXT) cXmap = {  static struct KEYMAPE (5 + IMAPEXT) cXmap = {
         5,          5,
         5 + IMAPEXT,          5 + IMAPEXT,
 #endif  #endif /* !NO_MACRO */
         rescan,          rescan,
         {          {
                 {                  {
                         CCHR('B'), CCHR('G'), cXcB, (KEYMAP *) NULL                          CCHR('B'), CCHR('G'), cXcB, (KEYMAP *)NULL
                 },                  },
                 {                  {
                         CCHR('L'), CCHR('X'), cXcL, (KEYMAP *) NULL                          CCHR('L'), CCHR('X'), cXcL, (KEYMAP *)NULL
                 },                  },
 #ifndef NO_MACRO  #ifndef NO_MACRO
                 {                  {
                         '(', ')', cXlp, (KEYMAP *) NULL                          '(', ')', cXlp, (KEYMAP *)NULL
                 },                  },
 #endif  #endif /* !NO_MACRO */
                 {                  {
                         '0', '4', cX0, (KEYMAP *) & cX4map                          '0', '4', cX0, (KEYMAP *) & cX4map
                 },                  },
                 {                  {
                         '=', '=', cXeq, (KEYMAP *) NULL                          '=', '=', cXeq, (KEYMAP *)NULL
                 },                  },
                 {                  {
                         '^', 's', cXcar, (KEYMAP *) NULL                          '^', 's', cXcar, (KEYMAP *)NULL
                 },                  },
         }          }
 };  };
   
 static PF       metacG[] = {  static PF metacG[] = {
         ctrlg,                  /* ^G */          ctrlg,                  /* ^G */
 };  };
 static PF       metacV[] = {  
   static PF metacV[] = {
         pagenext,               /* ^V */          pagenext,               /* ^V */
 };  };
 static PF       metasp[] = {  
   static PF metasp[] = {
         justone,                /* space */          justone,                /* space */
 };  };
 static PF       metapct[] = {  
   static PF metapct[] = {
         queryrepl,              /* % */          queryrepl,              /* % */
 };  };
 static PF       metami[] = {  
   static PF metami[] = {
         negative_argument,      /* - */          negative_argument,      /* - */
         rescan,                 /* . */          rescan,                 /* . */
         rescan,                 /* / */          rescan,                 /* / */
Line 414 
Line 241 
         rescan,                 /* = */          rescan,                 /* = */
         gotoeob,                /* > */          gotoeob,                /* > */
 };  };
 static PF       metalb[] = {  
   static PF metalb[] = {
         gotobop,                /* [ */          gotobop,                /* [ */
         delwhite,               /* \ */          delwhite,               /* \ */
         gotoeop,                /* ] */          gotoeop,                /* ] */
Line 428 
Line 256 
         rescan,                 /* e */          rescan,                 /* e */
         forwword,               /* f */          forwword,               /* f */
 };  };
 static PF       metal[] = {  
   static PF metal[] = {
         lowerword,              /* l */          lowerword,              /* l */
         rescan,                 /* m */          rescan,                 /* m */
         rescan,                 /* n */          rescan,                 /* n */
Line 443 
Line 272 
         copyregion,             /* w */          copyregion,             /* w */
         extend,                 /* x */          extend,                 /* x */
 };  };
 static PF       metatilde[] = {  
   static PF metatilde[] = {
         notmodified,            /* ~ */          notmodified,            /* ~ */
         delbword,               /* DEL */          delbword,               /* DEL */
 };  };
   
 static struct KEYMAPE (8 + IMAPEXT) metamap = {  static struct KEYMAPE (8 + IMAPEXT) metamap = {
         8,          8,
         8 + IMAPEXT,          8 + IMAPEXT,
         rescan,          rescan,
         {          {
                 {                  {
                         CCHR('G'), CCHR('G'), metacG, (KEYMAP *) NULL                          CCHR('G'), CCHR('G'), metacG, (KEYMAP *)NULL
                 },                  },
                 {                  {
                         CCHR('V'), CCHR('V'), metacV, (KEYMAP *) NULL                          CCHR('V'), CCHR('V'), metacV, (KEYMAP *)NULL
                 },                  },
                 {                  {
                         ' ', ' ', metasp, (KEYMAP *) NULL                          ' ', ' ', metasp, (KEYMAP *)NULL
                 },                  },
                 {                  {
                         '%', '%', metapct, (KEYMAP *) NULL                          '%', '%', metapct, (KEYMAP *)NULL
                 },                  },
                 {                  {
                         '-', '>', metami, (KEYMAP *) NULL                          '-', '>', metami, (KEYMAP *)NULL
                 },                  },
                 {                  {
                         '[', 'f', metalb, (KEYMAP *) NULL                          '[', 'f', metalb, (KEYMAP *)NULL
                 },                  },
                 {                  {
                         'l', 'x', metal, (KEYMAP *) NULL                          'l', 'x', metal, (KEYMAP *) NULL
                 },                  },
                 {                  {
                         '~', CCHR('?'), metatilde, (KEYMAP *) NULL                          '~', CCHR('?'), metatilde, (KEYMAP *)NULL
                 },                  },
         }          }
 };  };
   
 static PF       fund_at[] = {  static PF fund_at[] = {
         setmark,                /* ^@ */          setmark,                /* ^@ */
         gotobol,                /* ^A */          gotobol,                /* ^A */
         backchar,               /* ^B */          backchar,               /* ^B */
Line 490 
Line 321 
         ctrlg,                  /* ^G */          ctrlg,                  /* ^G */
 #ifndef NO_HELP  #ifndef NO_HELP
         prefix,                 /* ^H */          prefix,                 /* ^H */
 #else  #else /* !NO_HELP */
         rescan,                 /* ^H */          rescan,                 /* ^H */
 #endif  #endif /* !NO_HELP */
 };  };
   
 /* ^I is selfinsert */  /* ^I is selfinsert */
 static PF       fund_CJ[] = {  static PF fund_CJ[] = {
         indent,                 /* ^J */          indent,                 /* ^J */
         killline,               /* ^K */          killline,               /* ^K */
         reposition,             /* ^L */          reposition,             /* ^L */
Line 512 
Line 344 
         killregion,             /* ^W */          killregion,             /* ^W */
         prefix,                 /* ^X */          prefix,                 /* ^X */
         yank,                   /* ^Y */          yank,                   /* ^Y */
 #ifndef VMS  
         spawncli,               /* ^Z */          spawncli,               /* ^Z */
 #else  
         attachtoparent,         /* ^Z */  
 #endif  
 };  };
 static PF       fund_esc[] = {  
   static PF fund_esc[] = {
         prefix,                 /* esc */          prefix,                 /* esc */
         rescan,                 /* ^\ *//* selfinsert is default on          rescan,                 /* ^\ selfinsert is default on fundamental */
                                  * fundamental */  
         rescan,                 /* ^] */          rescan,                 /* ^] */
         rescan,                 /* ^^ */          rescan,                 /* ^^ */
         rescan,                 /* ^_ */          rescan,                 /* ^_ */
 };  };
 static PF       fund_del[] = {  
   static PF fund_del[] = {
         backdel,                /* DEL */          backdel,                /* DEL */
 };  };
   
Line 543 
Line 372 
                 {                  {
                         CCHR('@'), CCHR('H'), fund_at, (KEYMAP *) & helpmap                          CCHR('@'), CCHR('H'), fund_at, (KEYMAP *) & helpmap
                 },                  },
 #else  #else /* !NO_HELP */
                 {                  {
                         CCHR('@'), CCHR('H'), fund_at, (KEYMAP *) NULL                          CCHR('@'), CCHR('H'), fund_at, (KEYMAP *)NULL
                 },                  },
 #endif  #endif /* !NO_HELP */
                 {                  {
                         CCHR('J'), CCHR('Z'), fund_CJ, (KEYMAP *) & cXmap                          CCHR('J'), CCHR('Z'), fund_CJ, (KEYMAP *) & cXmap
                 },                  },
Line 555 
Line 384 
                         CCHR('['), CCHR('_'), fund_esc, (KEYMAP *) & metamap                          CCHR('['), CCHR('_'), fund_esc, (KEYMAP *) & metamap
                 },                  },
                 {                  {
                         CCHR('?'), CCHR('?'), fund_del, (KEYMAP *) NULL                          CCHR('?'), CCHR('?'), fund_del, (KEYMAP *)NULL
                 },                  },
 #ifdef  FUND_XMAPS  #ifdef FUND_XMAPS
                 FUND_XMAPS,                  FUND_XMAPS,
 #endif  #endif /* FUND_XMAPS */
         }          }
 };  };
   
 static PF       fill_sp[] = {  static PF fill_sp[] = {
         fillword,               /* ' ' */          fillword,               /* ' ' */
 };  };
   
 static struct KEYMAPE (1 + IMAPEXT) fillmap = {  static struct KEYMAPE (1 + IMAPEXT) fillmap = {
         1,          1,
         1 + IMAPEXT,          1 + IMAPEXT,
         rescan,          rescan,
         {          {
                 {                  {
                         ' ', ' ', fill_sp, (KEYMAP *) NULL                          ' ', ' ', fill_sp, (KEYMAP *)NULL
                 },                  },
         }          }
 };  };
   
 static PF       indent_lf[] = {  static PF indent_lf[] = {
         newline,                /* ^J */          newline,                /* ^J */
         rescan,                 /* ^K */          rescan,                 /* ^K */
         rescan,                 /* ^L */          rescan,                 /* ^L */
         indent,                 /* ^M */          indent,                 /* ^M */
 };  };
   
 static struct KEYMAPE (1 + IMAPEXT) indntmap = {  static struct KEYMAPE (1 + IMAPEXT) indntmap = {
         1,          1,
         1 + IMAPEXT,          1 + IMAPEXT,
         rescan,          rescan,
         {          {
                 {                  {
                         CCHR('J'), CCHR('M'), indent_lf, (KEYMAP *) NULL                          CCHR('J'), CCHR('M'), indent_lf, (KEYMAP *)NULL
                 },                  },
         }          }
 };  };
 static PF       blink_rp[] = {  
   static PF blink_rp[] = {
         showmatch,              /* ) */          showmatch,              /* ) */
 };  };
   
 static struct KEYMAPE (1 + IMAPEXT) blinkmap = {  static struct KEYMAPE (1 + IMAPEXT) blinkmap = {
         1,          1,
         1 + IMAPEXT,          1 + IMAPEXT,
         rescan,          rescan,
         {          {
                 {                  {
                         ')', ')', blink_rp, (KEYMAP *) NULL                          ')', ')', blink_rp, (KEYMAP *)NULL
                 },                  },
         }          }
 };  };
   
 #ifdef  NOTAB  #ifdef NOTAB
 static PF       notab_tab[] = {  static PF notab_tab[] = {
         space_to_tabstop,       /* ^I */          space_to_tabstop,       /* ^I */
 };  };
   
 static struct KEYMAPE (1 + IMAPEXT) notabmap = {  static struct KEYMAPE (1 + IMAPEXT) notabmap = {
         1,          1,
         1 + IMAPEXT,          1 + IMAPEXT,
         rescan,          rescan,
         {          {
                 {                  {
                         CCHR('I'), CCHR('I'), notab_tab, (KEYMAP *) NULL                          CCHR('I'), CCHR('I'), notab_tab, (KEYMAP *)NULL
                 },                  },
         }          }
 };  };
 #endif  #endif /* NOTAB */
   
 static struct KEYMAPE (1 + IMAPEXT) overwmap = {  static struct KEYMAPE (1 + IMAPEXT) overwmap = {
         0,          0,
Line 630 
Line 464 
         {          {
                 /* unused dummy entry for VMS C */                  /* unused dummy entry for VMS C */
                 {                  {
                         (KCHAR) 0, (KCHAR) 0, (PF *) NULL, (KEYMAP *) NULL                          (KCHAR)0, (KCHAR)0, (PF *)NULL, (KEYMAP *)NULL
                 },                  },
         }          }
 };  };
   
 #ifndef NO_DIRED  #ifndef NO_DIRED
 static PF       dirednul[] = {  static PF dirednul[] = {
         setmark,                /* ^@ */          setmark,                /* ^@ */
         gotobol,                /* ^A */          gotobol,                /* ^A */
         backchar,               /* ^B */          backchar,               /* ^B */
Line 647 
Line 481 
         ctrlg,                  /* ^G */          ctrlg,                  /* ^G */
 #ifndef NO_HELP  #ifndef NO_HELP
         prefix,                 /* ^H */          prefix,                 /* ^H */
 #endif  #endif /* !NO_HELP */
 };  };
 static PF       diredcl[] = {  
   static PF diredcl[] = {
         reposition,             /* ^L */          reposition,             /* ^L */
         forwline,               /* ^M */          forwline,               /* ^M */
         forwline,               /* ^N */          forwline,               /* ^N */
Line 664 
Line 499 
         rescan,                 /* ^W */          rescan,                 /* ^W */
         prefix,                 /* ^X */          prefix,                 /* ^X */
 };  };
 static PF       diredcz[] = {  
 #ifndef VMS  static PF diredcz[] = {
         spawncli,               /* ^Z */          spawncli,               /* ^Z */
 #else  
         attachtoparent,         /* ^Z */  
 #endif  
         prefix,                 /* esc */          prefix,                 /* esc */
         rescan,                 /* ^\ */          rescan,                 /* ^\ */
         rescan,                 /* ^] */          rescan,                 /* ^] */
Line 677 
Line 509 
         rescan,                 /* ^_ */          rescan,                 /* ^_ */
         forwline,               /* SP */          forwline,               /* SP */
 };  };
 static PF       diredc[] = {  
   static PF diredc[] = {
         d_copy,                 /* c */          d_copy,                 /* c */
         d_del,                  /* d */          d_del,                  /* d */
         d_findfile,             /* e */          d_findfile,             /* e */
         d_findfile,             /* f */          d_findfile,             /* f */
 };  };
 static PF       diredn[] = {  
   static PF diredn[] = {
         forwline,               /* n */          forwline,               /* n */
         d_ffotherwindow,        /* o */          d_ffotherwindow,        /* o */
         backline,               /* p */          backline,               /* p */
Line 696 
Line 530 
         rescan,                 /* w */          rescan,                 /* w */
         d_expunge,              /* x */          d_expunge,              /* x */
 };  };
 static PF       direddl[] = {  
   static PF direddl[] = {
         d_undelbak,             /* del */          d_undelbak,             /* del */
 };  };
   
 #ifndef DIRED_XMAPS  #ifndef DIRED_XMAPS
 #define NDIRED_XMAPS    0       /* number of extra map sections */  #define NDIRED_XMAPS    0       /* number of extra map sections */
 #endif  #endif /* DIRED_XMAPS */
   
 static struct KEYMAPE (6 + NDIRED_XMAPS + IMAPEXT) diredmap = {  static struct KEYMAPE (6 + NDIRED_XMAPS + IMAPEXT) diredmap = {
         6 + NDIRED_XMAPS,          6 + NDIRED_XMAPS,
Line 713 
Line 548 
                 {                  {
                         CCHR('@'), CCHR('H'), dirednul, (KEYMAP *) & helpmap                          CCHR('@'), CCHR('H'), dirednul, (KEYMAP *) & helpmap
                 },                  },
 #else  #else /* !NO_HELP */
                 {                  {
                         CCHR('@'), CCHR('G'), dirednul, (KEYMAP *) NULL                          CCHR('@'), CCHR('G'), dirednul, (KEYMAP *)NULL
                 },                  },
 #endif  #endif /* !NO_HELP */
                 {                  {
                         CCHR('L'), CCHR('X'), diredcl, (KEYMAP *) & cXmap                          CCHR('L'), CCHR('X'), diredcl, (KEYMAP *) & cXmap
                 },                  },
Line 725 
Line 560 
                         CCHR('Z'), ' ', diredcz, (KEYMAP *) & metamap                          CCHR('Z'), ' ', diredcz, (KEYMAP *) & metamap
                 },                  },
                 {                  {
                         'c', 'f', diredc, (KEYMAP *) NULL                          'c', 'f', diredc, (KEYMAP *)NULL
                 },                  },
                 {                  {
                         'n', 'x', diredn, (KEYMAP *) NULL                          'n', 'x', diredn, (KEYMAP *)NULL
                 },                  },
                 {                  {
                         CCHR('?'), CCHR('?'), direddl, (KEYMAP *) NULL                          CCHR('?'), CCHR('?'), direddl, (KEYMAP *)NULL
                 },                  },
 #ifdef  DIRED_XMAPS  #ifdef  DIRED_XMAPS
                 DIRED_XMAPS,    /* map sections for dired mode keys      */                  DIRED_XMAPS,    /* map sections for dired mode keys      */
 #endif  #endif /* DIRED_XMAPS */
         }          }
 };  };
 #endif  #endif /* !NO_DIRED */
   
 /*  /*
  * give names to the maps, for use by help etc. If the map is to be bindable,   * give names to the maps, for use by help etc. If the map is to be bindable,
Line 749 
Line 584 
  * modes.c also.   * modes.c also.
  */   */
   
 MAPS            map_table[] = {  MAPS map_table[] = {
         /* fundamental map MUST be first entry */          /* fundamental map MUST be first entry */
         {(KEYMAP *) & fundmap, "fundamental"},          {(KEYMAP *) & fundmap, "fundamental"},
         {(KEYMAP *) & fillmap, "fill"},          {(KEYMAP *) & fillmap, "fill"},
         {(KEYMAP *) & indntmap, "indent"},          {(KEYMAP *) & indntmap, "indent"},
         {(KEYMAP *) & blinkmap, "blink"},          {(KEYMAP *) & blinkmap, "blink"},
 #ifdef  NOTAB  #ifdef NOTAB
         {(KEYMAP *) & notabmap, "notab"},          {(KEYMAP *) & notabmap, "notab"},
 #endif  #endif /* NOTAB */
         {(KEYMAP *) & overwmap, "overwrite"},          {(KEYMAP *) & overwmap, "overwrite"},
         {(KEYMAP *) & metamap, "esc prefix"},          {(KEYMAP *) & metamap, "esc prefix"},
         {(KEYMAP *) & cXmap, "c-x prefix"},          {(KEYMAP *) & cXmap, "c-x prefix"},
Line 776 
Line 611 
 };  };
   
 #define NMAPS   (sizeof map_table/sizeof(MAPS))  #define NMAPS   (sizeof map_table/sizeof(MAPS))
 int             nmaps = NMAPS;  /* for use by rebind in extend.c */  int      nmaps = NMAPS;         /* for use by rebind in extend.c */
   
 char           *  char *
 map_name(map)  map_name(map)
         KEYMAP         *map;          KEYMAP *map;
 {  {
         MAPS           *mp = &map_table[0];          MAPS    *mp = &map_table[0];
   
         do {          do {
                 if (mp->p_map == map)                  if (mp->p_map == map)
                         return mp->p_name;                          return mp->p_name;
         } while (++mp < &map_table[NMAPS]);          } while (++mp < &map_table[NMAPS]);
         return (char *) NULL;          return (char *)NULL;
 }  }
   
 MAPS           *  MAPS *
 name_mode(name)  name_mode(name)
         char           *name;          char *name;
 {  {
         MAPS           *mp = &map_table[0];          MAPS    *mp = &map_table[0];
   
         do {          do {
                 if (strcmp(mp->p_name, name) == 0)                  if (strcmp(mp->p_name, name) == 0)
                         return mp;                          return mp;
         } while (++mp < &map_table[NMAPS]);          } while (++mp < &map_table[NMAPS]);
         return (MAPS *) NULL;          return (MAPS *)NULL;
 }  }
   
 KEYMAP         *  KEYMAP *
 name_map(name)  name_map(name)
         char           *name;          char *name;
 {  {
         MAPS           *mp;          MAPS    *mp;
         return (mp = name_mode(name)) == NULL ? (KEYMAP *) NULL : mp->p_map;          return (mp = name_mode(name)) == NULL ? (KEYMAP *)NULL : mp->p_map;
 }  }
   
 /*  /*
Line 817 
Line 652 
  * in name_function.)  If the function is prefix, it must be listed with the   * in name_function.)  If the function is prefix, it must be listed with the
  * same name in the map_table above.   * same name in the map_table above.
  */   */
   FUNCTNAMES functnames[] = {
 FUNCTNAMES      functnames[] = {  
 #ifdef  AMIGA  
 #ifdef  DO_ICONIFY  
         {tticon, "amiga-iconify"},  
 #endif  
 #ifdef  DO_MENU  
         {amigamenu, "amiga-menu"},  
 #endif  
 #ifdef  CHANGE_COLOR  
         {modebackground, "amiga-mode-background"},  
         {modeforeground, "amiga-mode-foreground"},  
         {ttmode, "amiga-mode-rendition"},  
 #endif  
 #ifdef  CHANGE_FONT  
         {setfont, "amiga-set-font"},  
 #endif  
 #ifdef  CHANGE_COLOR  
         {textbackground, "amiga-text-background"},  
         {textforeground, "amiga-text-foreground"},  
         {tttext, "amiga-text-rendition"},  
 #endif  
         {togglewindow, "amiga-toggle-border"},  
         {togglezooms, "amiga-zoom-mode"},  
 #endif                          /* AMIGA */  
 #ifndef NO_HELP  #ifndef NO_HELP
         {apropos_command, "apropos"},          {apropos_command, "apropos"},
 #endif  #endif /* !NO_HELP */
         {fillmode, "auto-fill-mode"},          {fillmode, "auto-fill-mode"},
         {indentmode, "auto-indent-mode"},          {indentmode, "auto-indent-mode"},
         {backchar, "backward-char"},          {backchar, "backward-char"},
Line 855 
Line 666 
         {gotobol, "beginning-of-line"},          {gotobol, "beginning-of-line"},
         {blinkparen, "blink-matching-paren"},          {blinkparen, "blink-matching-paren"},
         {showmatch, "blink-matching-paren-hack"},          {showmatch, "blink-matching-paren-hack"},
 #ifdef  BSMAP  #ifdef BSMAP
         {bsmap, "bsmap-mode"},          {bsmap, "bsmap-mode"},
 #endif  #endif /* BSMAP */
         {prefix, "c-x 4 prefix"},          {prefix, "c-x 4 prefix"},
         {prefix, "c-x prefix"},          {prefix, "c-x prefix"},
 #ifndef NO_MACRO  #ifndef NO_MACRO
         {executemacro, "call-last-kbd-macro"},          {executemacro, "call-last-kbd-macro"},
 #endif  #endif /* !NO_MACRO */
         {capword, "capitalize-word"},          {capword, "capitalize-word"},
 #ifndef NO_DIR  #ifndef NO_DIR
         {changedir, "cd"},          {changedir, "cd"},
 #endif  #endif /* !NO_DIR */
         {copyregion, "copy-region-as-kill"},          {copyregion, "copy-region-as-kill"},
 #ifdef  REGEX  #ifdef  REGEX
         {cntmatchlines, "count-matches"},          {cntmatchlines, "count-matches"},
         {cntnonmatchlines, "count-non-matches"},          {cntnonmatchlines, "count-non-matches"},
 #endif  #endif /* REGEX */
         {define_key, "define-key"},          {define_key, "define-key"},
         {backdel, "delete-backward-char"},          {backdel, "delete-backward-char"},
         {deblank, "delete-blank-lines"},          {deblank, "delete-blank-lines"},
Line 880 
Line 691 
 #ifdef  REGEX  #ifdef  REGEX
         {delmatchlines, "delete-matching-lines"},          {delmatchlines, "delete-matching-lines"},
         {delnonmatchlines, "delete-non-matching-lines"},          {delnonmatchlines, "delete-non-matching-lines"},
 #endif  #endif /* REGEX */
         {onlywind, "delete-other-windows"},          {onlywind, "delete-other-windows"},
         {delwind, "delete-window"},          {delwind, "delete-window"},
 #ifndef NO_HELP  #ifndef NO_HELP
         {wallchart, "describe-bindings"},          {wallchart, "describe-bindings"},
         {desckey, "describe-key-briefly"},          {desckey, "describe-key-briefly"},
 #endif  #endif /* !NO_HELP */
         {digit_argument, "digit-argument"},          {digit_argument, "digit-argument"},
 #ifndef NO_DIRED  #ifndef NO_DIRED
         {dired, "dired"},          {dired, "dired"},
Line 899 
Line 710 
         {d_otherwindow, "dired-other-window"},          {d_otherwindow, "dired-other-window"},
         {d_rename, "dired-rename-file"},          {d_rename, "dired-rename-file"},
         {d_undel, "dired-unflag"},          {d_undel, "dired-unflag"},
 #endif  #endif /* !NO_DIRED */
         {lowerregion, "downcase-region"},          {lowerregion, "downcase-region"},
         {lowerword, "downcase-word"},          {lowerword, "downcase-word"},
         {showversion, "emacs-version"},          {showversion, "emacs-version"},
 #ifndef NO_MACRO  #ifndef NO_MACRO
         {finishmacro, "end-kbd-macro"},          {finishmacro, "end-kbd-macro"},
 #endif  #endif /* !NO_MACRO */
         {gotoeob, "end-of-buffer"},          {gotoeob, "end-of-buffer"},
         {gotoeol, "end-of-line"},          {gotoeol, "end-of-line"},
         {enlargewind, "enlarge-window"},          {enlargewind, "enlarge-window"},
Line 913 
Line 724 
 #ifndef NO_STARTUP  #ifndef NO_STARTUP
         {evalbuffer, "eval-current-buffer"},          {evalbuffer, "eval-current-buffer"},
         {evalexpr, "eval-expression"},          {evalexpr, "eval-expression"},
 #endif  #endif /* !NO_STARTUP */
         {swapmark, "exchange-point-and-mark"},          {swapmark, "exchange-point-and-mark"},
         {extend, "execute-extended-command"},          {extend, "execute-extended-command"},
         {prefix, "extra prefix 1"},          {prefix, "extra prefix 1"},
Line 933 
Line 744 
 #ifndef NO_HELP  #ifndef NO_HELP
         {prefix, "help"},          {prefix, "help"},
         {help_help, "help-help"},          {help_help, "help-help"},
 #endif  #endif /* !NO_HELP */
         {insert, "insert"},          {insert, "insert"},
         {bufferinsert, "insert-buffer"},          {bufferinsert, "insert-buffer"},
         {fileinsert, "insert-file"},          {fileinsert, "insert-file"},
Line 950 
Line 761 
         {listbuffers, "list-buffers"},          {listbuffers, "list-buffers"},
 #ifndef NO_STARTUP  #ifndef NO_STARTUP
         {evalfile, "load"},          {evalfile, "load"},
 #endif  #endif /* !NO_STARTUP */
         {localbind, "local-set-key"},          {localbind, "local-set-key"},
         {localunbind, "local-unset-key"},          {localunbind, "local-unset-key"},
 #ifndef NO_BACKUP  #ifndef NO_BACKUP
         {makebkfile, "make-backup-files"},          {makebkfile, "make-backup-files"},
 #endif  #endif /* !NO_BACKUP */
 #ifdef  DO_METAKEY  #ifdef DO_METAKEY
         {do_meta, "meta-key-mode"},     /* better name, anyone? */          {do_meta, "meta-key-mode"},     /* better name, anyone? */
 #endif  #endif /* DO_METAKEY */
 #ifdef  AMIGA  
 #ifdef  MOUSE  
         {mgotobob, "mouse-beginning-of-buffer"},  
         {mforwdel, "mouse-delete-char"},  
         {mdelwhite, "mouse-delete-horizontal-space"},  
         {mdelwind, "mouse-delete-window"},  
         {mgotoeob, "mouse-end-of-buffer"},  
         {menlargewind, "mouse-enlarge-window"},  
         {mkillline, "mouse-kill-line"},  
         {mkillregion, "mouse-kill-region"},  
         {mdelfword, "mouse-kill-word"},  
         {mreposition, "mouse-recenter"},  
         {mbackpage, "mouse-scroll-down"},  
         {mforwpage, "mouse-scroll-up"},  
         {amigamouse, "mouse-set-point"},  
         {mshrinkwind, "mouse-shrink-window"},  
         {msplitwind, "mouse-split-window-vertically"},  
         {myank, "mouse-yank"},  
 #endif  
 #endif  
         {negative_argument, "negative-argument"},          {negative_argument, "negative-argument"},
         {newline, "newline"},          {newline, "newline"},
         {indent, "newline-and-indent"},          {indent, "newline-and-indent"},
         {forwline, "next-line"},          {forwline, "next-line"},
 #ifdef  NOTAB  #ifdef NOTAB
         {notabmode, "no-tab-mode"},          {notabmode, "no-tab-mode"},
 #endif  #endif /* NOTAB */
         {notmodified, "not-modified"},          {notmodified, "not-modified"},
         {openline, "open-line"},          {openline, "open-line"},
         {nextwind, "other-window"},          {nextwind, "other-window"},
         {overwrite, "overwrite-mode"},          {overwrite, "overwrite-mode"},
 #ifdef  PREFIXREGION  #ifdef PREFIXREGION
         {prefixregion, "prefix-region"},          {prefixregion, "prefix-region"},
 #endif  #endif /* PREFIXREGION */
         {backline, "previous-line"},          {backline, "previous-line"},
 #ifdef  GOSMACS  #ifdef GOSMACS
         {prevwind, "previous-window"},          {prevwind, "previous-window"},
 #endif  #endif /* GOSEMACS */
 #ifdef  VMS  
         {spawncli, "push-to-dcl"},  
 #else  
         {spawncli, "push-shell"},          {spawncli, "push-shell"},
 #endif  
 #ifndef NO_DIR  #ifndef NO_DIR
         {showcwdir, "pwd"},          {showcwdir, "pwd"},
 #endif  #endif /* !NO_DIR */
         {queryrepl, "query-replace"},          {queryrepl, "query-replace"},
 #ifdef  REGEX  #ifdef REGEX
         {re_queryrepl, "query-replace-regexp"},          {re_queryrepl, "query-replace-regexp"},
 #endif  #endif /* REGEX */
         {quote, "quoted-insert"},          {quote, "quoted-insert"},
 #ifdef  REGEX  #ifdef REGEX
         {re_searchagain, "re-search-again"},          {re_searchagain, "re-search-again"},
         {re_backsearch, "re-search-backward"},          {re_backsearch, "re-search-backward"},
         {re_forwsearch, "re-search-forward"},          {re_forwsearch, "re-search-forward"},
 #endif  #endif /* REGEX */
         {reposition, "recenter"},          {reposition, "recenter"},
         {refresh, "redraw-display"},          {refresh, "redraw-display"},
         {filesave, "save-buffer"},          {filesave, "save-buffer"},
         {quit, "save-buffers-kill-emacs"},          {quit, "save-buffers-kill-emacs"},
         {savebuffers, "save-some-buffers"},          {savebuffers, "save-some-buffers"},
         {backpage, "scroll-down"},          {backpage, "scroll-down"},
 #ifdef  GOSMACS  #ifdef GOSMACS
         {back1page, "scroll-one-line-down"},          {back1page, "scroll-one-line-down"},
         {forw1page, "scroll-one-line-up"},          {forw1page, "scroll-one-line-up"},
 #endif  #endif /* GOSMACS */
         {pagenext, "scroll-other-window"},          {pagenext, "scroll-other-window"},
         {forwpage, "scroll-up"},          {forwpage, "scroll-up"},
         {searchagain, "search-again"},          {searchagain, "search-again"},
         {backsearch, "search-backward"},          {backsearch, "search-backward"},
         {forwsearch, "search-forward"},          {forwsearch, "search-forward"},
         {selfinsert, "self-insert-command"},          {selfinsert, "self-insert-command"},
 #ifdef  REGEX  #ifdef REGEX
         {setcasefold, "set-case-fold-search"},          {setcasefold, "set-case-fold-search"},
 #endif  #endif /* REGEX */
         {set_default_mode, "set-default-mode"},          {set_default_mode, "set-default-mode"},
         {setfillcol, "set-fill-column"},          {setfillcol, "set-fill-column"},
         {setmark, "set-mark-command"},          {setmark, "set-mark-command"},
 #ifdef  PREFIXREGION  #ifdef PREFIXREGION
         {setprefix, "set-prefix-string"},          {setprefix, "set-prefix-string"},
 #endif  #endif /* PREFIXREGION */
         {shrinkwind, "shrink-window"},          {shrinkwind, "shrink-window"},
 #ifdef  NOTAB  #ifdef NOTAB
         {space_to_tabstop, "space-to-tabstop"},          {space_to_tabstop, "space-to-tabstop"},
 #endif  #endif /* NOTAB */
         {splitwind, "split-window-vertically"},          {splitwind, "split-window-vertically"},
 #ifndef NO_MACRO  #ifndef NO_MACRO
         {definemacro, "start-kbd-macro"},          {definemacro, "start-kbd-macro"},
 #endif  #endif /* !NO_MACRO */
 #ifdef  VMS  
         {attachtoparent, "suspend-emacs"},  
 #else  
         {spawncli, "suspend-emacs"},          {spawncli, "suspend-emacs"},
 #endif  
         {usebuffer, "switch-to-buffer"},          {usebuffer, "switch-to-buffer"},
         {poptobuffer, "switch-to-buffer-other-window"},          {poptobuffer, "switch-to-buffer-other-window"},
         {twiddle, "transpose-chars"},          {twiddle, "transpose-chars"},
Line 1066 
Line 849 
   
 #define NFUNCT  (sizeof(functnames)/sizeof(FUNCTNAMES))  #define NFUNCT  (sizeof(functnames)/sizeof(FUNCTNAMES))
   
 int             nfunct = NFUNCT;/* used by help.c */  int      nfunct = NFUNCT;       /* used by help.c */
   
 /*  /*
  * The general-purpose version of ROUND2 blows osk C (2.0) out of the water.   * The general-purpose version of ROUND2 blows osk C (2.0) out of the water.
Line 1078 
Line 861 
  */   */
 #define ROUND2(x) (x<128?(x<64?32:64):(x<256?128:256))  #define ROUND2(x) (x<128?(x<64?32:64):(x<256?128:256))
   
 static  static int
 name_fent(fname, flag)  name_fent(fname, flag)
         register char  *fname;          char *fname;
         int             flag;          int   flag;
 {  {
         register int    try;          int      try, notit;
         register int    x = ROUND2(NFUNCT);          int      x = ROUND2(NFUNCT);
         register int    base = 0;          int      base = 0;
         register int    notit;  
   
         do {          do {
                 /* + can be used instead of | here if more efficent.     */                  /* + can be used instead of | here if more efficent.     */
                 if ((try = base | x) < NFUNCT) {                  if ((try = base | x) < NFUNCT) {
                         if ((notit = strcmp(fname, functnames[try].n_name)) >= 0) {                          if ((notit = strcmp(fname, functnames[try].n_name))
                               >= 0) {
                                 if (!notit)                                  if (!notit)
                                         return try;                                          return try;
                                 base = try;                                  base = try;
                         }                          }
                 }                  }
         } while ((x >>= 1) || (try == 1 && base == 0)); /* try 0 once if needed */          /* try 0 once if needed */
           } while ((x >>= 1) || (try == 1 && base == 0));
         return flag ? base : -1;          return flag ? base : -1;
 }  }
   
Line 1107 
Line 891 
   
 PF  PF
 name_function(fname)  name_function(fname)
         char           *fname;          char *fname;
 {  {
         int             i;          int      i;
         if ((i = name_fent(fname, FALSE)) >= 0)          if ((i = name_fent(fname, FALSE)) >= 0)
                 return functnames[i].n_funct;                  return functnames[i].n_funct;
         return (PF) NULL;          return (PF)NULL;
 }  }
   
 /* complete function name */  /*
    * complete function name
    */
 int  int
 complete_function(fname, c)  complete_function(fname, c)
         register char  *fname;          char *fname;
         int             c;          int   c;
 {  {
         register int    i, j, k, l;          int     i, j, k, l, oj;
         int             oj;  
   
         i = name_fent(fname, TRUE);          i = name_fent(fname, TRUE);
         for (j = 0; (l = fname[j]) && functnames[i].n_name[j] == l; j++) {          for (j = 0; (l = fname[j]) && functnames[i].n_name[j] == l; j++) {
         }          }
         if (fname[j] != '\0') {          if (fname[j] != '\0') {
                 if (++i >= NFUNCT)                  if (++i >= NFUNCT)
                         return -2;      /* no match */                          /* no match */
                 for (j = 0; (l = fname[j]) && functnames[i].n_name[j] == l; j++) {                          return -2;
                 }                  for (j = 0; (l = fname[j]) && functnames[i].n_name[j] == l;
                       j++);
                 if (fname[j] != '\0')                  if (fname[j] != '\0')
                         return -2;      /* no match */                          /* no match */
                           return -2;
         }          }
         if (c == CCHR('M') && functnames[i].n_name[j] == '\0')          if (c == CCHR('M') && functnames[i].n_name[j] == '\0')
                 return -1;                  return -1;
         for (k = i + 1; k < NFUNCT; k++) {      /* find last match */          /* find last match */
                 for (l = 0; functnames[k].n_name[l] == fname[l]; l++) {          for (k = i + 1; k < NFUNCT; k++) {
                 }                  for (l = 0; functnames[k].n_name[l] == fname[l]; l++);
                 if (l < j)                  if (l < j)
                         break;                          break;
         }          }
         k--;          k--;
         oj = j;          oj = j;
         if (k > i) {            /* multiple matches */  
                 while ((l = functnames[i].n_name[j]) == functnames[k].n_name[j]) {          if (k > i) {
                   /* multiple matches */
                   while ((l = functnames[i].n_name[j]) ==
                       functnames[k].n_name[j]) {
                         fname[j++] = l;                          fname[j++] = l;
                         if (l == '-' && c == ' ')                          if (l == '-' && c == ' ')
                                 break;                                  break;
                 }                  }
                 if (j == oj)                  if (j == oj)
                         return -3;      /* ambiguous     */                          /* ambiguous */
         } else {                /* single match */                          return -3;
                 while (l = functnames[i].n_name[j]) {          } else {
                   /* single match */
                   while ((l = functnames[i].n_name[j])) {
                         fname[j++] = l;                          fname[j++] = l;
                         if (l == '-' && c == ' ')                          if (l == '-' && c == ' ')
                                 break;                                  break;
Line 1165 
Line 956 
         return j - oj;          return j - oj;
 }  }
   
 /* list possible function name completions */  /*
    * list possible function name completions.
 LIST           *   */
   LIST *
 complete_function_list(fname, c)  complete_function_list(fname, c)
         register char  *fname;          char *fname;
           int   c;
 {  {
         register int    i, j, k, l;          int      i, j, k, l;
         int             oj;          LIST    *current, *last;
         LIST           *current, *last;  
   
         i = name_fent(fname, TRUE);          i = name_fent(fname, TRUE);
         for (j = 0; (l = fname[j]) && functnames[i].n_name[j] == l; j++) {          for (j = 0; (l = fname[j]) && functnames[i].n_name[j] == l; j++);
         }  
         if (fname[j] != '\0') {          if (fname[j] != '\0') {
                 if (++i >= NFUNCT)                  if (++i >= NFUNCT)
                         return NULL;    /* no match */                          /* no match */
                 for (j = 0; (l = fname[j]) && functnames[i].n_name[j] == l; j++) {                          return NULL;
                 }                  for (j = 0; (l = fname[j]) && functnames[i].n_name[j] == l;
                       j++);
                 if (fname[j] != '\0')                  if (fname[j] != '\0')
                         return NULL;    /* no match */                          /* no match */
                           return NULL;
         }          }
         /*          /*
          *      if(c==CCHR('M') && functnames[i].n_name[j]=='\0') return -1;           * if(c==CCHR('M') && functnames[i].n_name[j]=='\0') return -1;
          */           */
         for (k = i + 1; k < NFUNCT; k++) {      /* find last match */          /* find last match */
                 for (l = 0; functnames[k].n_name[l] == fname[l]; l++) {          for (k = i + 1; k < NFUNCT; k++) {
                 }                  for (l = 0; functnames[k].n_name[l] == fname[l]; l++);
                 if (l < j)                  if (l < j)
                         break;                          break;
         }          }
         k--;          k--;
         last = NULL;          last = NULL;
         for (; k >= i; k--) {          for (; k >= i; k--) {
                 current = (LIST *) malloc(sizeof(LIST));                  current = (LIST *)malloc(sizeof(LIST));
                 current->l_next = last;                  current->l_next = last;
                 current->l_name = functnames[k].n_name;                  current->l_name = functnames[k].n_name;
                 last = current;                  last = current;
Line 1206 
Line 999 
         return (last);          return (last);
 }  }
   
 /* translate from function pointer to function name. */  /*
    * translate from function pointer to function name.
 char           *   */
   char *
 function_name(fpoint)  function_name(fpoint)
         register PF     fpoint;          PF fpoint;
 {  {
         register FUNCTNAMES *fnp = &functnames[0];          FUNCTNAMES      *fnp = &functnames[0];
   
         if (fpoint == prefix)          if (fpoint == prefix)
                 return (char *) NULL;   /* ambiguous */                  /* ambiguous */
                   return (char *)NULL;
         do {          do {
                 if (fnp->n_funct == fpoint)                  if (fnp->n_funct == fpoint)
                         return fnp->n_name;                          return fnp->n_name;
         } while (++fnp < &functnames[NFUNCT]);          } while (++fnp < &functnames[NFUNCT]);
         return (char *) NULL;          return (char *)NULL;
 }  }

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4