dmitrysmagin / dmenu

Automatically exported from code.google.com/p/dmenu
3 stars 4 forks source link

Modified common.c to save recent command #17

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I modified the common.c and wrote a easy script called 'readhistfile' so
that it is able to log users' commands. It is convenient for users if they
want to run recent files. 

Original issue reported on code.google.com by bossninja on 7 Oct 2009 at 10:54

Attachments:

GoogleCodeExporter commented 9 years ago
I make dmemu with your common.c merged, and I got a histfile.

When I ran readhistfile which in same directory with histfile,
I can see my recent commands.  But isn't it too small font ?

And I got some errors when I ESC(=SELECT Button) from readhistfile.
./readhistfile: line 32: syntax error: *2-1
./readhistfile: line 33: syntax error: *2
./readhistfile: line 34: syntax error: *2
./readhistfile: line 39: : Permission denied

I can't run prboom from readhistfile, it sed "IWAD not found" because I don't 
use 
DOOMgoo script. I set my prboom command like this ,

SubMenuItem UltimateDoom
 {
   Icon = "res/dooms/ultimatedoom.png"
   Name = "The Ultimate Doom"
   Executable = "./prboom -iwad /usr/local/ports/prboom/iwad/doom.wad -save 
/usr/local/home/.prboom/ultimatedoom/"
   WorkDir = "/usr/local/ports/prboom"
 }

Original comment by leo.5xl.bigfat on 13 Oct 2009 at 8:39

GoogleCodeExporter commented 9 years ago
Hi, leo.5xl.bigfat,

I got it. I will fix the problem soon. 

Original comment by bossninja on 13 Oct 2009 at 11:32

GoogleCodeExporter commented 9 years ago
Hi, leo.5xl.bigfat, 

This problem seems to be more complex than my prediction. We can reproduce the
problem in linux system in Ubuntu or sth else, for example:

Let's say there is a MP3 file called "1 1.mp3" (note: there is an space in this
filename),if we type the following cmd in terminal to define two shell 
variables:

cmd="mplayer"
cmdarg="-ao oss 1 1.mp3" 

and type:
$cmd $cmdarg
it indicates "can't find 1 1.mp3", because the space in this filename is 
neglected.

if we type
$cmd "$cmdarg"
it indicates "Error parsing option on the command line: -ao oss 1 1.mp3"

We can use number array to solve the two problems in bash, so this is the normal
solution:

cmd="mplayer"
cmdarg1=(-ao oss "1 1.mp3")
$cmd “${cmdarg1[@]}” 

However, unfortunately in Dingux system, the bash is not available, we have to 
use
the ash, it's a little simple and stupid. The problem is the previous solution 
is not
available anymore because ash doesn't support the number array. 

For your case, it's the same as the previous example:

if you change the $cmd "$cmdarg" to $cmd $cmdarg, you will run your doom cmd
successfully, however, it will cause other problems. This script can't execute 
other
emulators such as snes9x if the filename includes an space symbol.  

================================================================================
=====
I have fixed this error:
./readhistfile: line 32: syntax error: *2-1
./readhistfile: line 33: syntax error: *2
./readhistfile: line 34: syntax error: *2
./readhistfile: line 39: : Permission denied

and for the font number, there is an solution from:
http://dingoo-scene.blogspot.com/2009/10/portal-for-dingux.html
http://dl.openhandhelds.org/cgi-bin/dingoo.cgi?0,0,0,0,25,172

In its startup shell script, you will find a way to increase the font size in 
terminal.
================================================================================
====

I am rewriting the filename parsing code, it will take a while. I hope I can 
fix the
first annoying problem soon. Quite sorry for the late response, my attention is
attracted a little by that psx4all emulator. :)

Original comment by bossninja on 18 Oct 2009 at 10:19

Attachments:

GoogleCodeExporter commented 9 years ago
The parsing problem should be solved. You would like to compile dmenu with the
modified common.c again, and put the new readhist script. Please let me know if 
there
are other mistakes. Thank you very much!

Have fun.

Original comment by bossninja on 18 Oct 2009 at 5:52

Attachments:

GoogleCodeExporter commented 9 years ago
Sorry about my poor english.

I tested it.

*First, [SELECT BUTTON] problem is fixed.

