Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Thursday, November 15, 2012

No SimCity 3000 Unlimited, Either

As a follow-on to my previous post, I also tried to run SimCity 3000 Unlimited:

wine: Unhandled page fault on read access to 0xffffffff at address 0x409868 (thread 0009), starting debugger...
Unhandled exception: page fault on read access to 0xffffffff in 32-bit code (0x00409868).
Register dump:
 CS:0023 SS:002b DS:002b ES:0000 FS:0063 GS:006b
 EIP:00409868 ESP:0032fccc EBP:0032fdb4 EFLAGS:00010216(  R- --  I   -A-P- )
 EAX:0032fcd4 EBX:00000001 ECX:00000067 EDX:00400000
 ESI:00000000 EDI:00400000
Stack dump:
0x0032fccc:  0032fdb4 0040e5bd 00000000 00400000
0x0032fcdc:  00000067 00416860 0013aa94 7b8b4ff4
0x0032fcec:  00000002 0032fd10 7bcbbff4 0032fd78
0x0032fcfc:  00400000 f7547bd6 f7547c6d 00000094
0x0032fd0c:  00000005 00000001 00000a28 00000002
0x0032fd1c:  76726553 20656369 6b636150 00003320
000c: sel=0067 base=00000000 limit=00000000 16-bit --x
Backtrace:
=>0 0x00409868 in sc3u (+0x9868) (0x0032fdb4)
  1 0x004169b2 in sc3u (+0x169b1) (0x0032fe40)
  2 0x7b85f76c call_process_entry+0xb() in kernel32 (0x0032fe58)
  3 0x7b860b0b in kernel32 (+0x50b0a) (0x0032fe98)
  4 0x7bc77f40 call_thread_func_wrapper+0xb() in ntdll (0x0032feb8)
  5 0x7bc7adff call_thread_func+0x9e() in ntdll (0x0032ff98)
  6 0x7bc77f1e RtlRaiseException+0x21() in ntdll (0x0032ffc8)
  7 0x7bc4dd71 call_dll_entry_point+0x540() in ntdll (0x0032ffe8)
  8 0xf75e24bd wine_call_on_stack+0x1c() in libwine.so.1 (0x00000000)
  9 0xf75e259e wine_switch_to_stack+0x2d() in libwine.so.1 (0xffcc1ea8)
  10 0x7bc539c8 LdrInitializeThunk+0x3c7() in ntdll (0xffcc1f18)
  11 0x7b867310 __wine_kernel_init+0xbcf() in kernel32 (0xffcc3038)
  12 0x7bc5409b __wine_process_init+0x18a() in ntdll (0xffcc30c8)
  13 0xf75dfffe wine_init+0x2ad() in libwine.so.1 (0xffcc3138)
  14 0x7bf00dbb main+0x8a() in  (0xffcc3588)
  15 0xf7431605 __libc_start_main+0xf4() in libc.so.6 (0x00000000)
0x00409868: scasb %es:(%edi)
Modules:
Module Address   Debug info Name (48 modules)
PE   400000-  456000 Export          sc3u
PE 10000000-1000c000 Deferred        drvmgt
ELF 7b800000-7ba44000 Dwarf           kernel32
  \-PE 7b810000-7ba44000 \               kernel32
ELF 7bc00000-7bcd8000 Dwarf           ntdll
  \-PE 7bc10000-7bcd8000 \               ntdll
ELF 7bf00000-7bf04000 Dwarf           
ELF 7e52b000-7e5af000 Deferred        rpcrt4
  \-PE 7e540000-7e5af000 \               rpcrt4
ELF 7e5af000-7e5b5000 Deferred        libxfixes.so.3
ELF 7e5b5000-7e5c0000 Deferred        libxcursor.so.1
ELF 7e72d000-7e756000 Deferred        libexpat.so.1
ELF 7e756000-7e78b000 Deferred        libfontconfig.so.1
ELF 7e78b000-7e79b000 Deferred        libxi.so.6
ELF 7e79b000-7e7a6000 Deferred        libxrandr.so.2
ELF 7e7a6000-7e7b0000 Deferred        libxrender.so.1
ELF 7e7b0000-7e7d5000 Deferred        imm32
  \-PE 7e7c0000-7e7d5000 \               imm32
ELF 7e7d5000-7e7f7000 Deferred        libxcb.so.1
ELF 7e7f7000-7e7fd000 Deferred        libuuid.so.1
ELF 7e7fd000-7e817000 Deferred        libice.so.6
ELF 7e817000-7e94e000 Deferred        libx11.so.6
ELF 7e94e000-7e960000 Deferred        libxext.so.6
ELF 7e960000-7e9f3000 Deferred        winex11
  \-PE 7e970000-7e9f3000 \               winex11
