sites

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit bdc9c8e7c85ac7f19ca19fde0fc5e54c8532a36d
parent 253e1057dcc1cd45d6ee7bc660be3f4ed6d8d3c0
Author: Gregor Best <gbe@unobtanium.de>
Date:   Sun, 19 Oct 2014 14:01:05 +0200

Merge branch 'master' of git://git.suckless.org/sites

Diffstat:
Ast.suckless.org/patches/copyurl.md | 18++++++++++++++++++
Ast.suckless.org/patches/st-git-copyurl.diff | 98+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mtools.suckless.org/sbase.md | 82+++++++------------------------------------------------------------------------
Mtools.suckless.org/ubase.md | 49++-----------------------------------------------
4 files changed, 125 insertions(+), 122 deletions(-)

diff --git a/st.suckless.org/patches/copyurl.md b/st.suckless.org/patches/copyurl.md @@ -0,0 +1,18 @@ +copyurl +======= + +Description +----------- + +Select and copy the last URL in the display. Multiple invocations cycle through +the available URLs. + +Download +-------- + +* [st-git-copyurl.diff](st-git-copyurl.diff) + +Author +------ + + * Brandon Mulcahy - brandon @ jangler . info diff --git a/st.suckless.org/patches/st-git-copyurl.diff b/st.suckless.org/patches/st-git-copyurl.diff @@ -0,0 +1,98 @@ +From 3aa97780747496b08ec2057266a0a030737cf153 Mon Sep 17 00:00:00 2001 +From: Brandon Mulcahy <brandon@jangler.info> +Date: Fri, 17 Oct 2014 00:27:46 -0400 +Subject: [PATCH] copyurl patch + +Select and copy the last URL in the display. Multiple invocations cycle through +the available URLs. +--- + config.def.h | 1 + + st.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 57 insertions(+) + +diff --git a/config.def.h b/config.def.h +index 1667ed6..be25f2a 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -120,6 +120,7 @@ static Shortcut shortcuts[] = { + { ShiftMask, XK_Insert, selpaste, {.i = 0} }, + { MODKEY|ShiftMask, XK_Insert, clippaste, {.i = 0} }, + { MODKEY, XK_Num_Lock, numlock, {.i = 0} }, ++ { MODKEY, XK_l, copyurl, {.i = 0} }, + }; + + /* +diff --git a/st.c b/st.c +index bcf96e9..50065e9 100644 +--- a/st.c ++++ b/st.c +@@ -323,6 +323,7 @@ static void xzoomreset(const Arg *); + static void printsel(const Arg *); + static void printscreen(const Arg *) ; + static void toggleprinter(const Arg *); ++static void copyurl(const Arg *); + + /* Config.h for applying patches and the configuration. */ + #include "config.h" +@@ -3989,3 +3990,58 @@ run: + return 0; + } + ++/* select and copy the previous url on screen (do nothing if there's no url). ++ * known bug: doesn't handle urls that span multiple lines (wontfix) ++ * known bug: only finds first url on line (mightfix) ++ */ ++void ++copyurl(const Arg *arg) { ++ /* () and [] can appear in urls, but excluding them here will reduce false ++ * positives when figuring out where a given url ends. ++ */ ++ static char URLCHARS[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ++ "abcdefghijklmnopqrstuvwxyz" ++ "0123456789-._~:/?#@!$&'*+,;=%"; ++ ++ int i, row, startrow; ++ char *linestr = calloc(sizeof(char), term.col+1); /* assume ascii */ ++ char *c, *match = NULL; ++ ++ row = startrow = (sel.ob.x >= 0 && sel.nb.y > 0) ? sel.nb.y-1 : term.row-1; ++ ++ /* find the start of the last url before selection */ ++ do { ++ for (i = 0; i < term.col; ++i) ++ linestr[i] = term.line[row][i].c[0]; ++ linestr[term.col] = '\0'; ++ if ((match = strstr(linestr, "http://")) ++ || (match = strstr(linestr, "https://"))) ++ break; ++ if (--row < 0) ++ row = term.row-1; ++ } while (row != startrow); ++ ++ if (match) { ++ /* must happen before trim */ ++ selclear(NULL); ++ sel.ob.x = strlen(linestr) - strlen(match); ++ ++ /* trim the rest of the line from the url match */ ++ for (c = match; c != '\0'; ++c) ++ if (!strchr(URLCHARS, *c)) { ++ *c = '\0'; ++ break; ++ } ++ ++ /* select and copy */ ++ sel.mode = 1; ++ sel.type = SEL_REGULAR; ++ sel.oe.x = sel.ob.x + strlen(match)-1; ++ sel.ob.y = sel.oe.y = row; ++ selnormalize(); ++ tsetdirt(sel.nb.y, sel.ne.y); ++ selcopy(); ++ } ++ ++ free(linestr); ++} +-- +2.1.2 + diff --git a/tools.suckless.org/sbase.md b/tools.suckless.org/sbase.md @@ -3,82 +3,14 @@ sbase sbase is a collection of unix tools that are inherently portable across UNIX and UNIX-like systems. -The following programs are currently implemented: - -* basename -* cal -* cat -* chgrp -* chmod -* chown -* chroot -* cksum -* cmp -* cols -* comm -* cp -* cut -* date -* dirname -* du -* echo -* env -* expand -* false -* fold -* grep -* head -* hostname -* kill -* ln -* ls -* md5sum -* mkdir -* mkfifo -* mktemp -* mv -* nice -* nl -* nohup -* paste -* printenv -* printf -* pwd -* readlink -* renice -* rm -* rmdir -* sleep -* setsid -* sort -* split -* sponge -* strings -* sync -* tail -* tar -* tee -* test -* touch -* tr -* true -* tty -* uudecode -* uuencode -* uname -* unexpand -* uniq -* unlink -* seq -* sha1sum -* sha256sum -* sha512sum -* wc -* xargs -* yes - -The overall SLOC is about 6kSLOC, so this userland is about the same size as GNU ls. +For a list of tools that are currently implemented, please refer +to the [README](http://git.suckless.org/sbase/tree/README). Download -------- * <code>git clone [http://git.suckless.org/sbase](http://git.suckless.org/sbase)</code> + +Contact +------- +E-mail [sin@2f30.org](mailto:sin@2f30.org) or post your issue to the +[dev@suckless.org](mailto:dev@suckless.org) mailing list. diff --git a/tools.suckless.org/ubase.md b/tools.suckless.org/ubase.md @@ -3,53 +3,8 @@ ubase ubase is a collection of tools similar in spirit to util-linux but much simpler. -The following programs are currently implemented: - -* chvt -* clear -* ctrlaltdel -* dd -* df -* dmesg -* eject -* fallocate -* free -* freeramdisk -* fsfreeze -* getty -* halt -* hwclock -* id -* insmod -* killall5 -* login -* lsmod -* lsusb -* mesg -* mknod -* mkswap -* mount -* mountpoint -* pagesize -* passwd -* pidof -* pivot_root -* ps -* readahead -* respawn -* rmmod -* stat -* su -* swapoff -* swapon -* switch_root -* sysctl -* truncate -* umount -* unshare -* uptime -* watch -* who +For a list of tools that are currently implemented, please refer +to the [README](http://git.suckless.org/ubase/tree/README). Download --------