Discussion:
[surf] Bookmarks patch for 0.2
Tadeusz Sośnierz
2009-10-20 12:44:53 UTC
Permalink
Hello,
I wrote some patch for bookmark handling, attached. Everything is driven
by the right-click menu. Sadly, I had no idea how to include some labels
for the urls. Also, I'm rather beggining with C, so I'm sorry for any
eye-stabbing stupidities you may encounter, and please report
them to me.

Hope You'll like it.
Regards,
Ted
--
===========================================================
() ascii ribbon campaign - against html e-mail
/\ www.asciiribbon.org - against proprietary attachments
Julien Steinhauser
2009-10-20 16:11:40 UTC
Permalink
Post by Tadeusz Sośnierz
Hello,
I wrote some patch for bookmark handling, attached. Everything is driven
by the right-click menu. Sadly, I had no idea how to include some labels
for the urls.
I'm sorry, I won't provide any practical help as I'm really clueless in c.

To include some label, what about adding a step where the url is given
as an input to dmenu, then you just need to tab and space once, write
your label, and make dmenu output to the bookmark file.
Julien Pecqueur
2009-10-23 17:26:50 UTC
Permalink
Post by Tadeusz Sośnierz
Hello,
I wrote some patch for bookmark handling, attached. Everything is driven
by the right-click menu. Sadly, I had no idea how to include some labels
for the urls. Also, I'm rather beggining with C, so I'm sorry for any
eye-stabbing stupidities you may encounter, and please report
them to me.
Hope You'll like it.
I'd have the same idea few weeks ago and i wrote a very-simple bookmarks
management implementation for surf (using dmenu). However, your idea of
displaying bookmarks list in a about:bookmarks page is smartest :)
Post by Tadeusz Sośnierz
+void
+addbookmark(Client *c, const Arg *arg) {
+ char *bmark_uri;
+ FILE *f;
+ bmark_uri = geturi(c);
+ f = fopen(bmarksfile, "a+");
+ fprintf(f, "%s\n", geturi(c));
+ fclose(f);
+}
The pointer *bmark_uri is not used in the function.

Good job, i'll be apply your patch this evening!
--
Julien Pecqueur (JPEC)

Site: http://julienpecqueur.com
Email: ***@julienpecqueur.com
PGP: B1AA2389 (GNUPG)
IRC: jpec (irc.freenode.net)

Powered by Archlinux - Keep it simple stupid !
Tadeusz Sośnierz
2009-10-23 18:52:33 UTC
Permalink
Post by Julien Pecqueur
Post by Tadeusz Sośnierz
Hello,
I wrote some patch for bookmark handling, attached. Everything is driven
by the right-click menu. Sadly, I had no idea how to include some labels
for the urls. Also, I'm rather beggining with C, so I'm sorry for any
eye-stabbing stupidities you may encounter, and please report
them to me.
Hope You'll like it.
I'd have the same idea few weeks ago and i wrote a very-simple bookmarks
management implementation for surf (using dmenu). However, your idea of
displaying bookmarks list in a about:bookmarks page is smartest :)
Post by Tadeusz Sośnierz
+void
+addbookmark(Client *c, const Arg *arg) {
+ char *bmark_uri;
+ FILE *f;
+ bmark_uri = geturi(c);
+ f = fopen(bmarksfile, "a+");
+ fprintf(f, "%s\n", geturi(c));
+ fclose(f);
+}
The pointer *bmark_uri is not used in the function.
Right, my bad. Thanks for noticing!
Post by Julien Pecqueur
Good job, i'll be apply your patch this evening!
I'm glad you like it.

Regards
--
===========================================================
() ascii ribbon campaign - against html e-mail
/\ www.asciiribbon.org - against proprietary attachments
Moritz Wilhelmy
2009-11-02 00:04:32 UTC
Permalink
Would you please add it to the surf page in the suckless wiki?
Post by Tadeusz Sośnierz
Post by Julien Pecqueur
Post by Tadeusz Sośnierz
Hello,
I wrote some patch for bookmark handling, attached. Everything is driven
by the right-click menu. Sadly, I had no idea how to include some labels
for the urls. Also, I'm rather beggining with C, so I'm sorry for any
eye-stabbing stupidities you may encounter, and please report
them to me.
Hope You'll like it.
I'd have the same idea few weeks ago and i wrote a very-simple bookmarks
management implementation for surf (using dmenu). However, your idea of
displaying bookmarks list in a about:bookmarks page is smartest :)
Post by Tadeusz Sośnierz
+void
+addbookmark(Client *c, const Arg *arg) {
+ char *bmark_uri;
+ FILE *f;
+ bmark_uri = geturi(c);
+ f = fopen(bmarksfile, "a+");
+ fprintf(f, "%s\n", geturi(c));
+ fclose(f);
+}
The pointer *bmark_uri is not used in the function.
Right, my bad. Thanks for noticing!
Post by Julien Pecqueur
Good job, i'll be apply your patch this evening!
I'm glad you like it.
Regards
--
===========================================================
() ascii ribbon campaign - against html e-mail
/\ www.asciiribbon.org - against proprietary attachments
Tadeusz Sośnierz
2009-11-02 04:10:33 UTC
Permalink
Post by Moritz Wilhelmy
Would you please add it to the surf page in the suckless wiki?
Sure. I'll make a fresh diff today, if there are no protests I'll be
glad to submit.

