From 044703c31995dd8a0e745c55384ce45a3ccc3bef Mon Sep 17 00:00:00 2001 From: mrbesen Date: Wed, 29 Apr 2020 12:59:38 +0200 Subject: [PATCH] add fixincludes --- README.md | 2 +- fixincludes.sh | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) mode change 100644 => 100755 README.md create mode 100755 fixincludes.sh diff --git a/README.md b/README.md old mode 100644 new mode 100755 index 8897e27..26f1706 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ A Collection of some "useful" scripts |------|---------|------------| |```downloadhelper.sh``` | download anc convert Youtube Videos or Soundcloud Songs | Youtube-DL & ffmpeg |```fixcam.sh``` |remove " (1)" from all files inside a folder| | +|```fixincludes.sh```| fixes wrong includes. Takes a Folder of c/c++ Code and corrects the includes, that are not case sensitive (local includes only) | sed, awk, bash | |```kvm.sh``` |start a kvm| kvm | |```load.sh``` |download a bunch of sequentialy numbered files| wget | |```m3u8append.sh``` | takes a m3u8 playlist, removes comments (lines starting with '#') and addes a line in front of every other line. Saves the output to a difrent file. | | @@ -16,4 +17,3 @@ A Collection of some "useful" scripts |```timelapse.sh```| a script to create timelapses with a webcam | imagemagick, ffmpeg & streamer | |```setup.sh```| a script that installs all my useful tools, after i reinstalled my Operating System - BE CAREFUL! | fstab | - diff --git a/fixincludes.sh b/fixincludes.sh new file mode 100755 index 0000000..0e806bf --- /dev/null +++ b/fixincludes.sh @@ -0,0 +1,19 @@ +#!/bin/bash +#small script, that fixes wrong includes (case insensitive to case sensitive) from windows sourcecode +#requires: sed, awk, bash + +sedfile="includes.sed" +srcf="src/" + +echo "generate sedfile" +ls ${srcf}*.h | cut -d "/" -f 2 | awk '{print "s/#include \"" $0 "\"/#include \"" $0 "\"/Ig"}' > "$sedfile" + +#anwenden +for f in ${srcf}*; do + echo "fix includes for: $f" + sed -Ef $sedfile "$f" > "$f.fixed" + mv "$f.fixed" "$f" +done + +echo "delete sedfile" +rm $sedfile