Extract value of C defines directly from command line
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
in
scripts
test
CMakeLists.txt
LICENSE
README.md

README.md

SADVE

Extract value of C defines directly from command line

Prerequisites

  • cmake - required for both building and using
  • bash - min. version 4.0
  • compiler that can be picked up by cmake (also for using, not only building)

Installation

git clone https://github.com/v3l0c1r4pt0r/sadve.git
cd sadve
mkdir -p build && cd build
cmake ..
make
sudo make install

Usage

To get value of define AF_INET, defined in header sys/socket.h, one can call:

sadve -d AF_INET sys/socket.h

Then to learn size of structure sockaddr as defined in sys/socket.h, use:

sadve -s sockaddr sys/socket.h

Full help text:

Usage: /usr/local/bin/sadve [--dec|--hex|--type=T] -d|-s|-u|-t|-e SYMBOL HEADER | -h
        -d, --define  Print final value of preprocessor macro
        -s, --struct  Print total length of struct
        -u, --union   Print total length of union
        -t, --type    Print total length of type
        -e, --enum    Print total length of enum
            --dec     Print value in decimal form (default)
            --hex     Print value in hexadecimal form
            --type=T  Print value in T form, where T is format string as in
                      printf(3)
        -h, --help    Print this help message and exit
        SYMBOL        Symbol which value is to be examined
        HEADER        Header where symbol is defined

License

The program is licensed under GNU GPL v3.