Regards,
Ted
Post by Moritz Wilhelmy
Post by Tadeusz Sośnierz
Post by Julien Pecqueur
Post by Tadeusz Sośnierz
Hello,
I wrote some patch for bookmark handling, attached. Everything is driven
by the right-click menu. Sadly, I had no idea how to include some labels
for the urls. Also, I'm rather beggining with C, so I'm sorry for any
eye-stabbing stupidities you may encounter, and please report
them to me.
Hope You'll like it.
I'd have the same idea few weeks ago and i wrote a very-simple bookmarks
management implementation for surf (using dmenu). However, your idea of
displaying bookmarks list in a about:bookmarks page is smartest :)
Post by Tadeusz Sośnierz
+void
+addbookmark(Client *c, const Arg *arg) {
+ char *bmark_uri;
+ FILE *f;
+ bmark_uri = geturi(c);
+ f = fopen(bmarksfile, "a+");
+ fprintf(f, "%s\n", geturi(c));
+ fclose(f);
+}
The pointer *bmark_uri is not used in the function.
Right, my bad. Thanks for noticing!
Post by Julien Pecqueur
Good job, i'll be apply your patch this evening!
I'm glad you like it.
Regards
--
===========================================================
() ascii ribbon campaign - against html e-mail
/\ www.asciiribbon.org - against proprietary attachments
--
===========================================================
() ascii ribbon campaign - against html e-mail
/\ www.asciiribbon.org - against proprietary attachments
Nico Golde
2009-11-02 01:15:25 UTC
Permalink
Hi,
* Tadeusz So??nierz <***@gmail.com> [2009-10-20 16:36]:
[...]
+showbmarks(Client *c, const Arg *arg) {
+ /* I wonder if 4 kB is too much or not enough */
+ char html[4096] = "";
+ /* same here. time will tell */
+ char uri[128];
+ FILE *f;
+ stop(c, NULL);
+ f = fopen(bmarksfile, "r");
+ while(fscanf(f, "%127s\n", uri) != EOF) {
+ snprintf(&html[strlen(html)], sizeof(html) - strlen(html),
+ "<a href='%s'>%s</a><br />", uri, uri);
You may want to html escape the uri, not?

Cheers
Nico
--
Nico Golde - http://www.ngolde.de - ***@jabber.ccc.de - GPG: 0xA0A0AAAA
For security reasons, all text in this mail is double-rot13 encrypted.
Tadeusz Sośnierz
2009-11-02 04:17:55 UTC
Permalink
Post by Nico Golde
Hi,
[...]
+showbmarks(Client *c, const Arg *arg) {
+ /* I wonder if 4 kB is too much or not enough */
+ char html[4096] = "";
+ /* same here. time will tell */
+ char uri[128];
+ FILE *f;
+ stop(c, NULL);
+ f = fopen(bmarksfile, "r");
+ while(fscanf(f, "%127s\n", uri) != EOF) {
+ snprintf(&html[strlen(html)], sizeof(html) - strlen(html),
+ "<a href='%s'>%s</a><br />", uri, uri);
You may want to html escape the uri, not?
Well, there are some security reasons, if that's what you mean. But
my tiny investigation (I mean, entering query string to google
containing html tags) showed that they become urlencoded by the app
itself, so it seems safe to me. If there's anything I don't know, please
let me know.

Regards,
Ted
--
===========================================================
() ascii ribbon campaign - against html e-mail
/\ www.asciiribbon.org - against proprietary attachments
Nico Golde
2009-11-04 20:38:25 UTC
Permalink
Hi,
Post by Tadeusz Sośnierz
Post by Nico Golde
[...]
+showbmarks(Client *c, const Arg *arg) {
+ /* I wonder if 4 kB is too much or not enough */
+ char html[4096] = "";
+ /* same here. time will tell */
+ char uri[128];
+ FILE *f;
+ stop(c, NULL);
+ f = fopen(bmarksfile, "r");
+ while(fscanf(f, "%127s\n", uri) != EOF) {
+ snprintf(&html[strlen(html)], sizeof(html) - strlen(html),
+ "<a href='%s'>%s</a><br />", uri, uri);
You may want to html escape the uri, not?
Well, there are some security reasons, if that's what you mean. But
my tiny investigation (I mean, entering query string to google
containing html tags) showed that they become urlencoded by the app
itself, so it seems safe to me. If there's anything I don't know, please
let me know.
OK fine. Yes that was what I meant.

Cheers
Nico
--
Nico Golde - http://www.ngolde.de - ***@jabber.ccc.de - GPG: 0xA0A0AAAA
For security reasons, all text in this mail is double-rot13 encrypted.
Loading...