home *** CD-ROM | disk | FTP | other *** search
/ PC Shareware 1999 March / PCShareware-3-99.iso / IMPLE / DJGPP.RAR / DJGPP2 / XLIB-SR0.ZIP / SRC / XLIBEMU / MAKEMODM.C < prev    next >
C/C++ Source or Header  |  1994-01-30  |  801b  |  37 lines

  1. /* $Id: makemodm.c 1.4 1994/01/30 18:46:18 ulrich Exp $ */
  2.  
  3. #include <stdio.h>
  4.  
  5. /* Read an Xmodmap.* and write out C data file */
  6.  
  7. main()
  8. {
  9.   char buffer[200];
  10.   int keycode;
  11.   char k[4][50];
  12.   int row;
  13.   int cols;
  14.   int i;
  15.  
  16.   row = 8;
  17.   while (gets (buffer)) {
  18.     if ((cols = sscanf (buffer, "keycode %d%*[ \t]=%s%s%s%s", &keycode, 
  19.             k[0], k[1], k[2], k[3]) - 1) < 0)
  20.       continue;
  21.     if (row != keycode)
  22.       fprintf (stderr, "row=%d keycode=%d\n", row, keycode);
  23.     for (i = 0; i < cols; i++) {
  24.       /* if keysym starts with 0x don not prepend XK_ */
  25.       if (strncmp ("0x", k[i], 2))
  26.     fputs ("XK_", stdout);
  27.       fputs (k[i], stdout);
  28.       fputs (",\t", stdout);
  29.     }
  30.     for (     ; i < 4; i++) {
  31.       fputs ("NoSymbol,\t", stdout);
  32.     }
  33.     fputs ("\n", stdout);
  34.     row++;
  35.   }
  36. }
  37.