File: dataseghack

package info (click to toggle)
vgabios 0.7a-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 560 kB
  • sloc: ansic: 8,711; makefile: 84; sh: 18
file content (23 lines) | stat: -rwxr-xr-x 539 bytes parent folder | download | duplicates (34)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash

awk \
  'BEGIN { }\
  /^\.text/,/DATA_SEG_DEFS_HERE/ { print }\
  END { }'\
  $1 > temp.awk.1

awk \
  'BEGIN { i = 0; last = "hello" }\
  /BLOCK_STRINGS_BEGIN/,/^\.bss/ { if ( i > 1 ) { print last } last = $0; i = i + 1 }\
  END { }'\
  $1 > temp.awk.2

awk \
  'BEGIN { }\
  /DATA_SEG_DEFS_HERE/,/BLOCK_STRINGS_BEGIN/ { print }\
  END { }'\
  $1 > temp.awk.3

cp $1 $1.orig
cat temp.awk.1 temp.awk.2 temp.awk.3 | sed -e 's/^\.data//' -e 's/^\.bss//' -e 's/^\.text//' > $1
/bin/rm -f temp.awk.1 temp.awk.2 temp.awk.3 $1.orig