dot

packages and services management
Log | Files | Refs | README

commit d8f72a3955eec75c9bd7cbd77cc90c27b2d4e2df
parent d1b04f435045dd492bfc29e768da54eaf7f2d7f5
Author: Josuah Demangeon <mail@josuah.net>
Date:   Sun, 18 Mar 2018 15:29:55 +0100

proto: generate .h prototypes out of bsd-style(9) .c files

Diffstat:
Mbin/edit | 2++
Mbin/irc | 2+-
Abin/proto | 42++++++++++++++++++++++++++++++++++++++++++
Mbin/xdg-open | 2+-
Muri | 1+
5 files changed, 47 insertions(+), 2 deletions(-)

diff --git a/bin/edit b/bin/edit @@ -6,4 +6,6 @@ # emacs(1)-style input key bindings for everything REPL. This also permit to # change the $EDITOR without reloading the environment variables. +cd "$(dirname "$@")" + exec vim "$@" diff --git a/bin/irc b/bin/irc @@ -14,4 +14,4 @@ fi trap '' INT -exec "$0" "$(find "$HOME/var/tox" "$HOME/var/irc" -mindepth 1 -type d | iomenu)" +exec "$0" "$(find "$HOME/var/tox" "$HOME/var/irc" -type d | iomenu)" diff --git a/bin/proto b/bin/proto @@ -0,0 +1,42 @@ +#!/usr/bin/awk -f + +# generate .h prototypes out of a .c file with tabs for alignment + +function print_tabs(len) +{ + for (n = 2 - len / 8; n > 0; n--) + printf("\t"); +} + +/^[a-z0-9_]*\(/ { + if (match(type, "static") || match($0, ";$")) + next; + + ptr = type; + if (sub(" *[*]+", "", type)) + gsub("[^*]", "", ptr); + else + ptr = " "; + + printf("%s", type); + print_tabs(length(type)); + printf("%s", ptr); + + symbol = $0; + sub("\\(.*", "", symbol); + sub("[a-z0-9_]*\\(", "("); + + printf("%s", symbol); + print_tabs((length(symbol) + length(ptr))); + + gsub("[*][a-z0-9_]+,", "*,"); + gsub("[*][a-z0-9_]+)", "*)"); + gsub("[ ][a-z0-9_]+,", ","); + gsub("[ ][a-z0-9_]+)", ")"); + + printf("%s;\n", $0); +} + +{ + type = $0; +} diff --git a/bin/xdg-open b/bin/xdg-open @@ -4,7 +4,7 @@ [ "$DISPLAY" ] && case "$(tty)" in (/dev/pts/*) ;; -(*) st -f terminus:pixelsize=16 -e "$0" "$@" ;; +(*) exec st -f terminus:pixelsize=16 -e "$0" "$@" ;; esac [ -h "$1" ] && set -- "$(readlink -f "$1")" diff --git a/uri b/uri @@ -1,6 +1,7 @@ 9p://9p.io git://github.com/ReturnInfinity/BareMetal-kernel git://github.com/cjdelisle/cjdns +git://github.com/cjdelisle/cjdns git://github.com/jercos/cjdns git://github.com/netsukuku/netsukuku gopher://bitreich.org