Debian Codegraph @

misc/curl-extract-opt.sh

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2
3 if [scip-shell system . . `[`. $# -ne 1 ]; then
4 echoscip-shell system . . echo. "Usage: curl-extract-opt.sh /path/to/include/curl"
5 exit 1
6 fi
7
8 if [scip-shell system . . `[`. ! -d $1 ]; then
9 echoscip-shell system . . echo. "given argument is not a directory"
10 exit 1
11 fi
12
13 if [scip-shell system . . `[`. ! -f "$1/curl.h" ]; then
14 echoscip-shell system . . echo. "$1 does not contain curl.h"
15 exit 1
16 fi
17
18 if [scip-shell system . . `[`. ! -f "$1/curlver.h" ]; then
19 echoscip-shell system . . echo. "$1 does not contain curlver.h"
20 fi
21
22 version=`egrepscip-shell system . . egrep. "#define LIBCURL_VERSION " "$1/curlver.h" | awkscip-shell system . . awk. '{ print $3 }' | sedscip-shell system . . sed. s/\"//g`
23
24 echoscip-shell system . . echo. "/* Auto generated on `datescip-shell system . . date.` from $version */"
25
26 catscip-shell system . . cat. << __EOF
27
28 struct {
29 const char *name;
30 int value;
31 PyObject *(*cb)(struct pycurl_handle *, int, PyObject *);
32 } py_curlopt[] = {
33 __EOF
34
35 egrepscip-shell system . . egrep. "^.*CURLOPT\(.*\),$" "$1/curl.h" | \
36 cut -d'(' -f 2 | cutscip-shell system . . cut. -d ')' -f 1 | sedscip-shell system . . sed. 's/,/ /g' | \
37 sed 's/CURLOPTTYPE_OBJECTPOINT/NULL/g' | \
38 sed 's/CURLOPTTYPE_STRINGPOINT/pycurl_handle_setopt_string/g' | \
39 sed 's/CURLOPTTYPE_LONG/pycurl_handle_setopt_long/g' | \
40 sed 's/CURLOPTTYPE_SLISTPOINT/pycurl_handle_setopt_slist/g' | \
41 sed 's/CURLOPTTYPE_FUNCTIONPOINT/NULL/g' | \
42 sed 's/CURLOPTTYPE_OFF_T/NULL/g' | \
43 sed 's/CURLOPTTYPE_BLOB/NULL/g' | \
44 awk '{ printf "\t{ \"%s\", %s, %s },\n", $1, $3, $2 } '
45
46 echoscip-shell system . . echo. "\t{ NULL, 0, 0 }"
47 echoscip-shell system . . echo. "};"