-
Notifications
You must be signed in to change notification settings - Fork 17
/
gprof.sh
46 lines (45 loc) · 1.3 KB
/
gprof.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
_patch_help() {
_patch_help_run_man $@ | \
gawk 'BEGIN {
split("", LINES)
NUM = 0
}
{
NUM = NUM + 1
LINES[NUM] = $0
}
END {
for (i = 1; i <= NUM; i++) {
line = LINES[i]
if (match(line, /^OPTIONS/)) {
isOptionZone = 1
} else if (match(line, /^[A-Z]/)) {
isOptionZone = 0
}
if (isOptionZone == 1) {
if (match(line, /^\s*"-\S.*"$/)) {
gsub(/"/, "", line)
if (optionLine == "") {
optionLine = line
} else {
optionLine = optionLine ", " trim(line)
}
} else {
print optionLine
optionLine = ""
print line
}
} else {
print line
}
}
}
function trim(input) {
gsub(/^[[:space:]]+|[[:space:]]+$/,"", input)
return input
}
'
}
_patch_table() {
_patch_table_edit_arguments ';;' 'image-file' 'profile-file...'
}