From 865abce98298fb1865b818b88cfc4fb1027c1868 Mon Sep 17 00:00:00 2001 From: Abel `00z' Camarillo <00z@the00z.org> Date: Sun, 28 Jun 2009 01:44:46 -0500 Subject: Makefile now supports "transparently" BSD make added support for pmake --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index 4e9d282..053eca2 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,9 @@ CFLAGS:=-std=c99 $(shell pkg-config --cflags gtk+-2.0 webkit-1.0 libsoup-2.4 gthread-2.0) -ggdb -Wall -W -DARCH="\"$(shell uname -m)\"" -lgthread-2.0 -DG_ERRORCHECK_MUTEXES -DCOMMIT="\"$(shell git log | head -n1 | sed "s/.* //")\"" $(CPPFLAGS) +CFLAGS!=echo -std=c99 `pkg-config --cflags gtk+-2.0 webkit-1.0 libsoup-2.4 gthread-2.0` -ggdb -Wall -W -DARCH='"\""'`uname -m`'"\""' -lgthread-2.0 -DG_ERRORCHECK_MUTEXES -DCOMMIT='"\""'`git log | head -n1 | sed "s/.* //"`'"\""' $(CPPFLAGS) + LDFLAGS:=$(shell pkg-config --libs gtk+-2.0 webkit-1.0 libsoup-2.4 gthread-2.0) -pthread $(LDFLAGS) +LDFLAGS!=echo `pkg-config --libs gtk+-2.0 webkit-1.0 libsoup-2.4 gthread-2.0` -pthread $(LDFLAGS) + all: uzbl uzblctrl PREFIX?=$(DESTDIR)/usr -- cgit v1.2.3 From d36686924a2b7d81ad5c74b38249e53af0b6449e Mon Sep 17 00:00:00 2001 From: Abel `00z' Camarillo <00z@the00z.org> Date: Sun, 28 Jun 2009 02:42:31 -0500 Subject: make domnload.sh more portable now not bash-specific. --- examples/data/uzbl/scripts/download.sh | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/examples/data/uzbl/scripts/download.sh b/examples/data/uzbl/scripts/download.sh index d87335f..aa1ca09 100755 --- a/examples/data/uzbl/scripts/download.sh +++ b/examples/data/uzbl/scripts/download.sh @@ -1,15 +1,19 @@ -#!/bin/bash +#!/bin/sh # just an example of how you could handle your downloads # try some pattern matching on the uri to determine what we should do -# Some sites block the default wget --user-agent... -WGET="wget --user-agent=Firefox" +# Some sites block the default wget --user-agent.. +GET="wget --user-agent=Firefox" -if [[ $8 =~ .*(.torrent) ]] +dest="$HOME" +url="$8" + +test "x$url" = "x" && { echo "you must supply a url! ($url)"; exit 1; } + +# only changes the dir for the $get sub process +if echo "$url" | grep -E '.*\.torrent' >/dev/null; then - cd $HOME - $WGET $8 + ( cd "$dest"; eval "$GET" "$url") else - cd $HOME - $WGET $8 + ( cd "$dest"; eval "$GET" "$url") fi -- cgit v1.2.3 From 135b490546cd5833aec76588825eba6634f8fd21 Mon Sep 17 00:00:00 2001 From: Abel `00z' Camarillo <00z@the00z.org> Date: Sun, 28 Jun 2009 13:03:22 -0500 Subject: more portability on shell scripts i haven't really tested this, but i expect that someone that knows the code (and cares about it) to do the last portability changes. i don't think that this scripts are going to run with a shell different than bash anyway... --- examples/data/uzbl/scripts/clipboard.sh | 9 ++-- examples/data/uzbl/scripts/cookies.sh | 53 +++++++++++++--------- examples/data/uzbl/scripts/history.sh | 3 +- examples/data/uzbl/scripts/insert_bookmark.sh | 5 +- .../data/uzbl/scripts/load_url_from_history.sh | 9 ++-- examples/data/uzbl/scripts/session.sh | 4 +- examples/data/uzbl/scripts/yank.sh | 9 ++-- 7 files changed, 57 insertions(+), 35 deletions(-) diff --git a/examples/data/uzbl/scripts/clipboard.sh b/examples/data/uzbl/scripts/clipboard.sh index c64b65c..85ccbc6 100755 --- a/examples/data/uzbl/scripts/clipboard.sh +++ b/examples/data/uzbl/scripts/clipboard.sh @@ -1,14 +1,17 @@ -#!/bin/bash +#!/bin/sh # with this script you can store the current url in the clipboard, or go to the url which is stored in the clipboard. +clip=xclip + fifo="$5" action="$1" url="$7" -selection=$(xclip -o) + +selection=`$clip -o` case $action in - "yank" ) echo -n "$url" | xclip;; + "yank" ) echo -n "$url" | eval "$clip";; "goto" ) echo "uri $selection" > "$fifo";; * ) echo "clipboard.sh: invalid action";; esac diff --git a/examples/data/uzbl/scripts/cookies.sh b/examples/data/uzbl/scripts/cookies.sh index 56b9c79..03ddef8 100755 --- a/examples/data/uzbl/scripts/cookies.sh +++ b/examples/data/uzbl/scripts/cookies.sh @@ -1,4 +1,6 @@ -#!/bin/bash +#!/bin/sh + +set -n; # THIS IS EXPERIMENTAL AND COULD BE INSECURE !!!!!! @@ -24,10 +26,10 @@ # http://kb.mozillazine.org/Cookies.txt # don't always append cookies, sometimes we need to overwrite -cookie_config=${XDG_CONFIG_HOME:-$HOME/.config}/uzbl/cookies -[ -z "$cookie_config" ] && exit 1 -[ -d ${XDG_DATA_HOME:-$HOME/.local/share}/uzbl/ ] && cookie_data=${XDG_DATA_HOME:-$home/.local/share}/uzbl/cookies.txt || exit 1 - +cookie_config=${XDG_CONFIG_HOME:-${HOME}/.config}/uzbl/cookies +[ "x$cookie_config" = x ] && exit 1 +[ -d "${XDG_DATA_HOME:-${HOME}/.local/share}/uzbl/" ] &&\ +cookie_data=${XDG_DATA_HOME:-${HOME}/.local/share}/uzbl/cookies.txt || exit 1 notifier= #notifier=notify-send @@ -60,24 +62,24 @@ field_name= field_value= field_exp='end_session' -function notify () { +notify() { [ -n "$notifier" ] && $notifier "$@" } # FOR NOW LETS KEEP IT SIMPLE AND JUST ALWAYS PUT AND ALWAYS GET -function parse_cookie () { +parse_cookie() { IFS=$';' first_pair=1 for pair in $cookie do - if [ "$first_pair" == 1 ] + if [ "x$first_pair" = x1 ] then field_name=${pair%%=*} field_value=${pair#*=} first_pair=0 else - read -r pair <<< "$pair" #strip leading/trailing wite space + echo "$pair" | read -r pair #strip leading/trailing wite space key=${pair%%=*} val=${pair#*=} [ "$key" == expires ] && field_exp=`date -u -d "$val" +'%s'` @@ -89,7 +91,7 @@ function parse_cookie () { } # match cookies in cookies.txt against hostname and path -function get_cookie () { +get_cookie() { path_esc=${path//\//\\/} search="^[^\t]*$host\t[^\t]*\t$path_esc" cookie=`awk "/$search/" $cookie_data 2>/dev/null | tail -n 1` @@ -99,13 +101,15 @@ function get_cookie () { false else notify "Get_cookie: search: $search in $cookie_data -> result: $cookie" - read domain alow_read_other_subdomains path http_required expiration name value <<< "$cookie" + echo "$cookie" | \ + read domain alow_read_other_subdomains path http_required expiration name \ + value; cookie="$name=$value" true fi } -function save_cookie () { +save_cookie() { if parse_cookie then data="$field_domain\tFALSE\t$field_path\tFALSE\t$field_exp\t$field_name\t$field_value" @@ -116,8 +120,8 @@ function save_cookie () { fi } -[ $action == PUT ] && save_cookie -[ $action == GET ] && get_cookie && echo "$cookie" +[ "x$action" = xPUT ] && save_cookie +[ "x$action" = xGET ] && get_cookie && echo "$cookie" exit @@ -125,25 +129,32 @@ exit # TODO: implement this later. # $1 = section (TRUSTED or DENY) # $2 =url -function match () { +match() { sed -n "/$1/,/^\$/p" $cookie_config 2>/dev/null | grep -q "^$host" } -function fetch_cookie () { +fetch_cookie() { cookie=`cat $cookie_data` } -function store_cookie () { +store_cookie() { echo $cookie > $cookie_data } if match TRUSTED $host then - [ $action == PUT ] && store_cookie $host - [ $action == GET ] && fetch_cookie && echo "$cookie" + [ "x$action" = xPUT ] && store_cookie $host + [ "x$action" = xGET ] && fetch_cookie && echo "$cookie" elif ! match DENY $host then - [ $action == PUT ] && cookie=`zenity --entry --title 'Uzbl Cookie handler' --text "Accept this cookie from $host ?" --entry-text="$cookie"` && store_cookie $host - [ $action == GET ] && fetch_cookie && cookie=`zenity --entry --title 'Uzbl Cookie handler' --text "Submit this cookie to $host ?" --entry-text="$cookie"` && echo $cookie + [ "x$action" = xPUT ] && \ + cookie=`zenity --entry --title 'Uzbl Cookie handler' \ + --text "Accept this cookie from $host ?" --entry-text="$cookie"` \ + && store_cookie $host + + [ "x$action" = xGET ] && fetch_cookie \ + && cookie=`zenity --entry --title 'Uzbl Cookie handler' \ + --text "Submit this cookie to $host ?" --entry-text="$cookie"` \ + && echo $cookie fi exit 0 diff --git a/examples/data/uzbl/scripts/history.sh b/examples/data/uzbl/scripts/history.sh index ccc6b40..d726f9c 100755 --- a/examples/data/uzbl/scripts/history.sh +++ b/examples/data/uzbl/scripts/history.sh @@ -1,5 +1,6 @@ -#!/bin/bash +#!/bin/sh #TODO: strip 'http://' part + file=${XDG_DATA_HOME:-$HOME/.local/share}/uzbl/history [ -d `dirname $file` ] || exit 1 echo "$8 $6 $7" >> $file diff --git a/examples/data/uzbl/scripts/insert_bookmark.sh b/examples/data/uzbl/scripts/insert_bookmark.sh index 23c0d31..e04e6d4 100755 --- a/examples/data/uzbl/scripts/insert_bookmark.sh +++ b/examples/data/uzbl/scripts/insert_bookmark.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh [ -d "${XDG_DATA_HOME:-$HOME/.local/share}/uzbl" ] || exit 1 file=${XDG_DATA_HOME:-$HOME/.local/share}/uzbl/bookmarks @@ -6,7 +6,8 @@ file=${XDG_DATA_HOME:-$HOME/.local/share}/uzbl/bookmarks which zenity &>/dev/null || exit 2 entry=`zenity --entry --text="Add bookmark. add tags after the '\t', separated by spaces" --entry-text="$6 $7\t"` -url=`awk '{print $1}' <<< $entry` +url=`echo $entry | awk '{print $1}'` + # TODO: check if already exists, if so, and tags are different: ask if you want to replace tags echo "$entry" >/dev/null #for some reason we need this.. don't ask me why echo -e "$entry" >> $file diff --git a/examples/data/uzbl/scripts/load_url_from_history.sh b/examples/data/uzbl/scripts/load_url_from_history.sh index 57d634a..f207837 100755 --- a/examples/data/uzbl/scripts/load_url_from_history.sh +++ b/examples/data/uzbl/scripts/load_url_from_history.sh @@ -1,11 +1,12 @@ -#!/bin/bash +#!/bin/sh + history_file=${XDG_DATA_HOME:-$HOME/.local/share}/uzbl/history [ -r "$history_file" ] || exit 1 # choose from all entries, sorted and uniqued # goto=`awk '{print $3}' $history_file | sort -u | dmenu -i` COLORS=" -nb #303030 -nf khaki -sb #CCFFAA -sf #303030" -if dmenu --help 2>&1 | grep -q '\[-rs\] \[-ni\] \[-nl\] \[-xs\]' +if dmenu --help 2>&1 | grep -q '\[-rs\] \[-ni\] \[-nl\] \[-xs\]'; then DMENU="dmenu -i -xs -rs -l 10" # vertical patch # choose an item in reverse order, showing also the date and page titles @@ -14,7 +15,9 @@ then else DMENU="dmenu -i" # choose from all entries (no date or title), the first one being current url, and after that all others, sorted and uniqued, in ascending order - current=`tail -n 1 $history_file | awk '{print $3}'`; goto=`(echo $current; awk '{print $3}' $history_file | grep -v "^$current\$" | sort -u) | $DMENU $COLORS` + current=`tail -n 1 $history_file | awk '{print $3}'`; + goto=`(echo $current; awk '{print $3}' $history_file | grep -v "^$current\$" \ + | sort -u) | $DMENU $COLORS` fi [ -n "$goto" ] && echo "uri $goto" > $4 diff --git a/examples/data/uzbl/scripts/session.sh b/examples/data/uzbl/scripts/session.sh index 4dbae55..4f1e045 100755 --- a/examples/data/uzbl/scripts/session.sh +++ b/examples/data/uzbl/scripts/session.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # Very simple session manager for uzbl. When called with "endsession" as the # argument, it'll backup $sessionfile, look for fifos in $fifodir and @@ -26,7 +26,7 @@ fi case $act in "launch" ) - urls=$(cat $sessionfile) + urls=`cat $sessionfile` if [ "$urls." = "." ]; then $UZBL else diff --git a/examples/data/uzbl/scripts/yank.sh b/examples/data/uzbl/scripts/yank.sh index ee140c7..ddd0a4b 100755 --- a/examples/data/uzbl/scripts/yank.sh +++ b/examples/data/uzbl/scripts/yank.sh @@ -1,3 +1,4 @@ +#!/bin/sh # use this script to pipe any variable to xclip, so you have it in your clipboard # in your uzbl config, make the first argument the number of the (later) argument you want to use (see README for list of args) # make the 2nd argument one of : primary, secondary, clipboard. @@ -5,8 +6,10 @@ # bind yurl = spawn ./examples/scripts/yank.sh 6 primary # bind ytitle = spawn ./examples/scripts/yank.sh 7 clipboard +clip=xclip + which xclip &>/dev/null || exit 1 -[ "$9" == primary -o "$9" == secondary -o "$9" == clipboard ] || exit 2 +[ "x$9" = xprimary -o "x$9" = xsecondary -o "x$9" = xclipboard ] || exit 2 -echo echo -n "${!8}" '|' xclip -selection $9 -echo -n "${!8}" | xclip -selection $9 +echo "echo -n '${8}' | $clip -selection $9" +echo -n "'${8}' | $clip -selection $9" -- cgit v1.2.3 From 5db19767e101d78ee9201f01d063e43c6697dd85 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Tue, 14 Jul 2009 22:14:27 +0200 Subject: update authors file --- AUTHORS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index e9b97a9..4ebb255 100644 --- a/AUTHORS +++ b/AUTHORS @@ -24,7 +24,7 @@ Contributors: Tom Adams (holizz) - few patches, cookies.py, gtkplug/socket & proof of concept uzbl_tabbed.py neutralinsomniac - load_progress = 0 fix Maximilian Gaß (mxey) - several small patches - Abel Camarillo (00z) - make it compile on OpenBSD + Abel Camarillo (00z) - various portability fixes, such as BSD fixes for Makefile and posix shell scripts (israellevin) - toggle_zoom_type (kmeaw) - fix for multibyte utf8 characters segfault (evocallaghan) - tiny patches -- cgit v1.2.3