Files
gsmartcontrol/file2csource.sh
T
Alexander Shaduri a6f5ad018f Tagging 0.8.3:
A random "Smartctl returned an empty output" error on Windows was fixed.
        Thanks to Zurab Khetsuriani for testing.
    Fixed a parser issue which prevented running self-tests in Windows.
    The supplied icon (hopefully) shows correctly in Windows 2000 now.
    This release adds an official support for Windows 2000 SP4.
    Added scripts to allow GSmartControl to read smartctl data from
        cron-generated files. This allows users to read somewhat recent
        smartctl information without having to run GSmartControl as root.
        Generously contributed by Alex Butcher <alex dot butcher 'at'
        assursys.co.uk>.
    Configure script correctly aborts instead of printing a warning if gtkmm
        or libglademm (if needed) is not found.
    Configure script now accepts --enable-windows-console,
        --disable-abort-if-no-gtkmm, --disable-abort-if-no-glade-reader,
        as well as Windows-supporting "auto" for --enable-nsis-wine and
        --with-nsis.
    Configure's --with-win32-env has been renamed to --with-windows-dlls.
    The "About" dialog shows version information now.
    Minor bugs were fixed.
2010-12-26 19:40:44 +00:00

51 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
############################################################################
# Copyright:
# (C) 2008 Alexander Shaduri <ashaduri 'at' gmail.com>
# License: See LICENSE_zlib.txt file
############################################################################
# We use #!/bin/bash of #!/bin/sh because freebsd (tested with 6.3) in its
# infinite wisdom has csh-like /bin/sh (even though the SUS says it
# must be bourne-compatible).
if [ "$1" == "" ] | [ "$2" == "" ] | [ "$3" == "" ]; then
echo "Usage: $0 <input_file> <cpp_file> <symbol_name>";
exit 1;
fi
if [ ! -e $1 ]; then
echo "Cannot open input file \"$1\".";
exit 2;
fi
in_file="$1";
out_file="$2";
sym_name="$3";
size=`stat -c "%s" "$in_file"`
# header. extern means "global" in this context (needed because const
# variables are static by default).
echo "
extern const unsigned char ${sym_name}[] = {
" > "$out_file";
# file binary. "xxd(1) -i" can also do the trick
hexdump -v -e '1/1 "0x%X,\n"' "$in_file" >> "$out_file";
# footer. add 0x0 byte for easy stringifying
echo "
0x0 };
extern const unsigned int ${sym_name}_size = ${size};
" >> "$out_file";