readline

Using readline's rl_insert_text on OS X 10.5

So, I'm trying to stuff some default text into a user input using readline, and having trouble getting it to work on OSX 10.5: // rl_insert_text_ex.c // gcc -o rl_insert_text_ex rl_insert_text_ex.c -lreadline #include <stdio.h> #include <readline/readline.h> int my_startup_hook(void) { return rl_insert_text("ponycorns"); } int main(i...

Integrate readline's kill-ring and the X11 clipboard

In my .zshrc, I use the following snippet to integrate the shell's clipboard and my primary X11 clipboard. Thanks to this integration, I can cut-and-paste text to and from emacs, firefox, and the terminal without having to use the mouse. kill-line() { zle .kill-line ; echo -n $CUTBUFFER | xclip -i } zle -N kill-line # bound on C-k yank...

Installing readline 6.0 on OS X

I'm trying to install readline 6 from source but run into an error during 'make install'. Here is the end of the output after executing 'sudo make install' ( cd shlib ; make DESTDIR= install ) /bin/sh ../support/mkdirs /usr/local/lib /bin/sh ../support/shlib-install -O darwin9.7.0 -d /usr/local/lib -b /usr/local/bin -i "/usr/bin/insta...

Perl loop stuck reading file?

Closing this question. Will drink red bull. Sleep. Code and come back with brand spanking new question with unit test cases. UPDATE: The new file is here Also the config file is here I refactored the code again: sub getColumns { open my $input, '<', $ETLSplitter::configFile or die "Error opening '$ETLSpliter::configFile':...

GNU readline History feature

I'm using this code for the history features in my shell: http://cc.byexamples.com/20080613/gnu-readline-how-to-keep-a-history-list-of-entered-command-lines/ but when I compile this using gcc, I got this error $ gcc filename.c /tmp/ccay2CgM.o: In function `main': rl.c:(.text+0x9): undefined reference to `rl_abort' rl.c:(.text+0x13): u...

python tab completion in windows

I'm writing a cross-platform shell like program in python and I'd like to add custom tab-completion actions. On Unix systems I can use the built-in readline module and use code like the following to specify a list of possible completions when I hit the TAB key: import readline readline.parse_and_bind( 'tab: complete' ) readline.set_comp...

invoking less application from GNU readline

Hi, Bit support question. Apologies for that. I have an application linked with GNU readline. The application can invoke shell commands (similar to invoking tclsh using readline wrapper). When I try to invoke the Linux less command, I get the following error: Suspend (tty output) I'm not an expert around issues of terminals. I've tried...

How to exclude U+2028 from line separators in Python when reading file?

I have a file in UTF-8, where some lines contain the U+2028 Line Separator character (http://www.fileformat.info/info/unicode/char/2028/index.htm). I don't want it to be treated as a line break when I read lines from the file. Is there a way to exclude it from separators when I iterate over the file or use readlines()? (Besides reading t...

Reading sections from a file in Perl

I am trying to read values from an input file in Perl. Input file looks like: 1-sampledata1 This is a sample test and data for this continues 2-sampledata2 This is sample test 2 Data for this also is on second line I want to read the above data so that data for 1-sampledata1 goes into @array1 and data for 2...

In Perl, how can I read parts of lines that match a criterion?

Sample Data: 603 Some garbage data not related to me, 55, 113 -> 1-ENST0000 This is sample data blh blah blah blahhhh 2-ENSBTAP0 This is also some other sample data 21-ENADT)$ DO NOT WANT TO READ THIS LINE. 3-ENSGALP0 This is third sample data node #4 This is 4th sample data node #5 ...

How to deactivate JLine for Jython interactive interpreter session?

Jython 2.5 comes with JLine per default. I would prefer to use the interactive interpreter with rlwrap. It seems that rlwrap is not working if JLine is active. In Scala I would use rlwrap scala -Xnojline. Is there a similar option for Jython to deactivate JLine? ...

Python: cannot read / write in another commandline application by using subprocess module

I am using Python 3.0 in Windows and trying to automate the testing of a commandline application. The user can type commands in Application Under Test and it returns the output as 2 XML packets. One is a packet and the other one is an packet. By analyzing these packets I can verifyt he result. I ahev the code as below p = subprocess.P...

raw_input without leaving a history in readline

Is there a way of using raw_input without leaving a sign in the readline history, so that it don't show when tab-completing? ...

Handling lines with quotes using python's readline

I've written a simple shell-like program that uses readline in order to provide smart completion of arguments. I would like the mechanism to support arguments that have spaces and are quoted to signify as one argument (as with providing the shell with such). I've seen that shlex.split() knows how to parse quoted arguments, but in case ...

parsing CSV files backwards

I have csv files with the following format: CSV FILE "a" , "b" , "c" , "d" hello, world , 1 , 2 , 3 1,2,3,4,5,6,7 , 2 , 456 , 87 h,1231232,3 , 3 , 45 , 44 The problem is that the first field has commas "," in it. I have no control over file generation, as that's the format I receive them i...

Changing word delimiters in bash

I want to change the delimiters bash (or readline) uses to separate words. Specifically I want to make '-' not delimit words, so that if I have the text ls some-file and I press Alt-Backspace it deletes the entire some-file text and not just up to the '-' char. This will also cause deletions of long flags like --group-directories-firs...

How to improve speed of this readline loop in python ?

Hi all, i'm importing several parts of a Databasedump in text Format into MySQL, the problem is that before the interesting Data there is very much non-interesting stuff infront. I wrote this loop to get to the needed data: def readloop(DBFILE): txtdb=open(DBFILE, 'r') sline = "" # loop till 1st "customernum:" is found while slin...

c# - StreamReader.ReadLine does not work properly!

Simply I have been trying to implement what BufferedStreamReader does in Java. I have a socket stream open and just want to read it in a line oriented fashion -line by line. I have following server-code while (continueProcess) { try { StreamReader reader = new StreamReader(Socket.GetStrea...

Advance C# ReadLine() to next line in a function call

Hello, In my C# app I'm trying to feed into ReadLine() a simple text document with 7 digit strings separated line by line. What I'm attempting to do is grab the next 7 digit string each time the function is called. Here's what I have so far: string invoiceNumberFunc() { string path = @"C:\Users\sam\Documents\GCProg\testRead...

GNU Readline: how do clear the input line?

I use GNU Readline in the "select" fashion, by registering a callback function like so: rl_callback_handler_install("", on_readline_input); And then hooking up rl_callback_read_char as the callback for my select() loop for STDIN_FILENO. That's all pretty standard stuff, and works fine. Now, my program asynchronously prints messages ...