You are not logged in.

#1 2012-03-03 03:30:51

whooper
Member
From: Germany
Registered: 2008-12-24
Posts: 37

[solved] help sorting history file

Hi,

I'm using the surf browser and I patched it a history file. But theres a problem, the history entries get written one after another on the same line instead of different lines:

https://duckduckgo.com/html/?kh=1&kl=pt-pt&kp=-1&ks=m&k1=-1http://youtube.comhttp://archlinux.org

Instead of:

https://duckduckgo.com/html/?kh=1&kl=pt-pt&kp=-1&ks=m&k1=-1
http://youtube.com
http://archlinux.org

Here's the patch I'm using: patch

with this function:

#define HIST       { .v = (char *[]){ "/bin/sh", "-c", \
"xprop -id $0 -f _SURF_GO 8s -set _SURF_GO \
`cat ~/.config/surf/history | sort -ru | dmenu -l 10 -i -fn \"ubuntu mono\" -nb \"#222222\" -nf \"#FFFFFF\" -sb \"#005577\" -sf \"#eeeeee\" || exit 0`", \
winid, NULL } }

Last edited by whooper (2012-03-03 12:59:05)

Offline

#2 2012-03-03 12:58:37

whooper
Member
From: Germany
Registered: 2008-12-24
Posts: 37

Re: [solved] help sorting history file

Found the solution, the fprintf function didn't have the proper arguments:

+		FILE *f;
+		f = fopen(historyfile, "a+");
+		fprintf(f, u);
+		fclose(f);

to

+		FILE *f;
+		f = fopen(historyfile, "a+");
+		fprintf(f, "%s\n",u);
+		fclose(f);

Marking as solved..

Last edited by whooper (2012-03-03 12:58:51)

Offline

Board footer

Powered by FluxBB