ELF 7e9f3000-7ea03000 Deferred        libbz2.so.1.0
ELF 7ea03000-7ea1a000 Deferred        libz.so.1
ELF 7ea1a000-7eab6000 Deferred        libfreetype.so.6
ELF 7eae3000-7eb53000 Deferred        advapi32
  \-PE 7eaf0000-7eb53000 \               advapi32
ELF 7eb53000-7ec29000 Deferred        gdi32
  \-PE 7eb60000-7ec29000 \               gdi32
ELF 7ec29000-7ed87000 Deferred        user32
  \-PE 7ec40000-7ed87000 \               user32
ELF 7ef87000-7ef94000 Deferred        libnss_files.so.2
ELF 7ef94000-7efd3000 Deferred        libm.so.6
ELF 7efd6000-7efdd000 Deferred        libxdmcp.so.6
ELF 7efdd000-7efe6000 Deferred        libsm.so.6
ELF 7efe6000-7f000000 Deferred        version
  \-PE 7eff0000-7f000000 \               version
ELF f73e6000-f73eb000 Deferred        libdl.so.2
ELF f7410000-f7414000 Deferred        libxinerama.so.1
ELF f7414000-f7418000 Deferred        libxau.so.6
ELF f7418000-f75be000 Dwarf           libc.so.6
ELF f75be000-f75d9000 Deferred        libpthread.so.0
ELF f75d9000-f771c000 Dwarf           libwine.so.1
ELF f771d000-f773f000 Deferred        ld-linux.so.2
ELF f773f000-f7740000 Deferred        [vdso].so
Threads:
process  tid      prio (all id:s are in hex)
00000008 (D) C:\Program Files (x86)\Maxis\SimCity 3000 Unlimited\Apps\sc3U.exe
 00000009    0 <==
0000000e services.exe
 00000026    0
 0000001e    0
 00000018    0
 00000017    0
 00000015    0
 00000010    0
 0000000f    0
00000012 winedevice.exe
 0000001c    0
 00000019    0
 00000014    0
 00000013    0
0000001a plugplay.exe
 00000020    0
 0000001d    0
 0000001b    0
00000021 explorer.exe
 00000022    0

No SimCity 2000 for Me

I tried to run SimCity 2000 Special Edition, under Wine, but no dice:

wine: Unhandled page fault on write access to 0x00000000 at address 0x7ddadb9f (thread 0024), starting debugger...
Unhandled exception: page fault on write access to 0x00000000 in 32-bit code (0x7ddadb9f).
Register dump:
 CS:0023 SS:002b DS:002b ES:002b FS:0063 GS:006b
 EIP:7ddadb9f ESP:00c1e284 EBP:00c1e708 EFLAGS:00010246(  R- --  I  Z- -P- )
 EAX:00000000 EBX:7ddb3ff4 ECX:00008000 EDX:00161dc0
 ESI:00161f00 EDI:0000000a
Stack dump:
0x00c1e284:  00000000 00000000 00000000 00000000
0x00c1e294:  00000000 00000000 00000000 00000000
0x00c1e2a4:  00000000 00000000 00000000 00000000
0x00c1e2b4:  00000001 00161f0c 00000000 ffffffff
0x00c1e2c4:  00000000 00000000 00000000 00000000
0x00c1e2d4:  00000000 00000000 00000000 00000000
000c: sel=0067 base=00000000 limit=00000000 16-bit --x
Backtrace:
=>0 0x7ddadb9f in wing32 (+0xdb9f) (0x00c1e708)
  1 0x7ddaf39b in wing32 (+0xf39a) (0x00c1e7a8)
  2 0x7ece9346 SendDriverMessage+0x85() in winmm (0x00c1e818)
  3 0x7ecee1d4 in winmm (+0xe1d3) (0x00c1e868)
  4 0x7ecf075e in winmm (+0x1075d) (0x00c1e8c8)
  5 0x7ecf0ba4 mciSendCommandW+0x53() in winmm (0x00c1e928)
  6 0x7ecf1187 mciSendCommandA+0x2a6() in winmm (0x00c1e998)
  7 0x7ddacde8 in wing32 (+0xcde7) (0x00c1e9e8)
  8 0x7bc77f40 call_thread_func_wrapper+0xb() in ntdll (0x00c1ea08)
  9 0x7bc7adff call_thread_func+0x9e() in ntdll (0x00c1eae8)
  10 0x7bc77f1e RtlRaiseException+0x21() in ntdll (0x00c1eb18)
  11 0x7bc812f5 in ntdll (+0x712f4) (0x00c1f368)
  12 0xf75a7d08 start_thread+0xd7() in libpthread.so.0 (0x00c1f468)
  13 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  14 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  15 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  16 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  17 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  18 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  19 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  20 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  21 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  22 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  23 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  24 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  25 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  26 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  27 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  28 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  29 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  30 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  31 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  32 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  33 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  34 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  35 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  36 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  37 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  38 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  39 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  40 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  41 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  42 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  43 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  44 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  45 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  46 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  47 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  48 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  49 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  50 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  51 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  52 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  53 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  54 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  55 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  56 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  57 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  58 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  59 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  60 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  61 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  62 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  63 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  64 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  65 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  66 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  67 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  68 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  69 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  70 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  71 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  72 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  73 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  74 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  75 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  76 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  77 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  78 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  79 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  80 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  81 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  82 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  83 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  84 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  85 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  86 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  87 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  88 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  89 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  90 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  91 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  92 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  93 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  94 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  95 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  96 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  97 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  98 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  99 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  100 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  101 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  102 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  103 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  104 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  105 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  106 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  107 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  108 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  109 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  110 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  111 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  112 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  113 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  114 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  115 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  116 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  117 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  118 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  119 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  120 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  121 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  122 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  123 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  124 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  125 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  126 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  127 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  128 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  129 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  130 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  131 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  132 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  133 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  134 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  135 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  136 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  137 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  138 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  139 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  140 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  141 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  142 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  143 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  144 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  145 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  146 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  147 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  148 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  149 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  150 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  151 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  152 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  153 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  154 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  155 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  156 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  157 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  158 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  159 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  160 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  161 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  162 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  163 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  164 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  165 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  166 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  167 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  168 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  169 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  170 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  171 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  172 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  173 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  174 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  175 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  176 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  177 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  178 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  179 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  180 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  181 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  182 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  183 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  184 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  185 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  186 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  187 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  188 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  189 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  190 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  191 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  192 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  193 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  194 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  195 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  196 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  197 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  198 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  199 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
  200 0xf74e5a4e __clone+0x5d() in libc.so.6 (0x00000000)
0x7ddadb9f: addb %al,0x0(%eax)
Modules:
Module Address   Debug info Name (82 modules)
PE   330000-  343000 Deferred        smackw32
PE   400000-  563000 Deferred        simcity
ELF 7b800000-7ba44000 Deferred        kernel32
  \-PE 7b810000-7ba44000 \               kernel32
ELF 7bc00000-7bcd8000 Dwarf           ntdll
  \-PE 7bc10000-7bcd8000 \               ntdll
ELF 7bf00000-7bf04000 Deferred        
ELF 7d981000-7d9cc000 Deferred        dsound
  \-PE 7d990000-7d9cc000 \               dsound
ELF 7d9cc000-7dac2000 Deferred        libasound.so.2
ELF 7dac2000-7dc00000 Deferred        oleaut32
  \-PE 7dae0000-7dc00000 \               oleaut32
ELF 7dd17000-7dd2d000 Deferred        midimap
  \-PE 7dd20000-7dd2d000 \               midimap
ELF 7dd2d000-7dd46000 Deferred        msacm32
  \-PE 7dd30000-7dd46000 \               msacm32
ELF 7dd46000-7dd76000 Deferred        winealsa
  \-PE 7dd50000-7dd76000 \               winealsa
ELF 7dd76000-7dd9b000 Deferred        mmdevapi
  \-PE 7dd80000-7dd9b000 \               mmdevapi
ELF 7dda0000-7ddb5000 Dwarf           wing32
  \-PE 7ddb0000-7ddb5000 \               wing32
ELF 7de14000-7de4b000 Deferred        uxtheme
  \-PE 7de20000-7de4b000 \               uxtheme
ELF 7de4b000-7de51000 Deferred        libxfixes.so.3
ELF 7de51000-7de5c000 Deferred        libxcursor.so.1
ELF 7dfb1000-7dfda000 Deferred        libexpat.so.1
ELF 7dfda000-7e00f000 Deferred        libfontconfig.so.1
ELF 7e00f000-7e01f000 Deferred        libxi.so.6
ELF 7e01f000-7e02a000 Deferred        libxrandr.so.2
ELF 7e02a000-7e034000 Deferred        libxrender.so.1
ELF 7e034000-7e038000 Deferred        libxinerama.so.1
ELF 7e038000-7e05d000 Deferred        imm32
  \-PE 7e040000-7e05d000 \               imm32
