9ns: Align struct dirtab to 64 bytes
[akaros.git] / scripts / make_errlist.sh
1 #!/bin/bash
2
3 ERRLIST="tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/errlist.c"
4 ERRNO_FILE="kern/include/ros/errno.h"
5
6 echo "// This was automatically generated with make_errlist.sh, do not edit" > $ERRLIST
7 echo ""                                   >> $ERRLIST
8 echo "#include <stddef.h>"                >> $ERRLIST
9 echo ""                                   >> $ERRLIST
10 echo "const char *const _sys_errlist[] =" >> $ERRLIST
11 echo "{"                                  >> $ERRLIST
12
13 # here's the guts of it.  Get the #define E's, compress the extra tabs, cut to
14 # get from the numbers to the end, remove the aliases (number is EWHATEVER),
15 # then awk it.  The awk script does some fancy formatting.  NF is the number of
16 # items on the line.  The last item on the line is */, which we never print.
17 # The second to last is printed without a trailing space.
18
19 cat $ERRNO_FILE | ./scripts/parse_errno.sh >> $ERRLIST
20
21 echo "};"                                 >> $ERRLIST
22 echo ""                                   >> $ERRLIST
23 echo "const int _sys_nerr = sizeof (_sys_errlist) / sizeof (_sys_errlist[0]);" >> $ERRLIST
24 echo ""                                   >> $ERRLIST
25 echo "strong_alias(_sys_errlist,_sys_errlist_internal);"                       >> $ERRLIST
26 echo "strong_alias(_sys_nerr,_sys_nerr_internal);"                             >> $ERRLIST