Very nice idea. What about collecting all these "baseutilities" and put them on suckless.org? If we can write more utilities we may get a complete suckless userspace... :)
2008/1/23, pancake <[EMAIL PROTECTED]>: > Oops I forgot to say that it supports a dmenu-mode (this code inherits from > the old eread program I send to the list few months ago). > > Usage is quite simple: > > int main(int argc, char **argv) > { > char *ret; > > dl_init(); > dl_prompt = "$ "; > > do { > ret = dl_readline(argc, argv); > if (ret) { > printf(" [line] '%s'\n", ret); > dl_hist_add(ret); > } > } while(ret!=NULL); > > dl_free(); > } > > Have fun! > > > --pancake > > On Wed, Jan 23, 2008 at 04:31:57PM +0100, pancake wrote: > > As I request in a previous mail I have developed a readline-like > > library in a minimalistic way avoiding the unnecessary overhead > > and dependency with a single portable c file. > > > > I have tested this on NetBSD, GNU/linux and native w32 and works > > pretty fine. > > > > The library currently supports autocompletion of a single word > > using argc, argv (this is just a PoC). Allows to change the prompt, > > and change some configuration stuff for it. > > > > No vi or emacs mode yet (should i read inputrc?). > > > > Current support: > > > > - history log > > - navigate history with ^n/^p or up/down keys > > - autocompletion for one keyword (no nested yet) > > - tab key hooked for autocompletion > > - support to change the prompt > > - handle ^C and ^D > > > > You can download the implementation here: > > > > http://news.nopcode.org/dietline.c > > > > To test it on w32 just put __UNIX__ to 0 and __WINDOWS__ to 1 :) > > > > $ gcc dietline.c > > $ ./a.out foo bar foobar foocowblob foocowguai > > = foo<tab> > > foo foobar foocowblob foocowguai > > = foocow<tab> > > foocowblob foocowguai > > = foocowb<tab> > > = foocowblob > > > > I plan to use this library instead of readline for radare > > (radare.nopcode.org) > > so I plan to continue working on it. > > > > Patches and ideas are welcome. > > > > --pancake > > > > -- http://www.gnuffy.org - Real Community Distro http://www.gnuffy.org/index.php/GnuEm - Gnuffy on Ipaq (Codename Peggy)