ELF 7e05d000-7e064000 Deferred        libxdmcp.so.6
ELF 7e064000-7e086000 Deferred        libxcb.so.1
ELF 7e086000-7e08c000 Deferred        libuuid.so.1
ELF 7e08c000-7e0a6000 Deferred        libice.so.6
ELF 7e0a6000-7e1dd000 Deferred        libx11.so.6
ELF 7e1dd000-7e270000 Deferred        winex11
  \-PE 7e1f0000-7e270000 \               winex11
ELF 7e270000-7e280000 Deferred        libbz2.so.1.0
ELF 7e280000-7e297000 Deferred        libz.so.1
ELF 7e297000-7e333000 Deferred        libfreetype.so.6
ELF 7e338000-7e341000 Deferred        librt.so.1
ELF 7e360000-7e3a0000 Deferred        winspool
  \-PE 7e370000-7e3a0000 \               winspool
ELF 7e3a0000-7e4ab000 Deferred        comctl32
  \-PE 7e3b0000-7e4ab000 \               comctl32
ELF 7e4ab000-7e524000 Deferred        shlwapi
  \-PE 7e4c0000-7e524000 \               shlwapi
ELF 7e524000-7e757000 Deferred        shell32
  \-PE 7e530000-7e757000 \               shell32
ELF 7e757000-7e83f000 Deferred        comdlg32
  \-PE 7e760000-7e83f000 \               comdlg32
ELF 7e83f000-7e86a000 Deferred        msacm32
  \-PE 7e840000-7e86a000 \               msacm32
ELF 7e86a000-7e8ee000 Deferred        rpcrt4
  \-PE 7e880000-7e8ee000 \               rpcrt4
ELF 7e8ee000-7ea2f000 Deferred        ole32
  \-PE 7e910000-7ea2f000 \               ole32
ELF 7ea2f000-7ea9f000 Deferred        advapi32
  \-PE 7ea40000-7ea9f000 \               advapi32
ELF 7ea9f000-7eb75000 Deferred        gdi32
  \-PE 7eab0000-7eb75000 \               gdi32
ELF 7eb75000-7ecd3000 Deferred        user32
  \-PE 7eb90000-7ecd3000 \               user32
ELF 7ecd3000-7ed87000 Dwarf           winmm
  \-PE 7ece0000-7ed87000 \               winmm
ELF 7ef87000-7ef94000 Deferred        libnss_files.so.2
ELF 7ef94000-7efd3000 Deferred        libm.so.6
ELF 7efd4000-7efe6000 Deferred        libxext.so.6
ELF 7efe6000-7f000000 Deferred        version
  \-PE 7eff0000-7f000000 \               version
ELF f73c3000-f73c7000 Deferred        libxau.so.6
ELF f73c9000-f73ce000 Deferred        libdl.so.2
ELF f73f2000-f73fb000 Deferred        libsm.so.6
ELF f73fb000-f75a1000 Dwarf           libc.so.6
ELF f75a1000-f75bc000 Dwarf           libpthread.so.0
ELF f75bc000-f76ff000 Dwarf           libwine.so.1
ELF f7700000-f7722000 Deferred        ld-linux.so.2
ELF f7722000-f7723000 Deferred        [vdso].so
Threads:
process  tid      prio (all id:s are in hex)
00000008 (D) C:\Program Files\Maxis\SimCity 2000\SIMCITY.EXE
 00000026    0
 00000025    0
 00000024   15 <==
 00000023   15
 00000009    0
0000000e services.exe
 0000001f    0
 0000001e    0
 00000018    0
 00000017    0
 00000015    0
 00000010    0
 0000000f    0
00000012 winedevice.exe
 0000001c    0
 00000019    0
 00000014    0
 00000013    0
0000001a plugplay.exe
 00000020    0
 0000001d    0
 0000001b    0
00000021 explorer.exe
 00000022    0

Thursday, March 8, 2012

g_strdup and g_free Corruption

I just looked further into it, and realized my actual mistake below. Whoops!

I found an interesting little nit when messing around while researching glib's behavior:

#include <glib.h> #include <string.h> int main(int argc, char ** argv) { gchar * foo; foo = g_strdup("100"); g_free(foo); g_printf("FOO: %p\n", foo); gchar * bar = g_strdup(foo); g_printf("BAR: %p = '%s'\n", bar, bar); g_free(bar); if(foo == bar) g_printf("FOO == BAR\n"); g_free(foo); return 0; }% ./gnfree2 FOO: 0x16ad010 BAR: 0x16ad010 = '' FOO == BAR *** glibc detected *** ./gnfree2: double free or corruption (fasttop): 0x00000000016ad010 *** ======= Backtrace: ========= /lib/libc.so.6(+0x78e66)[0x7fa8a16f9e66] ./gnfree2[0x40073e] /lib/libc.so.6(__libc_start_main+0xed)[0x7fa8a16a238d] ./gnfree2[0x4005e9] ======= Memory map: ======== 00400000-00401000 r-xp 00000000 08:04 418428329 /home/nehodges/Programs/gnfree2 00600000-00601000 rw-p 00000000 08:04 418428329 /home/nehodges/Programs/gnfree2 016ad000-016ce000 rw-p 00000000 00:00 0 [heap] 7fa8a0ded000-7fa8a0e02000 r-xp 00000000 08:03 131410 /usr/lib/libgcc_s.so.1 7fa8a0e02000-7fa8a1002000 ---p 00015000 08:03 131410 /usr/lib/libgcc_s.so.1 7fa8a1002000-7fa8a1003000 rw-p 00015000 08:03 131410 /usr/lib/libgcc_s.so.1 7fa8a1003000-7fa8a101a000 r-xp 00000000 08:03 2359314 /lib/libpthread-2.15.so 7fa8a101a000-7fa8a1219000 ---p 00017000 08:03 2359314 /lib/libpthread-2.15.so 7fa8a1219000-7fa8a121a000 r--p 00016000 08:03 2359314 /lib/libpthread-2.15.so 7fa8a121a000-7fa8a121b000 rw-p 00017000 08:03 2359314 /lib/libpthread-2.15.so 7fa8a121b000-7fa8a121f000 rw-p 00000000 00:00 0 7fa8a121f000-7fa8a1226000 r-xp 00000000 08:03 2359337 /lib/librt-2.15.so 7fa8a1226000-7fa8a1425000 ---p 00007000 08:03 2359337 /lib/librt-2.15.so 7fa8a1425000-7fa8a1426000 r--p 00006000 08:03 2359337 /lib/librt-2.15.so 7fa8a1426000-7fa8a1427000 rw-p 00007000 08:03 2359337 /lib/librt-2.15.so 7fa8a1427000-7fa8a1480000 r-xp 00000000 08:03 135459 /usr/lib/libpcre.so.1.0.0 7fa8a1480000-7fa8a167f000 ---p 00059000 08:03 135459 /usr/lib/libpcre.so.1.0.0 7fa8a167f000-7fa8a1680000 r--p 00058000 08:03 135459 /usr/lib/libpcre.so.1.0.0 7fa8a1680000-7fa8a1681000 rw-p 00059000 08:03 135459 /usr/lib/libpcre.so.1.0.0 7fa8a1681000-7fa8a1818000 r-xp 00000000 08:03 2359610 /lib/libc-2.15.so 7fa8a1818000-7fa8a1a18000 ---p 00197000 08:03 2359610 /lib/libc-2.15.so 7fa8a1a18000-7fa8a1a1c000 r--p 00197000 08:03 2359610 /lib/libc-2.15.so 7fa8a1a1c000-7fa8a1a1e000 rw-p 0019b000 08:03 2359610 /lib/libc-2.15.so 7fa8a1a1e000-7fa8a1a22000 rw-p 00000000 00:00 0 7fa8a1a22000-7fa8a1b15000 r-xp 00000000 08:03 135544 /usr/lib/libglib-2.0.so.0.3000.2 7fa8a1b15000-7fa8a1d14000 ---p 000f3000 08:03 135544 /usr/lib/libglib-2.0.so.0.3000.2 7fa8a1d14000-7fa8a1d15000 r--p 000f2000 08:03 135544 /usr/lib/libglib-2.0.so.0.3000.2 7fa8a1d15000-7fa8a1d16000 rw-p 000f3000 08:03 135544 /usr/lib/libglib-2.0.so.0.3000.2 7fa8a1d16000-7fa8a1d17000 rw-p 00000000 00:00 0 7fa8a1d17000-7fa8a1d38000 r-xp 00000000 08:03 2360114 /lib/ld-2.15.so 7fa8a1f02000-7fa8a1f06000 rw-p 00000000 00:00 0 7fa8a1f34000-7fa8a1f37000 rw-p 00000000 00:00 0 7fa8a1f37000-7fa8a1f38000 r--p 00020000 08:03 2360114 /lib/ld-2.15.so 7fa8a1f38000-7fa8a1f39000 rw-p 00021000 08:03 2360114 /lib/ld-2.15.so 7fa8a1f39000-7fa8a1f3a000 rw-p 00000000 00:00 0 7fff47234000-7fff47255000 rw-p 00000000 00:00 0 [stack] 7fff4738e000-7fff4738f000 r-xp 00000000 00:00 0 [vdso] ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall] zsh: abort ./gnfree2

