aboutsummaryrefslogtreecommitdiff
path: root/conv
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-06-07 01:23:39 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-06-07 01:23:39 +0200
commit10afde33e2d3281c1cd807b978480bef19026351 (patch)
tree7284d907f64c0bccddd5bdb049e0f785c7ff1147 /conv
downloadpatches-10afde33e2d3281c1cd807b978480bef19026351.tar.gz
Add 'sum' and 'conv' utilities
Diffstat (limited to 'conv')
-rwxr-xr-xconv28
1 files changed, 28 insertions, 0 deletions
diff --git a/conv b/conv
new file mode 100755
index 0000000..7d5a508
--- /dev/null
+++ b/conv
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+# conv -- convert git diff -p output to pkgsrc patch
+
+IFS='
+'
+
+echo '$NetBSD'
+echo
+sed '
+ /^diff/d;
+ /^index/d;
+ s/^--- .*/&/;
+' |
+while read line; do
+ case "$line" in
+ diff*) ;;
+ index*) ;;
+ '--- a/'*)
+ file=${line#--- a/}
+ echo -n "--- $file.orig "
+ echo "$(stat -x "$file")" | sed -n 's/^Access: //p' ;;
+ '+++ b/'*)
+ echo "+++ ${line#+++ b/}" ;;
+ *)
+ echo "$line" ;;
+ esac
+done