File: mkkeytables

package info (click to toggle)
dosemu 1.2.2-8
  • links: PTS
  • area: contrib
  • in suites: etch, etch-m68k
  • size: 10,456 kB
  • ctags: 22,464
  • sloc: ansic: 140,878; sh: 5,010; asm: 3,654; perl: 1,427; makefile: 988; tcl: 602; awk: 404; yacc: 300; lex: 157
file content (43 lines) | stat: -rwxr-xr-x 778 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#! /usr/bin/perl

$fprefix = "./etc/keymap/";
$infile = $fprefix . "all.tmp";

`./bin/dos -I 'keytable dump "$infile"'`;

open(FIN, "<$infile") || die "Can't open $file";

$file ="$fprefix${filecount}.txt";
$open = 0;

while (<FIN>) {
  $line = $_;
  $linecount++;
  if ( $line =~ /^keytable (\S+)/) {
    $ktable = $1;
    $file = "$fprefix$ktable";
    # new packet, first close the old one
    if ($open) {
      close(FOUT);
      $open = 0;
    }
    if ($ktable ne "keyb-user") {
      open(FOUT, ">$file");
      $open = 1;
      print FOUT "\#keytable ${ktable}\n";
      print FOUT "keytable keyb-user {\n";
    }
  }
  else {
    if ($open) {
      if ( $line =~ /^}/ ) {$open = 0;}
      print FOUT $line;
    }
  }
}

if ($open) {
  close(FOUT);
}
`rm -f $infile`;