Granted, one shouldn't be writing code that runs into this case, but it's kind of funny.

Thursday, June 10, 2010

ALSA, dmix, and X-Fi

I was having all sort of issues getting my SoundBlaster X-Fi working properly using the snd-ctxfi module. First off, I got something about "invalid sw-parameters," and once I had fixed that by going through dmix I lost the ability to have multiple streams playing at once.

Eventually I found a middle ground that had everything working, with the bonus of pretty sweet upmixing, all by putting this in my asound.conf:

pcm.!default {
type plug
slave {
pcm "duplex"
channels 6
}
ttable {
0.0 1
1.1 1
0.2 1
1.3 1
0.4 0.5
1.4 0.5
0.5 0.5
1.5 0.5
}
}

pcm.snd_card {
type hw
card 0 # SoundBlaster X-Fi
}
pcm.s51 {
type plug
slave {
pcm "surround51"
rate 48000
channels 6
}
}



pcm.duplex {
type asym
playback.pcm "s51"
capture.pcm "snd_card"
}

It looks like pushing everything through surround51 (though not directly) works perfectly.

Sunday, January 31, 2010

Grok

A friend of mine wrote a Python script to replace Ack (which is much faster than grep) and the resulting script turned out to be significantly faster than it. I decided then to write my own rough equivalent, called 'grok' (name from another similar program):

grok.c

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <pcre.h>
#include <dirent.h>
#include <limits.h>
#define BLOCK_SIZE 1024
#define OFFSET_COUNT 1
struct {
char * bytes;
off_t length;
} blocks = {NULL, 0};


int search(const char * path, pcre * re) {
FILE * input = fopen(path, "r");
off_t n = 1;
int ovector[OFFSET_COUNT];
int rc;
char first_match = 1;
if(!input) {
perror(path);
return 1;
}
if(!blocks.bytes && !blocks.length) {
// Initialize blocks on first time
blocks.bytes = malloc(BLOCK_SIZE);
memset(blocks.bytes, '\0', BLOCK_SIZE);
blocks.length = BLOCK_SIZE;
}
// Search
while(!feof(input)) {
// Read a line
blocks.bytes[blocks.length - 2] = '\0'; // [blocks.length - 1] will always be '\0' due to fgets() behavior
fgets(blocks.bytes, blocks.length, input);
//printf("%lu/%lu; %d\n", strlen(blocks.bytes), blocks.length, blocks.bytes[blocks.length - 2]);
while(!feof(input) && blocks.bytes[blocks.length - 2] && blocks.bytes[blocks.length - 2] != '\n') {
// Expand blocks as necessary
blocks.length += BLOCK_SIZE;
blocks.bytes = realloc(blocks.bytes, blocks.length);
blocks.bytes[blocks.length - 2] = '\0';
fgets(blocks.bytes + strlen(blocks.bytes), BLOCK_SIZE + 1, input);
//printf("%lu/%lu; %d\n", strlen(blocks.bytes), blocks.length, blocks.bytes[blocks.length - 2]);
}
if(!(feof(input) && !*blocks.bytes)) {
n++;
rc = pcre_exec(re, NULL, blocks.bytes, strlen(blocks.bytes), 0, 0, ovector, OFFSET_COUNT);
if(rc < 0) {
switch(rc) {
case PCRE_ERROR_NOMATCH:
break;
case PCRE_ERROR_BADUTF8:
fprintf(stderr, "Bad UTF-8 at line %lu in %s\nSkipping file (try running with -U option to disable Unicode).\n", n, path);
fclose(input);
return 1;
break;
default:
fprintf(stderr, "Error: %d\n", rc);
break;
}
blocks.bytes[0] = '\0';
continue;
}
if(first_match) {
first_match = 0;
printf("%s:\n", path);
}
printf("%6lu:%s", n, blocks.bytes);
blocks.bytes[0] = '\0';
}
}
// Cleanup
fclose(input);
return 0;
}

