]>
git.proxmox.com Git - mirror_frr.git/blob - tools/convert-fixedwidth.sh
2 # This script converts nonstandard fixed-width integer types found in FRR to
4 USAGE
="./$(basename "$0")"
5 USAGE
+=$
' <src-path> -- convert nonstandard fixed-width integer types found in FRR to C99 standard types\n'
6 USAGE
+=$
'<src-path> - a directory containing C source, or a C source file\n'
14 if [[ -d $FRRTREE ]]; then
15 SOURCES
=$
(find $FRRTREE -type f
-name '*.[ch]')
16 elif [[ -f $FRRTREE ]]; then
24 printf "%s" "$SOURCES" |
while read line
; do
25 printf "Processing $line "
26 sed -i -e 's/u_int\([0-9]\{1,3\}\)_t/uint\1_t/g' $line
28 sed -i -e 's/\([^a-z_]\)u_char\([^a-z_]\|$\)/\1uint8_t\2/g' $line
30 sed -i -e 's/\([^a-z_]\)u_short\([^a-z_]\|$\)/\1unsigned short\2/g' $line
32 sed -i -e 's/\([^a-z_]\)u_int\([^a-z_]\|$\)/\1unsigned int\2/g' $line
34 sed -i -e 's/\([^a-z_]\)u_long\([^a-z_]\|$\)/\1unsigned long\2/g' $line
36 sed -i -e 's/^u_char /uint8_t /g' $line
38 sed -i -e 's/^u_short /unsigned short /g' $line
40 sed -i -e 's/^u_int /unsigned int /g' $line
42 sed -i -e 's/^u_long /unsigned long /g' $line