home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / compsrcs / misc / volume07 / keydef < prev    next >
Encoding:
Internet Message Format  |  1991-08-27  |  24.0 KB

  1. From decwrl!decvax!mcnc!gatech!uflorida!mailrus!iuvax!purdue!tut.cis.ohio-state.edu!pt.cs.cmu.edu!rochester!rit!tropix!moscom!ur-valhalla!uhura.cc.rochester.edu!sunybcs!rutgers!usc!cs.utexas.edu!uunet!allbery Tue Aug 22 08:15:29 PDT 1989
  2. Article 1044 of comp.sources.misc:
  3. Path: decwrl!decvax!mcnc!gatech!uflorida!mailrus!iuvax!purdue!tut.cis.ohio-state.edu!pt.cs.cmu.edu!rochester!rit!tropix!moscom!ur-valhalla!uhura.cc.rochester.edu!sunybcs!rutgers!usc!cs.utexas.edu!uunet!allbery
  4. From: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  5. Newsgroups: comp.sources.misc
  6. Subject: v07i055: keydef - quickly, easily redefine VT[23]xx function keys
  7. Message-ID: <59231@uunet.UU.NET>
  8. Date: 8 Aug 89 00:05:21 GMT
  9. Reply-To: gordon@prls.UUCP (Gordon Vickers)
  10. Lines: 616
  11. Approved: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  12.  
  13. Posting-number: Volume 7, Issue 55
  14. Submitted-by: gordon@prls.UUCP (Gordon Vickers)
  15. Archive-name: keydef
  16.  
  17.  
  18.     During the last year, I've submitted this to comp.source.unix
  19.   three times but it's never been posted - don't know why.  Maybe
  20.   it belongs here.  It is running at several sites and I've not
  21.   received any bug reports. 
  22.  
  23. #! /bin/sh
  24. # PROGRAM NAME: keydef -quickly easily redefine VT[23]xx function keys.
  25. # LANGUAGE: 'C'
  26. # DEVELOPED ON: VAX11/750 running Ultrix (~4.3BSD).
  27. # PORTABILITY: I'm no expert, but I have tried to be careful. Lint complains
  28. #            of the ussual "return value always ignored" and for some
  29. #            reason, complains that exit() and perror() are used inconsitantly.
  30. #            SYS V users will need to edit one line in keydef.h to change
  31. #            the #include <strings.h> to #include <string.h> .
  32. # SPECIAL REQUIREMENTS: none
  33. # SHAR FILE SIZE: -rw-------  1 gordon      23424 Jun  6 10:49 keydef.shar
  34. # AUTHOR: Gordon Vickers {pyramid|mips|phillabs}!prls!gordon
  35. #
  36. # Please send me email if it works for your computer/OS/compiler else please
  37. # send patches.
  38. #
  39. # This is a shell archive, meaning:
  40. # 1. Remove everything above the #! /bin/sh line.
  41. # 2. Save the resulting text in a file.
  42. # 3. Execute the file with /bin/sh (not csh) to create the files:
  43. #    README
  44. #    keydef.L
  45. #    sample
  46. #    Notes
  47. #    keydef.c
  48. #    keydef.h
  49. #    Makefile
  50. #    132col
  51. #    80col
  52. # This archive created: Tue Jun  6 10:48:01 1989
  53. export PATH; PATH=/bin:$PATH
  54. echo shar: extracting "'README'" '(1393 characters)'
  55. if test -f 'README'
  56. then
  57.         echo shar: will not over-write existing file "'README'"
  58. else
  59. sed 's/^        X//' << \SHAR_EOF > 'README'
  60.         XSCCS ID "@(#)README    1.4    4/11/89"
  61.         X
  62.         X   The keydef program allows you to easily reprogram your VT[23]xx
  63.         X function keys.  It allows you to maintain simple description files
  64.         X for quickly setting your function keys for particular applications.
  65.         X
  66.         X   In addition to the keydef program, some other VT[23]xx related
  67.         X stuff (totally independent of keydef) is included.
  68.         X
  69.         Xvt220.tcap  - vt2xx termcap entries and VT320 termcap. The keydef program
  70.         X              DOES NOT rely upon these.  They are included only because I
  71.         X              send this entire package to those requesting VT[23]xx 
  72.         X              termcap entries.
  73.         X
  74.         Xkeydef      - reprogram vt2xx function keys easily (does NOT depend on
  75.         X               vt220.tcap). Simple code. Read documentation for features.
  76.         X
  77.         Xkeydef.L    - manual page. Read with: nroff -man
  78.         X
  79.         X132col, 80col - vt2xx specific shell scripts. These are not executed but
  80.         X             'sourced'. example: % source /usr/local/132col will switch
  81.         X              terminal to 132 columns. As it is, relies on vt220.tcap
  82.         X              but could be easily changed. If you are lazy like I am,
  83.         X              and think the command line requires to much typing, just
  84.         X              program it into one of your function keys !
  85.         X
  86.         X---------------------------------------------------------------------
  87.         XComments, suggestions, and patches may be emailed to:
  88.         XGordon Vickers {pyramid|mips|phillabs}!prls!gordon
  89. SHAR_EOF
  90. if test 1393 -ne "`wc -c < 'README'`"
  91. then
  92.         echo shar: error transmitting "'README'" '(should have been 1393 characters)'
  93. fi
  94. fi # end of overwriting check
  95. echo shar: extracting "'keydef.L'" '(3543 characters)'
  96. if test -f 'keydef.L'
  97. then
  98.         echo shar: will not over-write existing file "'keydef.L'"
  99. else
  100. sed 's/^        X//' << \SHAR_EOF > 'keydef.L'
  101.         X.TH KEYDEF local
  102.         X.ds SI S\s-2IX\s+2\s-2ELS\s+2
  103.         X.SH NAME
  104.         Xkeydef - quickly / easily redefine VT2xx and VT3xx function keys.
  105.         X.SH SYNTEX
  106.         Xkeydef [n filename]
  107.         X.SH DESCRIPTION
  108.         X.I Keydef 
  109.         Xreads a file
  110.         Xin the user's home directory that contains definitions for the function keys.
  111.         XIf no file is specified then the file read is .keydef else the file read
  112.         Xis the concatenation of .keydef and the filename specified.
  113.         XIf unable to open a file,
  114.         Xcertain site specific default setting will be made.
  115.         X.PP
  116.         XThe definition file(s) consist of one definition per line.
  117.         XEach line must start with a one or two digit function key number
  118.         Xfollowed by the ascii string to be programed.
  119.         XIf the string to be programmed begins with a digit,
  120.         Xthen the function key number may require a leading zero to make it two
  121.         Xdigits long.
  122.         X.PP
  123.         XDefinition records may also contain the the two letter symbols \\r,\\t,\\n
  124.         X\\\, and \\^ .
  125.         XThese will be mapped to; RETURN (013H), TAB (009H), NEWLINE
  126.         X(010H), back-slash, and circumflex (AKA "carrot") respectfully.
  127.         X.PP
  128.         XDifinitions may also contain the "tame" representation of control charectors.
  129.         XA two letter sequence begining with a circumflex is assumed to indicate
  130.         Xthat a control charector is to be programmed.
  131.         XIn this case the value of 64 is subtracted from the next charector and
  132.         Xif the result is positive then it is substituted into the output string
  133.         Xin place of the two original charectors.
  134.         XTo program a literal circumflex, preceed it with a backslash.
  135.         X.PP
  136.         XIf the first non-white charector of a record is not a digit then it is
  137.         Xassumed to be a comment and is ignored.
  138.         XThe only exception is if this charector is an exclamation mark.
  139.         XAny line beginning with an exclimation mark is assumed to be a shell escape.
  140.         XThe remainder of the line is passed to a shell.
  141.         X.PP
  142.         X.I keydef
  143.         Xmay also be given a numeric option on the command line.
  144.         XIf the numeric corresponds to a reprogrammable function key number
  145.         Xthe user will be asked to supply a new definition for that key.
  146.         XThe program will then set just that one key and derminate.
  147.         X.SH CHANGES
  148.         X.PP
  149.         X.I keydef
  150.         Xno longer writes to the 
  151.         X.I keydefID
  152.         Xfile of the user's home directory.
  153.         X.PP 
  154.         XDescription files from previous versions are compatible with this version
  155.         Xbut the user is cautioned that this version now maps certain key
  156.         Xcombinations (\\r, \\t, and control charectors) that were not supported
  157.         Xbefore.
  158.         X.PP
  159.         XTo use the programmed function keys simply depress the SHIFT key with
  160.         Xthe desired funtion key.
  161.         X.SH RESTRICTIONS
  162.         X.I Keydef
  163.         Xonly programs function keys 06-14, HELP, DO, and 17-20.
  164.         XThe author has made various attempts at programming other keys
  165.         Xbut without success.
  166.         X.PP
  167.         XLabeling your keyboard becomes more difficult.
  168.         X.PP
  169.         XThere is a finite amount of memory in the terminal for storing the
  170.         Xdefinitions .
  171.         X.PP
  172.         XThe user may experiance dissapointing results in programming keys that
  173.         Xhave long definitions or with keys that follow these.
  174.         XI don't know the source of this problem, prehaps XON/XOFF are interfering.
  175.         XThe work-around is to find a strategic place(s) between definitions
  176.         Xfor a shell escape to "sleep 1".
  177.         X./" reproduce with: nroff -man
  178.         X./" SCCSID @(#)keydef.L    1.4    4/11/89
  179.         X.SH "EXAMPLE FILE"
  180.         X.br
  181.         X06cat ~/.keyids
  182.         X.br
  183.         X7source /usr/local/80col\n
  184.         X.br
  185.         X!echo shell escape worked.
  186.         X.br
  187.         X08 source /usr/local/132col\n
  188.         X.br
  189.         X09 keydef vi
  190.         X.br
  191.         X10 main(argc,argv)\n int    argc;\n char **argv;\n {\n
  192.         X.br
  193.         Xexample of a comment.
  194.         X.br
  195.         X11^[
  196.         X.br
  197.         X15 apropos
  198.         X.SH "SEE ALSO"
  199.         XVT220 or VT320 Programmer Pocket Guide.
  200.         X.SH Author
  201.         XGordon Vickers {pyramid|mips|phillabs}!prls!gordon
  202.         X.br
  203.         Xcomments, suggestions, and patches welcomed.
  204. SHAR_EOF
  205. if test 3543 -ne "`wc -c < 'keydef.L'`"
  206. then
  207.         echo shar: error transmitting "'keydef.L'" '(should have been 3543 characters)'
  208. fi
  209. fi # end of overwriting check
  210. echo shar: extracting "'sample'" '(877 characters)'
  211. if test -f 'sample'
  212. then
  213.         echo shar: will not over-write existing file "'sample'"
  214. else
  215. sed 's/^        X//' << \SHAR_EOF > 'sample'
  216.         XMost any line not starting with a digit is a comment, see manual for exceptions
  217.         X06keydef .vi
  218.         X07source /usr/local/80col\n
  219.         X08source /usr/local/132col\n
  220.         X
  221.         XI use my function key 10 for temporary, repetitive things; complicated
  222.         Xcommands, sequences, etc. Real nice if application allows shell escapes.
  223.         XMost often used with complicated vi commands. 
  224.         X09keydef 10\n
  225.         X
  226.         XFunction key 11 may default to 'esc' but you can override it here
  227.         X11^[
  228.         X12#include <
  229.         X13#define\t
  230.         X14\nmain(argc,argv)\n   int    argc;\n   char **argv;\n{\n
  231.         X
  232.         X15apropos 
  233.         X16mount /dev/ra3a /src;su sccs;cd
  234.         X
  235.         XA word I often need but can never spell
  236.         X17Albuquerque
  237.         X
  238.         XAn example of a shell escape, normally used to sleep for one second (see man)
  239.         X!echo "shell escape"
  240.         X
  241.         XSome vi commands
  242.         X18 ^[:/\n:s\n
  243.         X19 ^[:w\n
  244.         X20^[:!soundslike 
  245.         X
  246.         XNow the hard part is remembering which key is what, especially if you
  247.         Xmaintain several .keydef* files.
  248. SHAR_EOF
  249. if test 877 -ne "`wc -c < 'sample'`"
  250. then
  251.         echo shar: error transmitting "'sample'" '(should have been 877 characters)'
  252. fi
  253. fi # end of overwriting check
  254. echo shar: extracting "'Notes'" '(1991 characters)'
  255. if test -f 'Notes'
  256. then
  257.         echo shar: will not over-write existing file "'Notes'"
  258. else
  259. sed 's/^        X//' << \SHAR_EOF > 'Notes'
  260.         XSCCSID @(#)Notes    1.4    4/11/89
  261.         X/******************** Function Key Programming Notes ********************
  262.         X
  263.         X The following notes were gleaned from a Fortran program after having
  264.         X wasted many hours trying to understand the information in the VT220
  265.         X Programmer Pocket Guide ( EK-VT220-HR-001 ) published by Digital
  266.         X Equipment Corp. It would be impracticl to include that Fortran program
  267.         X here so, I apologetically refer the reader to Pg 29 of the guide.
  268.         X
  269.         X  Sending a single string to the terminal may program one or more of the
  270.         X user defined keys (UDK).  The string format in DEC-gibberish is;
  271.         X    DCS Pc;Pl |   Ky1/st1;ky2/st2;...kyn/stn ST
  272.         X    where;
  273.         X          DCS (Device Control String) is ^[P  (ESC-P)
  274.         X          Pc  -if no value or Pc=0, clears all UDKs prior to loading new defs.
  275.         X               if Pc = 1, load new defs, clear any remaining old ones.
  276.         X          Pl  -if no value or Pl = 1, lock keys from being redefined.
  277.         X               if Pl = 1, do not lock keys.
  278.         X          Ky1 -function key address. Formed by adding function key number
  279.         X               to an appropriate offset. See table below.
  280.         X          st1 -the ASCII representation of the HEX digits that represent
  281.         X               the ASCII character to be programmed. Made sense to someone.
  282.         X          ST  -string terminator. ^[\  (ESC-\)
  283.         X
  284.         X   Function key addresses
  285.         X      key number    offset    address (Ky1)
  286.         X         6        11    17
  287.         X         7        11    18
  288.         X         8        11    19
  289.         X         9        11    20
  290.         X        10        11    21
  291.         X        11        12    23
  292.         X        12        12    24
  293.         X        13        12    25
  294.         X        14        12    26
  295.         X   HELP 15        13    28
  296.         X    DO  16        13    29
  297.         X        17        14    31
  298.         X        18        14    32
  299.         X        19        14    33
  300.         X        20        14    34
  301.         X
  302.         X  An example string that will program the HELP (F15) key to spit out "apropos" ;
  303.         X  ^[P1;1|28/6170726f706f730^[\
  304.         X   | | | |  \-------------/ |
  305.         X   | | | |         |        - ST  (ESC-\)
  306.         X   | | | |         - encoded text
  307.         X   | | | -- key address
  308.         X   | | - Pl
  309.         X   | - Pc
  310.         X   - DCS (ESC-P)
  311.         X
  312.         X   One simply prints the string (which will not be displayed) to the screen.
  313.         X*/
  314. SHAR_EOF
  315. if test 1991 -ne "`wc -c < 'Notes'`"
  316. then
  317.         echo shar: error transmitting "'Notes'" '(should have been 1991 characters)'
  318. fi
  319. fi # end of overwriting check
  320. echo shar: extracting "'keydef.c'" '(5812 characters)'
  321. if test -f 'keydef.c'
  322. then
  323.         echo shar: will not over-write existing file "'keydef.c'"
  324. else
  325. sed 's/^        X//' << \SHAR_EOF > 'keydef.c'
  326.         X/*
  327.         X * keydef() - easily / quickly redefine vt200, vt300 function keys
  328.         X*/
  329.         Xstatic char Keydef[] = "@(#)keydef.c    1.5    4/11/89";  /* posted to USENET */
  330.         X#include <stdio.h>
  331.         X#include <pwd.h>
  332.         X   struct passwd *pw;
  333.         X#include "keydef.h"
  334.         X
  335.         X/* string to program key      string to print to user  */
  336.         X/*                    v          v                     */
  337.         Xchar *Default[] = { "23/1B", "F11 is ESC",
  338.         X                    "28/6170726f706f730a","HELP key is apropos",
  339.         X                     NULL, NULL }; /* must be last in array */
  340.         X/* Use the Default array for specifing local defaults that should be set */
  341.         X
  342.         Xvoid Getuser();
  343.         Xint debug = 0;
  344.         Xchar *ProgKey();
  345.         X
  346.         Xmain(argc, argv)
  347.         X  int    argc;
  348.         X  char **argv;
  349.         X{
  350.         X  int keynum;
  351.         X  char fname[BUFSIZ], lfname[BUFSIZ], record[BUFSIZ];
  352.         X  char *prog;
  353.         X  char *p, **defaults = Default;
  354.         X
  355.         X if( 2 == 1 ) {
  356.         X   /* The contents of this if() statement may not be changed   */
  357.         X   printf(" (C) Copyright 1989 by Gordon P. Vickers, Sunnyvale, Ca.\n");
  358.         X   printf("   { mips | pyramid | phillabs }!prls!gordon \n");
  359.         X   printf("Distribution requiring payment in excess of reproduction\n");
  360.         X   printf("cost requires authors written consent.\n");
  361.         X   printf("Free distribution is encouraged if this notice remains intact\n");
  362.         X/*     This program is offerred AS-IS, without warrenty of any kind.
  363.         X           U S E   A T   Y O U R   O W N   R I S K
  364.         X       I have nothing to gain from sharing this so I should have nothing
  365.         X       to risk. 
  366.         X*/  
  367.         X }
  368.         X
  369.         X  strcat(fname,PROGNAME);
  370.         X  argv++;     /* get past program name */
  371.         X  while( *argv != NULL) {
  372.         X     if (!IsDigit(*argv)) {
  373.         X       if(!strcmp(*argv,"-d"))
  374.         X         debug = 1;
  375.         X       else
  376.         X         strcat(fname, *argv);
  377.         X     }
  378.         X     else {
  379.         X          Getuser(*argv);
  380.         X          exit(0);
  381.         X     }
  382.         X   argv++;
  383.         X  }
  384.         X
  385.         X  /* find user's home directory so we can find the correct keydef file */
  386.         X  if( (pw = getpwuid(getuid())) == NULL) {
  387.         X      fprintf(stderr,"Can't figure out where your home directory is.\n");
  388.         X      exit(0);
  389.         X  }
  390.         X  sprintf(lfname,"%s/.%s",pw->pw_dir,fname); /* complete filename */
  391.         X
  392.         X  printf("Setting defaults:\n");
  393.         X  while(*defaults != NULL) {  /* Must use two prints so pointer inc's OK */
  394.         X  if(debug)
  395.         X    printf("^[%s%s^[%c",PREFIX, *defaults++,BSLASH);
  396.         X  else
  397.         X    printf("%c%s%s%c%c",ESC,PREFIX, *defaults++,ESC,BSLASH);
  398.         X  printf("\t%s\n", *defaults++);
  399.         X  }
  400.         X
  401.         X  if( (freopen(lfname,"r",stdin)) == NULL) {
  402.         X     perror(lfname);
  403.         X     exit(0);
  404.         X  }
  405.         X 
  406.         X  printf("Settings from %s%s\n",RCFILE,*argv);
  407.         X
  408.         X/* OK TO HERE */
  409.         X  while ( (fgets(record,BUFSIZ,stdin)) != NULL ) {
  410.         X    p = record;
  411.         X    *(p + strlen(record) -1) = NULL; /* delete the newline,added in printf */
  412.         X    if(*p == 'F' || *p == 'f')
  413.         X      p++;              /* for compatibility with previous keydef versions */
  414.         X    if(*p == '!') {     /* test for shell escape */
  415.         X      p++;
  416.         X      system(p);        /* the expensive way but isn't used often */
  417.         X      continue;
  418.         X    }
  419.         X    if(!(keynum = GetKey(p)) )
  420.         X        continue;
  421.         X    prog = ProgKey(p,keynum);
  422.         X    if(prog != NULL)
  423.         X      printf("%s%s\n",prog,p); /* moved newline to here, personal preferance */
  424.         X  }
  425.         X} /* end of main */
  426.         X
  427.         Xvoid Getuser(s)
  428.         X  char *s;
  429.         X{
  430.         X   int key;
  431.         X   char *ip, record[BUFSIZ], input[BUFSIZ];
  432.         X
  433.         X   strcpy(record,s);
  434.         X   while(!(key = GetKey(record)) ) { 
  435.         X     if(record[0] == 'e' || record[0] == 'q')
  436.         X        exit(0);
  437.         X     printf("\n    Sorry, that's not a valid function key number\n",key);
  438.         X     printf("Valid responses are:\n");
  439.         X     printf("    6     7     8     9     10\n");
  440.         X     printf("   11 (esc)     12 (bs)     13 (lf)\n");
  441.         X     printf("   14    15 (help)   16 (do)\n");
  442.         X     printf("   17    18    19    20\n");
  443.         X     printf("OR type any of: exit     e    quit     q\n");
  444.         X     printf("\nEnter function key number : ");
  445.         X     fgets(record,BUFSIZ,stdin);
  446.         X   }
  447.         X   printf("New definition : ");
  448.         X   fgets(input,BUFSIZ,stdin);
  449.         X   ip = input;
  450.         X   while(*ip++ != NULL)
  451.         X     if(*ip == '\n')    /* strip newline from user input string */
  452.         X       *ip = NULL;
  453.         X   strcat(record,input);
  454.         X   printf("%s\n",ProgKey(record,key));
  455.         X   exit(0);
  456.         X}
  457.         X
  458.         X/* IsDigit(s) - get function key number from string */
  459.         XIsDigit(s)
  460.         X  char *s;
  461.         X{
  462.         X  int digit = 0;
  463.         X  if(*s <= '9' && *s >= '0') 
  464.         X    sscanf(s,"%2d%*s",&digit);
  465.         X return(digit);
  466.         X}
  467.         X
  468.         X/* GetKey() */
  469.         XGetKey(s)
  470.         X char *s;
  471.         X{
  472.         X  int key;
  473.         X
  474.         X  key = IsDigit(s);
  475.         X  switch (key) {
  476.         X         case 6: case 7: case 8: case 9: case 10:
  477.         X                 key += 11; break;
  478.         X         case 11: case 12: case 13: case 14:
  479.         X                 key += 12; break;
  480.         X         case 15: case 16:
  481.         X                 key += 13; break;
  482.         X         case 17: case 18: case 19: case 20:
  483.         X                 key += 14; break;
  484.         X         default:
  485.         X                 key = 0;
  486.         X  }
  487.         X  return(key);
  488.         X} 
  489.         X
  490.         X/*** ProgKey() ****/
  491.         Xchar *
  492.         XProgKey(s,k)
  493.         X  char *s;
  494.         X  int k;
  495.         X{
  496.         X  char t[BUFSIZ], buf[4];
  497.         X
  498.         X  if(debug)
  499.         X    sprintf(t,"^[%s%d/",PREFIX,k); /* make preamble */
  500.         X  else
  501.         X    sprintf(t,"%c%s%d/",ESC,PREFIX,k); /* make preamble */
  502.         X
  503.         X  if(*s >= '0' && *s <= '9') /* move past the key number */
  504.         X     s++;
  505.         X  if(*s >= '0' && *s <= '9') /* ...which may be two digits */
  506.         X     s++;
  507.         X  while( *s != NULL) {
  508.         X     if(*s == '^'){ /* map a control charector */
  509.         X        s++;
  510.         X        sprintf(buf,"%02x", (int)(( *s - '@') > 0 ? *s - '@' : *s));
  511.         X     }
  512.         X     else if(*s == BSLASH){
  513.         X        switch( *(s + 1) ) {
  514.         X           case 'n' : sprintf(buf,"%02x",(int)'\n'); s++; break;
  515.         X           case 'r' : sprintf(buf,"%02x",(int)'\r'); s++; break;
  516.         X           case 't' : sprintf(buf,"%02x",(int)'\t'); s++; break;
  517.         X           case BSLASH:sprintf(buf,"%02x",(int)'\\'); s++; break;
  518.         X           case '^' :  sprintf(buf,"%02x",(int)'^'); s++; break;
  519.         X           default: sprintf(buf,"%02x",(int)*s);
  520.         X        }
  521.         X     }
  522.         X     else {
  523.         X        sprintf(buf,"%02x",(int)*s);
  524.         X     }
  525.         X     strcat(t,buf);
  526.         X     s++;
  527.         X  } 
  528.         X  if(debug)
  529.         X    sprintf(buf,"^[\\");
  530.         X  else
  531.         X    sprintf(buf,"%c%c",ESC,BSLASH);
  532.         X
  533.         X strcat(t,buf);
  534.         X return(t);
  535.         X}
  536. SHAR_EOF
  537. if test 5812 -ne "`wc -c < 'keydef.c'`"
  538. then
  539.         echo shar: error transmitting "'keydef.c'" '(should have been 5812 characters)'
  540. fi
  541. fi # end of overwriting check
  542. echo shar: extracting "'keydef.h'" '(671 characters)'
  543. if test -f 'keydef.h'
  544. then
  545.         echo shar: will not over-write existing file "'keydef.h'"
  546. else
  547. sed 's/^        X//' << \SHAR_EOF > 'keydef.h'
  548.         X/* SCCSID @(#)keydef.h    1.5    4/11/89 */
  549.         X#include <strings.h>    /* CHANGE to strings.h for BSD, string.h for SYS V */
  550.         X
  551.         X#define ESC '\033'     /* escape code */
  552.         X#define BSLASH '\134'  /* back slash  */
  553.         X#define NL     '\n'    /* newline     */
  554.         X#define RET    '\r'    /* return      */
  555.         X#define TAB    '\t'    /* tab         */
  556.         X#define PREFIX "P1;1|" /* DEC refers to this as "Pc;Pl |"
  557.         X                          see pg 29, VT220 Programmer Pocket Guide */
  558.         X#define PROGNAME "keydef" /* argv[0][0] may be a full path name    */
  559.         X#define RCFILE ".keydef"  /* every program has one these days, maybe */
  560.         X                          /* what we need is a "dot" directory for them all */
  561. SHAR_EOF
  562. if test 671 -ne "`wc -c < 'keydef.h'`"
  563. then
  564.         echo shar: error transmitting "'keydef.h'" '(should have been 671 characters)'
  565. fi
  566. fi # end of overwriting check
  567. echo shar: extracting "'Makefile'" '(329 characters)'
  568. if test -f 'Makefile'
  569. then
  570.         echo shar: will not over-write existing file "'Makefile'"
  571. else
  572. sed 's/^        X//' << \SHAR_EOF > 'Makefile'
  573.         X# sccs id:    @(#)Makefile    1.2    4/11/89
  574.         X# 
  575.         XPROG    = keydef
  576.         XCFLAGS  = -O -s
  577.         XHEADERS = $(PROG).h
  578.         XSCR     = $(PROG).c
  579.         XFILES   = README $(PROG).L sample Notes $(PROG).c $(PROG).h \
  580.         X          Makefile 132col 80col
  581.         X
  582.         Xall:    $(PROG)
  583.         X
  584.         X$(PROG):    $(HEADERS) $(SCR)
  585.         X    cc $(CFLAGS) $(SCR) -o $(PROG)
  586.         X
  587.         Xshar:    $(FILES)
  588.         X    shar -a $(FILES) > $(PROG).shar
  589. SHAR_EOF
  590. if test 329 -ne "`wc -c < 'Makefile'`"
  591. then
  592.         echo shar: error transmitting "'Makefile'" '(should have been 329 characters)'
  593. fi
  594. fi # end of overwriting check
  595. echo shar: extracting "'132col'" '(94 characters)'
  596. if test -f '132col'
  597. then
  598.         echo shar: will not over-write existing file "'132col'"
  599. else
  600. sed 's/^        X//' << \SHAR_EOF > '132col'
  601.         X# SCCS ID "@(#)132col    1.4    4/11/89"
  602.         Xstty dec
  603.         Xset noglob; eval `tset -s -Q vt220w`
  604.         Xunset noglob
  605. SHAR_EOF
  606. if test 94 -ne "`wc -c < '132col'`"
  607. then
  608.         echo shar: error transmitting "'132col'" '(should have been 94 characters)'
  609. fi
  610. fi # end of overwriting check
  611. echo shar: extracting "'80col'" '(93 characters)'
  612. if test -f '80col'
  613. then
  614.         echo shar: will not over-write existing file "'80col'"
  615. else
  616. sed 's/^        X//' << \SHAR_EOF > '80col'
  617.         X# SCCS ID "@(#)80col    1.4    4/11/89"
  618.         Xstty dec
  619.         Xset noglob; eval `tset -s -Q vt220n`
  620.         Xunset noglob
  621. SHAR_EOF
  622. if test 93 -ne "`wc -c < '80col'`"
  623. then
  624.         echo shar: error transmitting "'80col'" '(should have been 93 characters)'
  625. fi
  626. fi # end of overwriting check
  627. #    End of shell archive
  628. exit 0
  629.  
  630.  
  631.