int recursive_search(const char * path, pcre * re) {
DIR * dirinfo;
struct dirent * file;
struct stat info;
char fullpath[PATH_MAX], * filepart;
if(!stat(path, &info)) {
if(S_ISREG(info.st_mode)) {
// Regular files
if(search(path, re) == -1)
return -1;
}
else if(S_ISDIR(info.st_mode)) {
// Directories
strcpy(fullpath, path);
strcat(fullpath, "/");
filepart = fullpath + strlen(fullpath);
dirinfo = opendir(path);
while((file = readdir(dirinfo)) != NULL) {
if(*file->d_name != '.') {
strcpy(filepart, file->d_name);
if(recursive_search(fullpath, re) == -1)
return -1;
}
}
closedir(dirinfo);
}
}
else
perror(path);
return 0;
}


int main(int argc, const char * argv[]) {
// Defaults
const char * default_dirs[] = {"."};
const char * progname = *argv;
// General Variables
const char ** dirs;
int erroroffset;
int options = PCRE_UTF8;
off_t i, dirs_length;
const char * error;
pcre * re;
// Initialization
argc--; argv++;
// Parse flags
while(argc && (*argv)[0] == '-' && (*argv)[1] != '-') {
switch((*argv)[1]) {
case 'i':
options |= PCRE_CASELESS;
case 'U':
options &= ~PCRE_UTF8;
case '\0': break;
default:
fprintf(stderr, "Invalid option: %s", *argv);
return -1;
break;
}
argc--; argv++;
}
// Parse arguments
if(argc) {
re = pcre_compile(*argv, options, &error, &erroroffset, NULL);
if(argc > 1) {
dirs = argv + 1;
dirs_length = argc - 1;
}
else {
dirs = default_dirs;
dirs_length = 1;
}
}
else {
fprintf(stderr, "Usage: %s [ -i ] [ -u ] expr [ path1 .. pathN ]\n", progname);
return 1;
}
if(!re) {
fprintf(stderr, "PCRE compilation error at offset %d: %s\n", erroroffset, error);
return 2;
}
// Recursive search
for(i = 0; i < dirs_length; i++) {
if(recursive_search(dirs[i], re) == -1) {
fputs("Ran out of memory.", stderr);
return 128;
}
}
// Cleanup
if(blocks.bytes && blocks.length) {
free(blocks.bytes);
blocks.bytes = NULL;
blocks.length = 0;
}
pcre_free(re);
return 0;
}

As it turns out, my program is able to run twice as fast as his on a given directory tree (small to large).

Saturday, November 7, 2009

Addendum: "Leaf Hat Linux" Stickers

In response to my previous post, it appears that I'll have to have 1000 printed and they'll be 4" wide by 2" tall. I'll raise the price to $0.40 per sticker, but will only charge $3.00 per ten stickers or $20.00 per hundred stickers.

Sorry for the inconvenience; it was news to me too. The quality won't suffer, though, since it's all still not rastorized.

"Leaf Hat Linux" Stickers

I'm having 500 "Leaf Hat Linux" stickers printed. These are high-quality stickers, with no rasterization done at any point, and will be 3.5" wide by 1.25" tall.

If anyone wants one or more, contact me. I'll probably set the price at $0.35 per sticker.

Friday, October 23, 2009

sizeof/bsizeof

I thought it was about time that I make a few convenient changes to the old sizeof utility. The primary change here is adding support of printing either bytes (as bsizeof, which is useful for piping to sort -k1nr) or size in larger units as appropriate (as sizeof).

sizeof.c

#include <sys/types.h>
#include <dirent.h>
#include <stdio.h>
#include <string.h>
#include <libgen.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <limits.h>

off_t getsize(const char * path) {
off_t ret = 0;
struct stat info;
struct dirent * file;
DIR * dirinfo;
char d_name[PATH_MAX];
size_t pathlen = strlen(path);
char * app = d_name + pathlen + 1;
if(pathlen < PATH_MAX) {
strcpy(d_name, path);
strcat(d_name, "/");
if(!stat(path, &info)) {
if(S_ISREG(info.st_mode))
ret = info.st_size;
else if(S_ISDIR(info.st_mode)) {
dirinfo = opendir(path);
while((file = readdir(dirinfo)) != NULL) {
if(strcmp(".", file->d_name) && strcmp("..", file->d_name) && pathlen + file->d_reclen + 1 < PATH_MAX) {
strcpy(app, file->d_name);
ret += getsize(d_name);
}
}
closedir(dirinfo);
}
}
}
return ret;
}
int compute_size_string(char * str, off_t size) {
if(size > (1 << 30))
sprintf(str, "%.2lf GiB", ((double) size) / ((double)(1 << 30)));
else if(size > (1 << 20))
sprintf(str, "%.2lf MiB", ((double) size) / ((double)(1 << 20)));
else if(size > (1 << 10))
sprintf(str, "%.2lf kiB", ((double) size) / ((double)(1 << 10)));
else
sprintf(str, "%lu B", size);
return 0;
}
void print_size_computed(off_t size, const char * name) {
char size_string[1024];
compute_size_string(size_string, size);
printf("%-10s %s\n", size_string, name);
}
void print_size(off_t size, const char * name) {
printf("%-40lu %s\n", size, name);
}

