Skip to content
Snippets Groups Projects
Commit ce4c1cf8 authored by ballen4705's avatar ballen4705
Browse files

A useful script to see if print statments match their arguments.

I'll delete it from the directory, but you can find it in the ATTIC!


git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@166 4ea69e1a-61f1-4043-bf83-b5c94c648137
parent 0ac969a6
No related branches found
No related tags found
No related merge requests found
#! /bin/bash
# This is a useful little script for debugging print statements.
# The point is that since we use our own varargs print function,
# the poor compiler can't check to see for example if there is agreement
# between the numbers of arguments and format flags.
# Running this script replaces the different printout() and pout() statments
# with 100% genuine printfs. A few seconds of hand editing to eliminate the
# original defs, and you can get compiler warning messages.
# Note: use this script in a COPY of your working directory. Else it will
# trash stuff. Use ./findbadprint to go one way, ./findbadprint Q to restore
# the files as they were.
restore () {
mv $1.save $1
}
hackfile () {
# first arg filename
cp $1 $1.save
cat $1.save | sed 's/printout(LOG_INFO,/printf(/g' \
| sed 's/printout(LOG_CRIT,/printf(/g' \
| sed 's/pout(/printf(/g' > $1
}
if [ $# -eq 0 ] ; then
hackfile smartd.c
hackfile atacmds.c
hackfile ataprint.c
hackfile smartctl.c
else
restore smartd.c
restore atacmds.c
restore ataprint.c
restore smartctl.c
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment