commit 5896a2880c8fcb2ca02e70eef40d18b99b68dca6
parent f69e4c578dc97d44c8a7efc7dbeb956e97307b31
Author: Josuah Demangeon <mail@josuah.net>
Date: Mon, 6 Aug 2018 22:19:52 +0200
add dependencies
Diffstat:
7 files changed, 73 insertions(+), 61 deletions(-)
diff --git a/bin/ics2txt b/bin/ics2txt
@@ -44,7 +44,10 @@ function date_ical(str, offset) {
day = substr(str, 7, 2);
hrs = substr(str, 10, 2);
min = substr(str, 12, 2);
- return to_sec(yrs, mth, day, hrs, min, 0) - offset;
+ if (substr(str, 16, 1) == "Z")
+ return to_sec(yrs, mth, day, hrs, min, 0);
+ else
+ return to_sec(yrs, mth, day, hrs, min, 0) - offset;
}
function date_iso8601(date, offset)
@@ -148,7 +151,7 @@ function txt(offset)
nb = parse_ical(list, offset);
for (i = 1; i <= nb; i++) {
split(list[i], arr, "\t");
- txt_one(arr[1], arr[2], arr[3], arr[4], arr[5], arr[6]);
+ txt_one(arr[1], arr[2], arr[3], arr[4], arr[5], arr[6], offset);
}
}
@@ -166,9 +169,13 @@ function usage()
}
BEGIN {
- #"date +%z" | getline offset;
- #close("date +%z");
- offset = 0; #substr(offset, 1, 3) * 3600;
+ "date +%z" | getline offset_str;
+ close("date +%z");
+
+ offset = substr(offset_str, 2, 2) * 3600;
+ offset += substr(offset_str, 4, 2) * 60;
+ if (substr(offset_str, 1, 1) == "-")
+ offset *= -1;
if (ARGV[1] == "txt") {
ARGV[1] = ARGV[--ARGC];
diff --git a/bin/m b/bin/m
@@ -1,64 +1,62 @@
#!/bin/sh
-FORMAT='\n%c%4n %i%s\n %t%u %i%D %f'
+FORMAT='\n%c%4n %i%s\n %t%u %i%D %40f'
+MAILDIR=${MAILDIR:-$HOME/mail}
-while printf 'mail> '
- read cmd args
-do
- set -- $args
- case "${cmd#-}" in
- (h)
- mdirs "$HOME/mail" | while read -r dir
- do printf '\n %s\n' "$(basename "$dir")" | tr a-z A-Z
- printf ' --------------------------------------------------\n'
- mlist -t "$dir" | msort -d | mthread | mseq -S |
- mscan -f "$FORMAT"
- done 2>/dev/null | less
- ;;
- (p)
- mshow "$@"
- ;;
- (v)
- FILE="$(mktemp /tmp/html_mail.XXXXXXXXXXXXXXX)"
- mv "$FILE" "${FILE}.html"
- FILE="${FILE}.html"
- mshow -O $1 $(mshow -t $1 | awk -F ':' '/html/ {print $1 }')> "$FILE"
- links "$FILE"
- rm "$FILE"
- ;;
- (s)
- mflag -S "$@"
- ;;
- (d)
- mflag -T "$@"
- ;;
- (r)
- mrep "$@"
- ;;
- (n)
- mcom "$@"
- ;;
- (l)
- test "$#" -eq 1 && LIMIT=$1 || LIMIT=10
- mdirs "$HOME/mail" | mlist | msort -d | mthread | tail -n $LIMIT | mseq -S |
- mscan -f "$FORMAT"
- ;;
- (u)
- mbsync -aq
- exec "$0" scan
- ;;
+test "$#" = 0 && while printf '> '; read argv; do "$0" $argv; done
- (m)
- printf '
+cmd=${1#-}
+shift
+
+case "$cmd" in
+(h)
+ mlist "$MAILDIR/${1:-INBOX}" | msort -rd | mthread -v | mseq -S |
+ mscan -f "$FORMAT"
+ ;;
+(p)
+ mshow "$@"
+ ;;
+(v)
+ FILE="$(mktemp /tmp/html_mail.XXXXXXXXXXXXXXX)"
+ mv "$FILE" "${FILE}.html"
+ FILE="${FILE}.html"
+ mshow -O $1 $(mshow -t $1 | awk -F ':' '/html/ {print $1 }')> "$FILE"
+ links "$FILE"
+ rm "$FILE"
+ ;;
+(r)
+ mrep "$@"
+ ;;
+(w)
+ mcom "$@"
+ ;;
+(l)
+ find "$MAILDIR" -type d |
+ sed -r 's,^/,,; /\/(new|cur|tmp)$/d; s,[^/]*/, ,g'
+ ;;
+(u)
+ mbsync -aq
+ exec "$0" scan
+ ;;
+(s)
+ mflag -S "$@"
+ ;;
+(d)
+ mflag -T "$@"
+ ;;
+(f)
+ mfilter "$MAILDIR"
+ ;;
+(*)
+ printf '
\033[1m Display mail \033[m
h summarize the headers of the mail in a list
p print the current or specified mail
- t print the current or specified mail as a thread
v view the html version with links
- l print 10 or as specified lasts mails
+ l list available directories
\033[1m Exchange mail\033[m
- n write a new mail
+ w write a new mail
r reply to current or specified mail
u update the local mail from the server
@@ -67,6 +65,5 @@ do
d mark mail as deleted
f filter mails again
-' ;;
- esac
-done
+' ;;
+esac
diff --git a/data/todo.txt b/data/todo.txt
@@ -1,2 +1,3 @@
-pacmanedit(1)
-https://github.com/c00kiemon5ter/iii/blob/master/iii.sh
+[ ] pacmanedit(1)
+
+[ ] https://github.com/c00kiemon5ter/iii/blob/master/iii.sh
diff --git a/pack/execline/dep b/pack/execline/dep
@@ -1 +1,2 @@
gmake
+libskarnet
diff --git a/pack/s6-dns/dep b/pack/s6-dns/dep
@@ -1 +1,3 @@
gmake
+s6
+libskarnet
diff --git a/pack/s6-networking/dep b/pack/s6-networking/dep
@@ -1 +1,3 @@
gmake
+libskarnet
+s6-dns
diff --git a/pack/s6/dep b/pack/s6/dep
@@ -1 +1,3 @@
gmake
+execline
+libskarnet