int main(int argc, char ** argv) {
int i;
off_t size;
char * bname = basename(argv[0]);
void (* handler)(off_t, const char *) = strcmp(bname, "bsizeof") ? &print_size_computed : &print_size;
for(i = 1; i < argc; i++) {
size = getsize(argv[i]);
if(size)
handler(size, argv[i]);
}
return 0;
}

Thursday, May 7, 2009

cwork.py

I finally realized that the time I spent figuring out the path do a directory I wanted to go to via tab-completion was being wasted! I've created an alternative method for oft-accessed directories:

cwork.py

#!/usr/bin/python
from sys import argv, stderr, exit
from subprocess import Popen
from os import chdir, environ, getcwd
from os.path import join
from sqlite3 import Connection, IntegrityError
from datetime import datetime


class Sdatetime(datetime):
def strftime(self, fmt = None):
return datetime.strftime(self, '%Y-%m-%d %H:%M:%S.%f' if fmt is None else fmt)
@staticmethod
def strptime(string, fmt = None):
return datetime.strptime(string, '%Y-%m-%d %H:%M:%S.%f' if fmt is None else fmt)

def cdzsh(dir):
chdir(path)
Popen(('screen', 'zsh'))

def getrows_ordered(db):
c = db.cursor()
ret = {}
for row in c.execute('SELECT id, added, path FROM Paths'):
id, now, path = row
ret[Sdatetime.strptime(now)] = id, path
keys = ret.keys()
keys.sort(reverse = True)
for i in xrange(len(keys)):
key = keys[i]
id, value = ret[key]
yield i, id, key, value

db = Connection(join(environ['HOME'], '.path.db'))
db.execute('CREATE TABLE IF NOT EXISTS Paths(id INTEGER PRIMARY KEY AUTOINCREMENT, added CHAR(48), path VARCHAR(255) UNIQUE)')
db.commit()

if len(argv) >= 2:
if len(argv) >= 2 and argv[1] == 'add':
c = db.cursor()
path = getcwd()
if len(argv) >= 3:
path = argv[2]
now = Sdatetime.now()

try:
c.execute('INSERT INTO Paths(added, path) VALUES(?, ?)', (now.strftime(), path))
db.commit()
except IntegrityError:
print >>stderr, 'Path already in database:', path
elif len(argv) >= 2 and argv[1] == 'del':
c = db.cursor()
ids = set([int(arg) for arg in argv[2:]])
rows = list(getrows_ordered(db))
for id in ids:
try:
c.execute('DELETE FROM Paths WHERE id = ?', (rows[id][1],))
db.commit()
except IndexError:
print >>stderr, 'Invalid index:', id
elif len(argv) >= 2 and argv[1] == 'delall':
c = db.cursor()
c.execute('DELETE FROM Paths')
db.commit()
elif len(argv) >= 2:
c = db.cursor()
ids = [int(arg) for arg in argv[1:]]
rows = list(getrows_ordered(db))
for id in ids:
row = rows[id]
now = Sdatetime.now()
c.execute('UPDATE PATHS SET added = ? WHERE id = ?', (now.strftime(), row[1]))
path = rows[id][3]
cdzsh(path)
db.commit()
else:
print >>stderr, 'Usage: %s [ [ path# | add [ path ] | del path# | delall ] ]' % argv[0]
exit(1)
else:
for i, id, key, value in getrows_ordered(db):
print '%d:' % i, value
This script is essentially a cache for directories that the user wants to keep accessing often, and reorders the entries by date every time:Programs % cwork
0: /home/neil/Programs/CSE444/2009-05-07:Project3
1: /home/neil/Programs/CSE481
Programs % cwork add
Programs % cwork
0: /home/neil/Programs
1: /home/neil/Programs/CSE444/2009-05-07:Project3
2: /home/neil/Programs/CSE481
Programs % cwork 0

The last command opens up a new GNU Screen window with a shell in the directory requested.