home *** CD-ROM | disk | FTP | other *** search
/ PC World 2000 February / PCWorld_2000-02_cd.bin / live / usr / bin / mk_modmap < prev    next >
Text File  |  1999-01-06  |  16KB  |  378 lines

  1. #!/bin/sh
  2. # mk_modmap
  3. # Tries to translate a keytable file into a file parseable by xmodmap
  4. #
  5. # This is a hack, and has a lot of magic numbers and names hardcoded
  6. # into it. Suggestions on how to avoid this are welcome.
  7. #
  8. # Kjetil T. Homme, University of Oslo 1993
  9. # <kjetilho@ifi.uio.no>
  10. #
  11. # Added support for BackSpace, dead keys, Cyrillic, Greek and Hebrew keysysms
  12. # Pablo Saratxaga <srtxg@chanae.stben.be> - May 1997
  13. #
  14. # Added support for keys found in Microsoft keyboards, Compose keysym
  15. # (translates to Multi_key in X11) and for numeric hexadecimal values.
  16. # Pablo Saratxaga <srtxg@f2219.n293.z2.fidonet.org> - Jun 1997
  17.  
  18. case $1 in
  19.     -v*)    verbose=1; shift ;;
  20. esac
  21.  
  22. if test ! -f /usr/include/X11/X.h; then
  23.     echo Make sure you have a link to you X include files called
  24.     echo /usr/include/X11 first.
  25.     exit 1
  26. fi
  27.  
  28. cat <<__EOH__
  29. ! Converted keytable file to xmodmap file
  30. ! with `basename $0` by `whoami`@`hostname` `date`
  31. clear Mod1
  32. clear Mod2
  33. __EOH__
  34.  
  35. awk -F'#' '
  36.     /[a-z]+.*keycode/ { next }
  37.     /^[ \t]*$/ { next }
  38.     /^string/ { next }
  39.     { sub("^[ \t]*", "") }
  40.     NF > 1 {
  41.         printf("!");
  42.         for (i = 2; i <= NF; i++) {
  43.             printf(" " $i);
  44.             $i = "";
  45.         }
  46.         print "";
  47.         if ($1 == "")
  48.             next;
  49.     }
  50.     { print }
  51. ' "$@" | awk -v verbose=$verbose '
  52.     BEGIN {
  53.         while (getline < "/usr/include/X11/keysymdef.h" == 1) {
  54.             if ($0 ~ /XK_/) {
  55.                 sub(/.*XK_/, "");
  56.                 sub(/[\t ].*/, "");
  57.                 valid[$0] = 1;
  58.             }
  59.         }
  60.         valid["X386Sys_Req"] = 1;
  61.         valid["BackSpace"] = 1;
  62.  
  63.         shifts["Control"] = shifts["Shift"] = 1;
  64.  
  65.         shift_keys[29]  = "Control_L";
  66.         shift_keys[97]  = "Control_R";
  67.         shift_keys[42]  = "Shift_L";
  68.         shift_keys[54]  = "Shift_R";
  69.  
  70.         trans_keys[ 96] = 108; # KP_Enter
  71.         trans_keys[ 97] = 109; # Control_R
  72.         trans_keys[ 98] = 112; # KP_Divide
  73.         trans_keys[100] = 113; # Mode_switch (AltGr)
  74.         trans_keys[101] = 114; # Break
  75.         trans_keys[103] =  98; # Up
  76.         trans_keys[104] =  99; # Prior
  77.         trans_keys[105] = 100; # Left
  78.         trans_keys[106] = 102; # Right
  79.         trans_keys[108] = 104; # Down
  80.         trans_keys[109] = 105; # Next
  81.         trans_keys[110] = 106; # Insert
  82.         trans_keys[111] = 107; # Delete
  83.         trans_keys[125] = 115; # left windows key (MS keyboards)
  84.         trans_keys[126] = 116; # right windows key (MS keyboards)
  85.         trans_keys[127] = 117; # menu key (MS keyboards)
  86.  
  87.         trans_names["Alt"]    = "Alt_L Meta_L";
  88.         trans_names["AltGr"]    = "Mode_switch";
  89.         trans_names["one"]    = "1";
  90.         trans_names["two"]    = "2";
  91.         trans_names["three"]    = "3";
  92.         trans_names["four"]    = "4";
  93.         trans_names["five"]    = "5";
  94.         trans_names["six"]    = "6";
  95.         trans_names["seven"]    = "7";
  96.         trans_names["eight"]    = "8";
  97.         trans_names["nine"]    = "9";
  98.         trans_names["zero"]    = "0";
  99.         trans_names["KP_Comma"]    = "KP_Decimal";
  100.         trans_names["dead_tilde"]    = "dead_tilde";
  101.         trans_names["dead_circumflex"]    = "dead_circumflex";
  102.         trans_names["dead_acute"]    = "dead_acute";
  103.         trans_names["dead_grave"]    = "dead_grave";
  104.         trans_names["dead_diaeresis"]    = "dead_diaeresis";
  105.         trans_names["dead_cedilla"]    = "dead_cedilla";
  106.         trans_names["dead_ogonek"]    = "dead_ogonek";
  107.         trans_names["dead_caron"]    = "dead_caron";
  108.         trans_names["dead_breve"]    = "dead_breve";
  109.         trans_names["dead_doubleacute"]    = "dead_doubleacute";
  110.         trans_names["Compose"]        = "Multi_key";
  111. #        trans_names["Last_Console"]    = "X386Sys_Req";
  112. # Greek
  113.         trans_names["Alphaaccent"]    = "Greek_ALPHAaccent";
  114.         trans_names["Epsilonaccent"]    = "Greek_EPSILONaccent";
  115.         trans_names["Etaaccent"]    = "Greek_ETAaccent";
  116.         trans_names["Iotaaccent"]    = "Greek_IOTAaccent";
  117.         trans_names["Iotadiaeresis"]    = "Greek_IOTAdiaeresis";
  118.         trans_names["Omicronaccent"]    = "Greek_OMICRONaccent";
  119.         trans_names["Upsilonaccent"]    = "Greek_UPSILONaccent";
  120.         trans_names["Upsilondieresis"]    = "Greek_UPSILONdieresis";
  121.         trans_names["Omegaaccent"]    = "Greek_OMEGAaccent";
  122.         trans_names["Alpha"]    = "Greek_ALPHA";
  123.         trans_names["Beta"]    = "Greek_BETA";
  124.         trans_names["Gamma"]    = "Greek_GAMMA";
  125.         trans_names["Delta"]    = "Greek_DELTA";
  126.         trans_names["Epsilon"]    = "Greek_EPSILON";
  127.         trans_names["Zeta"]    = "Greek_ZETA";
  128.         trans_names["Eta"]    = "Greek_ETA";
  129.         trans_names["Theta"]    = "Greek_THETA";
  130.         trans_names["Iota"]    = "Greek_IOTA";
  131.         trans_names["Kappa"]    = "Greek_KAPPA";
  132.         trans_names["Lamda"]    = "Greek_LAMDA";
  133.         trans_names["Lambda"]    = "Greek_LAMBDA";
  134.         trans_names["Mu"]    = "Greek_MU";
  135.         trans_names["Nu"]    = "Greek_NU";
  136.         trans_names["Xi"]    = "Greek_XI";
  137.         trans_names["Ksi"]    = "Greek_XI";
  138.         trans_names["Omicron"]    = "Greek_OMICRON";
  139.         trans_names["Pi"]    = "Greek_PI";
  140.         trans_names["Rho"]    = "Greek_RHO";
  141.         trans_names["Sigma"]    = "Greek_SIGMA";
  142.         trans_names["Tau"]    = "Greek_TAU";
  143.         trans_names["Upsilon"]    = "Greek_UPSILON";
  144.         trans_names["Phi"]    = "Greek_PHI";
  145.         trans_names["Chi"]    = "Greek_CHI";
  146.         trans_names["Khi"]    = "Greek_CHI";
  147.         trans_names["Psi"]    = "Greek_PSI";
  148.         trans_names["Omega"]    = "Greek_OMEGA";
  149.         trans_names["accent"]    = "Greek_accentdieresis";
  150.         trans_names["horizbar"]    = "Greek_horizbar";
  151.         trans_names["alphaaccent"]    = "Greek_alphaaccent";
  152.         trans_names["epsilonaccent"]    = "Greek_epsilonaccent";
  153.         trans_names["etaaccent"]    = "Greek_etaaccent";
  154.         trans_names["iotaaccent"]    = "Greek_iotaaccent";
  155.         trans_names["iotadieresis"]    = "Greek_iotadieresis";
  156.         trans_names["iotaaccentdieresis"]    = "Greek_iotaaccentdieresis";
  157.         trans_names["omicronaccent"]    = "Greek_omicronaccent";
  158.         trans_names["upsilonaccent"]    = "Greek_upsilonaccent";
  159.         trans_names["upsilondieresis"]    = "Greek_upsilondieresis";
  160.         trans_names["upsilonaccentdieresis"]    = "Greek_upsilonaccentdieresis";
  161.         trans_names["omegaaccent"]    = "Greek_omegaaccent";
  162.         trans_names["alpha"]    = "Greek_alpha";
  163.         trans_names["beta"]    = "Greek_beta";
  164.         trans_names["gamma"]    = "Greek_gamma";
  165.         trans_names["delta"]    = "Greek_delta";
  166.         trans_names["epsilon"]    = "Greek_epsilon";
  167.         trans_names["zeta"]    = "Greek_zeta";
  168.         trans_names["eta"]    = "Greek_eta";
  169.         trans_names["theta"]    = "Greek_theta";
  170.         trans_names["iota"]    = "Greek_iota";
  171.         trans_names["kappa"]    = "Greek_kappa";
  172.         trans_names["lamda"]    = "Greek_lamda";
  173.         trans_names["lambda"]    = "Greek_lambda";
  174.         trans_names["mu"]    = "Greek_mu";
  175.         trans_names["nu"]    = "Greek_nu";
  176.         trans_names["xi"]    = "Greek_xi";
  177.         trans_names["ksi"]    = "Greek_xi";
  178.         trans_names["omicron"]    = "Greek_omicron";
  179.         trans_names["pi"]    = "Greek_pi";
  180.         trans_names["rho"]    = "Greek_rho";
  181.         trans_names["sigma"]    = "Greek_sigma";
  182.         trans_names["terminalsigma"]    = "Greek_finalsmallsigma";
  183.         trans_names["tau"]    = "Greek_tau";
  184.         trans_names["upsilon"]    = "Greek_upsilon";
  185.         trans_names["phi"]    = "Greek_phi";
  186.         trans_names["chi"]    = "Greek_chi";
  187.         trans_names["khi"]    = "Greek_chi";
  188.         trans_names["psi"]    = "Greek_psi";
  189.         trans_names["omega"]    = "Greek_omega";
  190.         trans_names["switch"]    = "Greek_switch";
  191. # Cyrillic
  192.         trans_names["cyrillic_capital_letter_io"]    = "Cyrillic_IO";
  193.         trans_names["cyrillic_capital_letter_je"]    = "Cyrillic_JE";
  194.         trans_names["cyrillic_capital_letter_lje"]    = "Cyrillic_LJE";
  195.         trans_names["cyrillic_capital_letter_nje"]    = "Cyrillic_NJE";
  196.         trans_names["cyrillic_capital_letter_dzhe"]    = "Cyrillic_DZHE";
  197.         trans_names["cyrillic_capital_letter_yu"]    = "Cyrillic_YU";
  198.         trans_names["cyrillic_capital_letter_iu"]    = "Cyrillic_YU";
  199.         trans_names["cyrillic_capital_letter_a"]    = "Cyrillic_A";
  200.         trans_names["cyrillic_capital_letter_be"]    = "Cyrillic_BE";
  201.         trans_names["cyrillic_capital_letter_tse"]    = "Cyrillic_TSE";
  202.         trans_names["cyrillic_capital_letter_de"]    = "Cyrillic_DE";
  203.         trans_names["cyrillic_capital_letter_ie"]    = "Cyrillic_IE";
  204.         trans_names["cyrillic_capital_letter_ef"]    = "Cyrillic_EF";
  205.         trans_names["cyrillic_capital_letter_ghe"]    = "Cyrillic_GHE";
  206.         trans_names["cyrillic_capital_letter_ge"]    = "Cyrillic_GHE";
  207.         trans_names["cyrillic_capital_letter_ha"]    = "Cyrillic_HA";
  208.         trans_names["cyrillic_capital_letter_kha"]    = "Cyrillic_HA";
  209.         trans_names["cyrillic_capital_letter_i"]    = "Cyrillic_I";
  210.         trans_names["cyrillic_capital_letter_ii"]    = "Cyrillic_I";
  211.         trans_names["cyrillic_capital_letter_short_i"]    = "Cyrillic_SHORTI";
  212.         trans_names["cyrillic_capital_letter_short_ii"]    = "Cyrillic_SHORTI";
  213.         trans_names["cyrillic_capital_letter_ka"]    = "Cyrillic_KA";
  214.         trans_names["cyrillic_capital_letter_el"]    = "Cyrillic_EL";
  215.         trans_names["cyrillic_capital_letter_em"]    = "Cyrillic_EM";
  216.         trans_names["cyrillic_capital_letter_en"]    = "Cyrillic_EN";
  217.         trans_names["cyrillic_capital_letter_o"]    = "Cyrillic_O";
  218.         trans_names["cyrillic_capital_letter_pe"]    = "Cyrillic_PE";
  219.         trans_names["cyrillic_capital_letter_ya"]    = "Cyrillic_YA";
  220.         trans_names["cyrillic_capital_letter_ia"]    = "Cyrillic_YA";
  221.         trans_names["cyrillic_capital_letter_er"]    = "Cyrillic_ER";
  222.         trans_names["cyrillic_capital_letter_es"]    = "Cyrillic_ES";
  223.         trans_names["cyrillic_capital_letter_te"]    = "Cyrillic_TE";
  224.         trans_names["cyrillic_capital_letter_u"]    = "Cyrillic_U";
  225.         trans_names["cyrillic_capital_letter_zhe"]    = "Cyrillic_ZHE";
  226.         trans_names["cyrillic_capital_letter_ve"]    = "Cyrillic_VE";
  227.         trans_names["cyrillic_capital_soft_sign"]    = "Cyrillic_SOFTSIGN";
  228.         trans_names["cyrillic_capital_letter_yeru"]    = "Cyrillic_YERU";
  229.         trans_names["cyrillic_capital_letter_yeri"]    = "Cyrillic_YERU";
  230.         trans_names["cyrillic_capital_letter_ze"]    = "Cyrillic_ZE";
  231.         trans_names["cyrillic_capital_letter_sha"]    = "Cyrillic_SHA";
  232.         trans_names["cyrillic_capital_letter_e"]    = "Cyrillic_E";
  233.         trans_names["cyrillic_capital_letter_reversed_e"]    = "Cyrillic_E";
  234.         trans_names["cyrillic_capital_letter_shcha"]    = "Cyrillic_SHCHA";
  235.         trans_names["cyrillic_capital_letter_che"]    = "Cyrillic_CHE";
  236.         trans_names["cyrillic_capital_hard_sign"]    = "Cyrillic_HARDSIGN";
  237.         trans_names["cyrillic_small_letter_io"]    = "Cyrillic_io";
  238.         trans_names["cyrillic_small_letter_je"]    = "Cyrillic_je";
  239.         trans_names["cyrillic_small_letter_lje"]    = "Cyrillic_lje";
  240.         trans_names["cyrillic_small_letter_nje"]    = "Cyrillic_nje";
  241.         trans_names["cyrillic_small_letter_dzhe"]    = "Cyrillic_dzhe";
  242.         trans_names["cyrillic_small_letter_yu"]    = "Cyrillic_yu";
  243.         trans_names["cyrillic_small_letter_iu"]    = "Cyrillic_yu";
  244.         trans_names["cyrillic_small_letter_a"]    = "Cyrillic_a";
  245.         trans_names["cyrillic_small_letter_be"]    = "Cyrillic_be";
  246.         trans_names["cyrillic_small_letter_tse"]    = "Cyrillic_tse";
  247.         trans_names["cyrillic_small_letter_de"]    = "Cyrillic_de";
  248.         trans_names["cyrillic_small_letter_ie"]    = "Cyrillic_ie";
  249.         trans_names["cyrillic_small_letter_ef"]    = "Cyrillic_ef";
  250.         trans_names["cyrillic_small_letter_ghe"]    = "Cyrillic_ghe";
  251.         trans_names["cyrillic_small_letter_ge"]    = "Cyrillic_ghe";
  252.         trans_names["cyrillic_small_letter_ha"]    = "Cyrillic_ha";
  253.         trans_names["cyrillic_small_letter_kha"]    = "Cyrillic_ha";
  254.         trans_names["cyrillic_small_letter_i"]    = "Cyrillic_i";
  255.         trans_names["cyrillic_small_letter_ii"]    = "Cyrillic_i";
  256.         trans_names["cyrillic_small_letter_short_i"]    = "Cyrillic_shorti";
  257.         trans_names["cyrillic_small_letter_short_ii"]    = "Cyrillic_shorti";
  258.         trans_names["cyrillic_small_letter_ka"]    = "Cyrillic_ka";
  259.         trans_names["cyrillic_small_letter_el"]    = "Cyrillic_el";
  260.         trans_names["cyrillic_small_letter_em"]    = "Cyrillic_em";
  261.         trans_names["cyrillic_small_letter_en"]    = "Cyrillic_en";
  262.         trans_names["cyrillic_small_letter_o"]    = "Cyrillic_o";
  263.         trans_names["cyrillic_small_letter_pe"]    = "Cyrillic_pe";
  264.         trans_names["cyrillic_small_letter_ya"]    = "Cyrillic_ya";
  265.         trans_names["cyrillic_small_letter_ia"]    = "Cyrillic_ya";
  266.         trans_names["cyrillic_small_letter_er"]    = "Cyrillic_er";
  267.         trans_names["cyrillic_small_letter_es"]    = "Cyrillic_es";
  268.         trans_names["cyrillic_small_letter_te"]    = "Cyrillic_te";
  269.         trans_names["cyrillic_small_letter_u"]    = "Cyrillic_u";
  270.         trans_names["cyrillic_small_letter_zhe"]    = "Cyrillic_zhe";
  271.         trans_names["cyrillic_small_letter_ve"]    = "Cyrillic_ve";
  272.         trans_names["cyrillic_small_soft_sign"]    = "Cyrillic_softsign";
  273.         trans_names["cyrillic_small_letter_yeru"]    = "Cyrillic_yeru";
  274.         trans_names["cyrillic_small_letter_yeri"]    = "Cyrillic_yeru";
  275.         trans_names["cyrillic_small_letter_ze"]    = "Cyrillic_ze";
  276.         trans_names["cyrillic_small_letter_sha"]    = "Cyrillic_sha";
  277.         trans_names["cyrillic_small_letter_e"]    = "Cyrillic_e";
  278.         trans_names["cyrillic_small_letter_reversed_e"]    = "Cyrillic_e";
  279.         trans_names["cyrillic_small_letter_shcha"]    = "Cyrillic_shcha";
  280.         trans_names["cyrillic_small_letter_che"]    = "Cyrillic_che";
  281.         trans_names["cyrillic_small_hard_sign"]    = "Cyrillic_hardsign";
  282.         trans_names["serbocroatian_cyrillic_capital_letter_dje"]    = "Serbian_DJE";
  283.         trans_names["serbocroatian_cyrillic_capital_letter_je"]    = "Serbian_JE";
  284.         trans_names["serbocroatian_cyrillic_capital_letter_lje"]    = "Serbian_LJE";
  285.         trans_names["serbocroatian_cyrillic_capital_letter_nje"]    = "Serbian_NJE";
  286.         trans_names["serbocroatian_cyrillic_capital_letter_tshe"]    = "Serbian_TSHE";
  287.         trans_names["serbocroatian_cyrillic_capital_letter_dze"]    = "Serbian_DZE";
  288.         trans_names["serbocroatian_cyrillic_small_letter_dje"]    = "Serbian_dje";
  289.         trans_names["serbocroatian_cyrillic_small_letter_je"]    = "Serbian_je";
  290.         trans_names["serbocroatian_cyrillic_small_letter_lje"]    = "Serbian_lje";
  291.         trans_names["serbocroatian_cyrillic_small_letter_nje"]    = "Serbian_nje";
  292.         trans_names["serbocroatian_cyrillic_small_letter_tshe"]    = "Serbian_tshe";
  293.         trans_names["serbocroatian_cyrillic_small_letter_dze"]    = "Serbian_dze";
  294.         trans_names["macedonian_cyrillic_capital_letter_gje"]    = "Macedonia_GJE";
  295.         trans_names["macedonian_cyrillic_capital_letter_dze"]    = "Macedonia_DSE";
  296.         trans_names["macedonian_cyrillic_capital_letter_kje"]    = "Macedonia_KJE";
  297.         trans_names["macedonian_cyrillic_small_letter_gje"]    = "Macedonia_gje";
  298.         trans_names["macedonian_cyrillic_small_letter_dze"]    = "Macedonia_dse";
  299.         trans_names["macedonian_cyrillic_small_letter_kje"]    = "Macedonia_kje";
  300.         trans_names["ukrainian_cyrillic_capital_letter_ie"]    = "Ukrainian_JE";
  301.         trans_names["ukrainian_cyrillic_capital_letter_i"]    = "Ukrainian_I";
  302.         trans_names["ukrainian_cyrillic_capital_letter_yi"]    = "Ukrainian_YI";
  303.         trans_names["ukrainian_cyrillic_small_letter_ie"]    = "Ukrainian_ie";
  304.         trans_names["ukrainian_cyrillic_small_letter_i"]    = "Ukrainian_i";
  305.         trans_names["ukrainian_cyrillic_small_letter_yi"]    = "Ukrainian_yi";
  306.         trans_names["bielorussian_cyrillic_capital_letter_short_u"]    = "Byelorussian_SHORTU";
  307.         trans_names["bielorussian_cyrillic_capital_letter_i"]    = "Ukrainian_I";
  308.         trans_names["bielorussian_cyrillic_small_letter_short_u"]    = "Byelorussian_shortu";
  309.         trans_names["bielorussian_cyrillic_small_letter_i"]    = "Ukrainian_i";
  310. # Hebrew
  311.         trans_names["doubleunderscore"]    = "hebrew_doublelowline";
  312.         trans_names["alef"]    = "hebrew_aleph";
  313.         trans_names["bet"]    = "hebrew_bet";
  314.         trans_names["gimel"]    = "hebrew_gimel";
  315.         trans_names["dalet"]    = "hebrew_dalet";
  316.         trans_names["he"]    = "hebrew_he";
  317.         trans_names["vav"]    = "hebrew_waw";
  318.         trans_names["zayin"]    = "hebrew_zain";
  319.         trans_names["het"]    = "hebrew_chet";
  320.         trans_names["tet"]    = "hebrew_tet";
  321.         trans_names["yod"]    = "hebrew_yod";
  322.         trans_names["finalkaf"]    = "hebrew_finalkaph";
  323.         trans_names["kaf"]    = "hebrew_kaph";
  324.         trans_names["lamed"]    = "hebrew_lamed";
  325.         trans_names["finalmem"]    = "hebrew_finalmem";
  326.         trans_names["mem"]    = "hebrew_mem";
  327.         trans_names["finalnun"]    = "hebrew_finalnun";
  328.         trans_names["nun"]    = "hebrew_nun";
  329.         trans_names["samekh"]    = "hebrew_samech";
  330.         trans_names["ayin"]    = "hebrew_ayin";
  331.         trans_names["finalpe"]    = "hebrew_finalpe";
  332.         trans_names["pe"]    = "hebrew_pe";
  333.         trans_names["finaltsadi"]    = "hebrew_finalzade";
  334.         trans_names["tsadi"]    = "hebrew_zade";
  335.         trans_names["qof"]    = "hebrew_qoph";
  336.         trans_names["resh"]    = "hebrew_resh";
  337.         trans_names["shin"]    = "hebrew_shin";
  338.         trans_names["tav"]    = "hebrew_taw";
  339.     }
  340.     $1 == "keycode" {
  341.         output = "";
  342.         keycode = $2;
  343.         i = ($3 == "=") ? 4 : 3;
  344.         for ( ; i <= NF; i++) {
  345.             sub(/^\+/, "", $i);
  346.             n = $i;
  347.             if ($i in shifts)
  348.                 n = shift_keys[keycode];
  349.             else if ($i in trans_names)
  350.                 n = trans_names[$i];
  351.  
  352.             if (n in valid || n in valid || $i in trans_names)
  353.                 output = output " " n;
  354.             else if (n ~ /0x[0-9a-fA-F]*/)
  355.                 output = output " " n;
  356.             else
  357.                 msg("Skipped " $i);
  358.         }
  359.  
  360.         if (keycode in trans_keys)
  361.             keycode = trans_keys[keycode];
  362.         else
  363.             keycode += 8;
  364.  
  365.         if (keycode > 117)
  366.             msg("Skipped keycode " keycode-8 ": " output);
  367.          else if (output)
  368.             printf("keycode %3d =%s\n", keycode, output);
  369.         next;
  370.     }
  371.     { print }
  372.     function msg(m) { if (verbose) print m > "/dev/stderr"; }'
  373.  
  374. cat <<__EOH__
  375. add Mod1 = Alt_L
  376. add Mod2 = Mode_switch
  377. __EOH__
  378.