summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xchoose9
-rw-r--r--urigetline.c2
2 files changed, 10 insertions, 1 deletions
diff --git a/choose b/choose
index 763c71c..aa191e7 100755
--- a/choose
+++ b/choose
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/env bash
### this script is meant to take a \n delimited list of things
### then give the user a way of selecting on of them.
### it should output the selection on a line by itself.
@@ -11,6 +11,13 @@ if [ "$1" ];then
else
prompt="< $0 >"
fi
+
+if [ "${prompt}" != "${prompt:0:64}" ];then
+ prompt="${prompt:0:64}..."
+else
+ prompt="${prompt}"
+fi
+
if [ $DISPLAY ];then
#usage: dmenu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]
# [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]
diff --git a/urigetline.c b/urigetline.c
index 4c5c7b4..92b4de7 100644
--- a/urigetline.c
+++ b/urigetline.c
@@ -80,6 +80,7 @@ int main(int argc,char *argv[]) {//argument needs to be the URI
rule=MATCH_PATTERN;
j=0;
switch(a[0]) {
+ case 0: j=1; goto match; break;
case '-': j=1; rule=MATCH_PATTERN; break;
case 'n': j=1; rule=MATCH_UNEXIST; break;
case 'r': j=1; rule=MATCH_REVERSE; break;
@@ -120,6 +121,7 @@ int main(int argc,char *argv[]) {//argument needs to be the URI
a=c;
}
if(matches) {
+match:
//printf("comm: %s\n",command);
printf("%s\n",command);
if(!all) return ret;//bail early if we only need first match