-
Notifications
You must be signed in to change notification settings - Fork 51
/
rel.awk
49 lines (40 loc) · 845 Bytes
/
rel.awk
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
47
48
BEGIN {
if( change <= 0 )
exit -1;
}
/AC_INIT/ {
if( $2 ~ /\)$/ )
{
ver = substr( $2, 0, length( $2 ) - 1 );
tail=")";
}
else
ver = $2;
if( $2 ~ /\]$/ )
{
ver = substr( $2, 0, length( $2 ) - 1 );
tail="]";
}
else
ver = $2;
if( $2 ~ /\,$/ )
{
ver = substr( $2, 0, length( $2 ) - 1 );
tail=",";
}
else
ver = $2;
n = split( ver, ver_array, "." );
while( change > n )
ver_array[ ++n ] = 0;
ver_array[ change ]++;
while( ++change <= n )
ver_array[ change ] = 0;
$2 = "";
for( i = 1; i < n; ++i )
$2 = $2 ver_array[ i ] ".";
$2 = $2 ver_array[ n ];
if( tail )
$2 = $2 tail;
}
{ print $0; }