*Second, application and argument problem seems not fixed.

   prboom v2.5.0 (http://prboom.sourceforge.net/)
   I_SetAffinityMask: manual affinity mask is 1
   M_LoadDefaults: Load system defaults.
    default file: ./prboom.cfg
    found /usr/local/ports/prboom/iwad/doom2.wad
   IWAD found: /usr/local/ports/prboom/iwad/doom2.wad
   PrBoom (built Oct 14 2009), playing: DOOM 2: Hell on Earth
   PrBoom is released under the GNU General Public license v2.0.
   You are welcome to redistribute it under certain conditions.
   It comes with ABSOLUTELY NO WARRANTY. See the file COPYING for details.
   V_Init: allocate screens.
    found prboom.wad
   D_InitNetGame: Checking for network game.
   W_Init: Init WADfiles.
    adding /usr/local/ports/prboom/iwad/doom2.wad
    adding prboom.wad
    adding /usr/local/ports/prboom/pwad/hr.wad
    adding /usr/local/ports/prboom/pwad/hrmus.wad
   W_AddFile: couldn't open NULL.wad

About this entry, I wrote in theme.cfg like this,

       SubMenuItem Doom2HR
       {
               Icon = "res/ports/doomgoo.png"
               Name = "Hell Revealed"
               Executable = "./prboom -iwad /usr/local/ports/prboom/iwad/doom2.wad -file /usr/local/ports/prboom/pwad/hr.wad /usr/local/ports/prboom/pwad/hrmus.wad"
               WorkDir = "/usr/local/ports/prboom"
       }

*Third, I tried to imitate ASCIIpOrtal startup script like this, but it's not 
effected.

      MenuItem hist
      {
              Icon = "res/system/test.png"
              Name = "History"
              Executable = "./readhistfile -r 320x240"
              WorkDir = "/usr/local/home/.dmenu/"
      }

I think, the fonts which displayed in ASCIIpOrtal game are a part of bitmap 
graphic, the name is pdcfont.bmp .
And I think, the normal text font size is determined at zImage. So we can't 
choice other font size.
Please get zImage source code, and try to make zImage. There are some font size 
selection in it's configure script.

Thanx.

Original comment by leo.5xl.bigfat on 23 Oct 2009 at 9:01

GoogleCodeExporter commented 9 years ago
I suggest that we incorporatethe only "Modified common.c" , and put the 
"histfile" into 
"/usr/local/home/.dmenu/" .

Bossninja, how about you to release "readhistfile" for an original and 
independent 
apprication ? 

How do you all think about this suggestion ?

Original comment by leo.5xl.bigfat on 23 Oct 2009 at 9:17

GoogleCodeExporter commented 9 years ago
Hi, leo.5xl.bigfat,

Thank for your feedback. 

For your second problem:

Have you deleted the old histfile in the HOME directory? Because I changed the 
structure of histfile, now there are three lines for each command. 

Your previous entry as following works well in my test:

SubMenuItem UltimateDoom
 {
   Icon = "res/dooms/ultimatedoom.png"
   Name = "The Ultimate Doom"
   Executable = "./prboom -iwad /usr/local/ports/prboom/iwad/doom.wad -save 
/usr/local/home/.prboom/ultimatedoom/"
   WorkDir = "/usr/local/ports/prboom"
 }

Currently I don't have the hr.wad and hrmus.wad, so I need to download them to
reproduce this problem. I will give you a feedback later.
================================================================================
=====
For your third problem:

Actually, we can change the font size in terminal, you can uncomment this line 
in my
readhist script:

 setfont ./default8x9.psfu -C /dev/tty0

The default8x9.psfu is attached, just put it into the HOME directory. You 
should see
a bigger font. It's not necessary to add "-r 320x240". It seems the latest 
version of
ASCIIpOrtal changed the display method, because I remember that guy used the
default8x9.psfu in the old version and the attached psfu file is from 
ASCIIpOrtal in
fact. :) 

================================================================================
====
For your suggestions, the problem is the modified common.c will always add the
recorded command into the histfile, so that the size of histfile will become 
larger
and larger if you don't execute the readhist script. Because the readhisfile is 
used
to check the maximum record number (people can change the maximum number in the
script themselves) and delete the extra useless command. So it is not so good to
incorporate the "modified common.c" into the trunk without the readhistfile. I 
think
the modified common.c shouldn't be merged into the trunk now. 

Is it possible to put the readhistfile and the modified common.c into the 
branches?
so people could svn the branches themselves, we can also test several new ideas 
in
the branches without impacting the stable version. Thanks for your valuable 
suggestion.

Original comment by bossninja on 23 Oct 2009 at 10:07

Attachments:

GoogleCodeExporter commented 9 years ago
Hi, leo.5xl.bigfat,

I have fixed the first problem, it should work now. You can try the new script 
file
with the default8x9.psfu font. Unfortunately the screen of Dingoo is so small,
sometimes long file names can't be displayed within the screen. So if you want 
to use
the small font, just comment "setfont ./default8x9.psfu -C /dev/tty0". 

Please let me know if there is any bug, thank you. 

Original comment by bossninja on 23 Oct 2009 at 11:41

Attachments:

GoogleCodeExporter commented 9 years ago
Here is the corrected readhistfile script. Have fun. 

Original comment by bossninja on 23 Oct 2009 at 11:53

Attachments: