mirror of
https://github.com/darlinghq/darling.git
synced 2024-11-23 04:09:43 +00:00
5f96f6c7fb
This makes it easy to add the folder to PATH and run commands
28 lines
317 B
Bash
Executable File
28 lines
317 B
Bash
Executable File
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
cfile=/tmp/offsetof.$$.c
|
|
include="$1"
|
|
struct="$2"
|
|
member="$3"
|
|
|
|
cat > $cfile <<END
|
|
#include <stdio.h>
|
|
#include <stddef.h>
|
|
#include <$include>
|
|
|
|
int main()
|
|
{
|
|
printf("offsetof($struct, $member)=%d\n", offsetof($struct, $member));
|
|
return 0;
|
|
}
|
|
|
|
END
|
|
|
|
gcc -w $cfile -o $cfile.bin
|
|
$cfile.bin
|
|
|
|
rm $cfile*
|
|
|