commit: d3adbd69181a943d6b7d096391bf42a38f1a66de
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Fri, 3 Mar 2017 18:46:40 +0100
Initial Commit
Diffstat:
4 files changed, 76 insertions(+), 0 deletions(-)
diff --git a/argc.c b/argc.c
@@ -0,0 +1,4 @@
+#include <stdio.h>
+int main(int argc, char *argv[]) {
+ printf("%s: %i\n", argv[0], argc);
+}
diff --git a/build.sh b/build.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+set -x
+for i in *.c; do ${CC:-cc} $i ${CFLAGS:--Wall} -o ${i%.c}; done
diff --git a/range.c b/range.c
@@ -0,0 +1,30 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+char *IFS;
+int a, b;
+
+void usage(char *a0) {
+ printf("usage: %s [ini <max>]\n", a0);
+}
+
+void range(int initial, int maximum) {
+ printf("%i", initial);
+ for(initial++; initial<=maximum; initial++) {
+ printf("%s%i", IFS, initial);
+ }
+}
+
+int main(int argc, char *argv[]){
+ if(!(IFS = getenv("IFS"))) {
+ IFS = " ";
+ }
+
+ if (argc == 2) {
+ range(0, atoi(argv[1]));
+ } else if(argc == 3) {
+ range(atoi(argv[1]), atoi(argv[2]));
+ } else {
+ usage(argv[0]);
+ }
+}
diff --git a/timey-whyme.sh b/timey-whyme.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+xdd="${XDG_DATA_DIR:-$HOME/.local/share}/timey-whyme"
+today=$(date +%Y-%m-%d)
+heading='\t[1;32m%s[0m\n'
+highlight='[1;34m%s[0m'
+form="column -s, -t -o "
+
+usage() {
+ printf "Usage:\n"
+ printf "$0 calendar <year> <month> <day>\n"
+ printf "\t output calendar for given time\n"
+ printf "$0 todo <year> <month> <day>\n"
+ printf "\t output todo for given time\n"
+}
+
+todo() {
+ printf $heading 'To Do List'
+ printf $highlight $(grep "^$today" $xdd/todo.csv | $form)
+ grep -E -v "^(#|$today)" $xdd/todo.csv | $form
+}
+
+calendar() {
+ printf $heading 'Calendar'
+ printf $highlight $(grep "(^$today|;$today)" $xdd/calendar.csv | $form)
+ grep -E -v "^(#|;?$today)" $xdd/calendar.csv | $form
+}
+
+case "$1" in
+ todo*)
+ todo
+ ;;
+ cal*)
+ calendar
+ ;;
+ *)
+ usage
+ ;;
+esac