error: Strip trailing '\n' from error string arguments (again)
[qemu/ar7.git] / scripts / update-mips-syscall-args.sh
blob4f0dda4b83bcd3ce1136d008abf72053418a7329
1 #!/bin/sh
3 URL=https://raw.githubusercontent.com/strace/strace/master
4 FILES="sysent.h sysent_shorthand_defs.h linux/mips/syscallent-compat.h \
5 linux/mips/syscallent-o32.h linux/syscallent-common-32.h \
6 linux/syscallent-common.h"
8 output="$1"
9 if [ "$output" = "" ] ; then
10 output="$PWD"
13 INC=linux-user/mips/syscall-args-o32.c.inc
15 TMP=$(mktemp -d)
16 cd $TMP
18 for file in $FILES; do
19 curl -O $URL/$file
20 done
22 > subcall32.h
24 cat > gen_mips_o32.c <<EOF
25 #include <stdio.h>
27 #define LINUX_MIPSO32
28 #define MAX_ARGS 7
30 #include "sysent.h"
31 #include "sysent_shorthand_defs.h"
33 #define SEN(syscall_name) 0,0
34 const struct_sysent sysent0[] = {
35 #include "syscallent-o32.h"
38 int main(void)
40 int i;
42 for (i = 4000; i < sizeof(sysent0) / sizeof(struct_sysent); i++) {
43 if (sysent0[i].sys_name == NULL) {
44 printf(" [% 4d] = MIPS_SYSCALL_NUMBER_UNUSED,\n", i - 4000);
45 } else {
46 printf(" [% 4d] = %d, /* %s */\n", i - 4000,
47 sysent0[i].nargs, sysent0[i].sys_name);
51 return 0;
53 EOF
55 cc -o gen_mips_o32 gen_mips_o32.c && ./gen_mips_o32 > "$output/$INC"
57 rm -fr "$TMP"