diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/dns/gnunet-helper-dns.c | 40 | ||||
-rw-r--r-- | src/exit/gnunet-helper-exit.c | 32 | ||||
-rwxr-xr-x | src/pt/gnunet-daemon-pt | 136 |
3 files changed, 158 insertions, 50 deletions
diff --git a/src/dns/gnunet-helper-dns.c b/src/dns/gnunet-helper-dns.c index 56b8713cf..73536c252 100644 --- a/src/dns/gnunet-helper-dns.c +++ b/src/dns/gnunet-helper-dns.c | |||
@@ -95,12 +95,12 @@ struct in6_ifreq | |||
95 | /** | 95 | /** |
96 | * Name and full path of IPTABLES binary. | 96 | * Name and full path of IPTABLES binary. |
97 | */ | 97 | */ |
98 | #define SBIN_IPTABLES "/sbin/iptables" | 98 | static const char *sbin_iptables; |
99 | 99 | ||
100 | /** | 100 | /** |
101 | * Name and full path of IPTABLES binary. | 101 | * Name and full path of IPTABLES binary. |
102 | */ | 102 | */ |
103 | #define SBIN_IP "/sbin/ip" | 103 | static const char *sbin_ip; |
104 | 104 | ||
105 | /** | 105 | /** |
106 | * Port for DNS traffic. | 106 | * Port for DNS traffic. |
@@ -685,19 +685,25 @@ main (int argc, char *const*argv) | |||
685 | } | 685 | } |
686 | 686 | ||
687 | /* verify that the binaries were care about are executable */ | 687 | /* verify that the binaries were care about are executable */ |
688 | if (0 != access (SBIN_IPTABLES, X_OK)) | 688 | if (0 == access ("/sbin/iptables", X_OK)) |
689 | sbin_iptables = "/sbin/iptables"; | ||
690 | else if (0 == access ("/usr/sbin/iptables", X_OK)) | ||
691 | sbin_iptables = "/usr/sbin/iptables"; | ||
692 | else | ||
689 | { | 693 | { |
690 | fprintf (stderr, | 694 | fprintf (stderr, |
691 | "`%s' is not executable: %s\n", | 695 | "Fatal: executable iptables not found in approved directories: %s\n", |
692 | SBIN_IPTABLES, | ||
693 | strerror (errno)); | 696 | strerror (errno)); |
694 | return 3; | 697 | return 3; |
695 | } | 698 | } |
696 | if (0 != access (SBIN_IP, X_OK)) | 699 | if (0 == access ("/sbin/ip", X_OK)) |
700 | sbin_ip = "/sbin/ip"; | ||
701 | else if (0 == access ("/usr/sbin/ip", X_OK)) | ||
702 | sbin_ip = "/usr/sbin/ip"; | ||
703 | else | ||
697 | { | 704 | { |
698 | fprintf (stderr, | 705 | fprintf (stderr, |
699 | "`%s' is not executable: %s\n", | 706 | "Fatal: executable ip not found in approved directories: %s\n", |
700 | SBIN_IP, | ||
701 | strerror (errno)); | 707 | strerror (errno)); |
702 | return 4; | 708 | return 4; |
703 | } | 709 | } |
@@ -825,7 +831,7 @@ main (int argc, char *const*argv) | |||
825 | "udp", "--sport", localport, "--dport", DNS_PORT, "-j", | 831 | "udp", "--sport", localport, "--dport", DNS_PORT, "-j", |
826 | "ACCEPT", NULL | 832 | "ACCEPT", NULL |
827 | }; | 833 | }; |
828 | if (0 != fork_and_exec (SBIN_IPTABLES, mangle_args)) | 834 | if (0 != fork_and_exec (sbin_iptables, mangle_args)) |
829 | goto cleanup_rest; | 835 | goto cleanup_rest; |
830 | } | 836 | } |
831 | /* Mark all of the other DNS traffic using our mark DNS_MARK */ | 837 | /* Mark all of the other DNS traffic using our mark DNS_MARK */ |
@@ -836,7 +842,7 @@ main (int argc, char *const*argv) | |||
836 | "udp", "--dport", DNS_PORT, "-j", "MARK", "--set-mark", DNS_MARK, | 842 | "udp", "--dport", DNS_PORT, "-j", "MARK", "--set-mark", DNS_MARK, |
837 | NULL | 843 | NULL |
838 | }; | 844 | }; |
839 | if (0 != fork_and_exec (SBIN_IPTABLES, mark_args)) | 845 | if (0 != fork_and_exec (sbin_iptables, mark_args)) |
840 | goto cleanup_mangle_1; | 846 | goto cleanup_mangle_1; |
841 | } | 847 | } |
842 | /* Forward all marked DNS traffic to our DNS_TABLE */ | 848 | /* Forward all marked DNS traffic to our DNS_TABLE */ |
@@ -845,7 +851,7 @@ main (int argc, char *const*argv) | |||
845 | { | 851 | { |
846 | "ip", "rule", "add", "fwmark", DNS_MARK, "table", DNS_TABLE, NULL | 852 | "ip", "rule", "add", "fwmark", DNS_MARK, "table", DNS_TABLE, NULL |
847 | }; | 853 | }; |
848 | if (0 != fork_and_exec (SBIN_IP, forward_args)) | 854 | if (0 != fork_and_exec (sbin_ip, forward_args)) |
849 | goto cleanup_mark_2; | 855 | goto cleanup_mark_2; |
850 | } | 856 | } |
851 | /* Finally, add rule in our forwarding table to pass to our virtual interface */ | 857 | /* Finally, add rule in our forwarding table to pass to our virtual interface */ |
@@ -855,7 +861,7 @@ main (int argc, char *const*argv) | |||
855 | "ip", "route", "add", "default", "dev", dev, | 861 | "ip", "route", "add", "default", "dev", dev, |
856 | "table", DNS_TABLE, NULL | 862 | "table", DNS_TABLE, NULL |
857 | }; | 863 | }; |
858 | if (0 != fork_and_exec (SBIN_IP, route_args)) | 864 | if (0 != fork_and_exec (sbin_ip, route_args)) |
859 | goto cleanup_forward_3; | 865 | goto cleanup_forward_3; |
860 | } | 866 | } |
861 | 867 | ||
@@ -910,7 +916,7 @@ main (int argc, char *const*argv) | |||
910 | "ip", "route", "del", "default", "dev", dev, | 916 | "ip", "route", "del", "default", "dev", dev, |
911 | "table", DNS_TABLE, NULL | 917 | "table", DNS_TABLE, NULL |
912 | }; | 918 | }; |
913 | if (0 != fork_and_exec (SBIN_IP, route_clean_args)) | 919 | if (0 != fork_and_exec (sbin_ip, route_clean_args)) |
914 | r += 1; | 920 | r += 1; |
915 | } | 921 | } |
916 | cleanup_forward_3: | 922 | cleanup_forward_3: |
@@ -919,7 +925,7 @@ main (int argc, char *const*argv) | |||
919 | { | 925 | { |
920 | "ip", "rule", "del", "fwmark", DNS_MARK, "table", DNS_TABLE, NULL | 926 | "ip", "rule", "del", "fwmark", DNS_MARK, "table", DNS_TABLE, NULL |
921 | }; | 927 | }; |
922 | if (0 != fork_and_exec (SBIN_IP, forward_clean_args)) | 928 | if (0 != fork_and_exec (sbin_ip, forward_clean_args)) |
923 | r += 2; | 929 | r += 2; |
924 | } | 930 | } |
925 | cleanup_mark_2: | 931 | cleanup_mark_2: |
@@ -929,7 +935,7 @@ main (int argc, char *const*argv) | |||
929 | "iptables", "-t", "mangle", "-D", "OUTPUT", "-p", "udp", | 935 | "iptables", "-t", "mangle", "-D", "OUTPUT", "-p", "udp", |
930 | "--dport", DNS_PORT, "-j", "MARK", "--set-mark", DNS_MARK, NULL | 936 | "--dport", DNS_PORT, "-j", "MARK", "--set-mark", DNS_MARK, NULL |
931 | }; | 937 | }; |
932 | if (0 != fork_and_exec (SBIN_IPTABLES, mark_clean_args)) | 938 | if (0 != fork_and_exec (sbin_iptables, mark_clean_args)) |
933 | r += 4; | 939 | r += 4; |
934 | } | 940 | } |
935 | cleanup_mangle_1: | 941 | cleanup_mangle_1: |
@@ -940,7 +946,7 @@ main (int argc, char *const*argv) | |||
940 | "--sport", localport, "--dport", DNS_PORT, "-j", "ACCEPT", | 946 | "--sport", localport, "--dport", DNS_PORT, "-j", "ACCEPT", |
941 | NULL | 947 | NULL |
942 | }; | 948 | }; |
943 | if (0 != fork_and_exec (SBIN_IPTABLES, mangle_clean_args)) | 949 | if (0 != fork_and_exec (sbin_iptables, mangle_clean_args)) |
944 | r += 8; | 950 | r += 8; |
945 | } | 951 | } |
946 | 952 | ||
diff --git a/src/exit/gnunet-helper-exit.c b/src/exit/gnunet-helper-exit.c index d1db2a6e6..57944cf61 100644 --- a/src/exit/gnunet-helper-exit.c +++ b/src/exit/gnunet-helper-exit.c | |||
@@ -62,12 +62,12 @@ | |||
62 | /** | 62 | /** |
63 | * Path to 'sysctl' binary. | 63 | * Path to 'sysctl' binary. |
64 | */ | 64 | */ |
65 | #define SBIN_SYSCTL "/sbin/sysctl" | 65 | static const char *sbin_sysctl; |
66 | 66 | ||
67 | /** | 67 | /** |
68 | * Path to 'iptables' binary. | 68 | * Path to 'iptables' binary. |
69 | */ | 69 | */ |
70 | #define SBIN_IPTABLES "/sbin/iptables" | 70 | static const char *sbin_iptables; |
71 | 71 | ||
72 | 72 | ||
73 | #ifndef _LINUX_IN6_H | 73 | #ifndef _LINUX_IN6_H |
@@ -615,6 +615,28 @@ main (int argc, char **argv) | |||
615 | fprintf (stderr, "Fatal: disabling both IPv4 and IPv6 makes no sense.\n"); | 615 | fprintf (stderr, "Fatal: disabling both IPv4 and IPv6 makes no sense.\n"); |
616 | return 1; | 616 | return 1; |
617 | } | 617 | } |
618 | if (0 == access ("/sbin/iptables", X_OK)) | ||
619 | sbin_iptables = "/sbin/iptables"; | ||
620 | else if (0 == access ("/usr/sbin/iptables", X_OK)) | ||
621 | sbin_iptables = "/usr/sbin/iptables"; | ||
622 | else | ||
623 | { | ||
624 | fprintf (stderr, | ||
625 | "Fatal: executable iptables not found in approved directories: %s\n", | ||
626 | strerror (errno)); | ||
627 | return 1; | ||
628 | } | ||
629 | if (0 == access ("/sbin/sysctl", X_OK)) | ||
630 | sbin_sysctl = "/sbin/sysctl"; | ||
631 | else if (0 == access ("/usr/sbin/sysctl", X_OK)) | ||
632 | sbin_sysctl = "/usr/sbin/sysctl"; | ||
633 | else | ||
634 | { | ||
635 | fprintf (stderr, | ||
636 | "Fatal: executable sysctl not found in approved directories: %s\n", | ||
637 | strerror (errno)); | ||
638 | return 1; | ||
639 | } | ||
618 | 640 | ||
619 | strncpy (dev, argv[1], IFNAMSIZ); | 641 | strncpy (dev, argv[1], IFNAMSIZ); |
620 | dev[IFNAMSIZ - 1] = '\0'; | 642 | dev[IFNAMSIZ - 1] = '\0'; |
@@ -643,7 +665,7 @@ main (int argc, char **argv) | |||
643 | { | 665 | { |
644 | "sysctl", "-w", "net.ipv6.conf.all.forwarding=1", NULL | 666 | "sysctl", "-w", "net.ipv6.conf.all.forwarding=1", NULL |
645 | }; | 667 | }; |
646 | if (0 != fork_and_exec (SBIN_SYSCTL, | 668 | if (0 != fork_and_exec (sbin_sysctl, |
647 | sysctl_args)) | 669 | sysctl_args)) |
648 | { | 670 | { |
649 | fprintf (stderr, | 671 | fprintf (stderr, |
@@ -665,7 +687,7 @@ main (int argc, char **argv) | |||
665 | { | 687 | { |
666 | "sysctl", "-w", "net.ipv4.ip_forward=1", NULL | 688 | "sysctl", "-w", "net.ipv4.ip_forward=1", NULL |
667 | }; | 689 | }; |
668 | if (0 != fork_and_exec (SBIN_SYSCTL, | 690 | if (0 != fork_and_exec (sbin_sysctl, |
669 | sysctl_args)) | 691 | sysctl_args)) |
670 | { | 692 | { |
671 | fprintf (stderr, | 693 | fprintf (stderr, |
@@ -678,7 +700,7 @@ main (int argc, char **argv) | |||
678 | { | 700 | { |
679 | "iptables", "-t", "nat", "-A", "POSTROUTING", "-o", argv[2], "-j", "MASQUERADE", NULL | 701 | "iptables", "-t", "nat", "-A", "POSTROUTING", "-o", argv[2], "-j", "MASQUERADE", NULL |
680 | }; | 702 | }; |
681 | if (0 != fork_and_exec (SBIN_IPTABLES, | 703 | if (0 != fork_and_exec (sbin_iptables, |
682 | iptables_args)) | 704 | iptables_args)) |
683 | { | 705 | { |
684 | fprintf (stderr, | 706 | fprintf (stderr, |
diff --git a/src/pt/gnunet-daemon-pt b/src/pt/gnunet-daemon-pt index 84ebead21..e57ea8f4d 100755 --- a/src/pt/gnunet-daemon-pt +++ b/src/pt/gnunet-daemon-pt | |||
@@ -1,7 +1,7 @@ | |||
1 | #! /bin/bash | 1 | #! /bin/bash |
2 | 2 | ||
3 | # gnunet-daemon-pt - temporary wrapper script for .libs/gnunet-daemon-pt | 3 | # gnunet-daemon-pt - temporary wrapper script for .libs/gnunet-daemon-pt |
4 | # Generated by ltmain.sh (GNU libtool) 2.2.6b Debian-2.2.6b-2 | 4 | # Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1 |
5 | # | 5 | # |
6 | # The gnunet-daemon-pt program cannot be directly executed until all the libtool | 6 | # The gnunet-daemon-pt program cannot be directly executed until all the libtool |
7 | # libraries that it depends on are installed. | 7 | # libraries that it depends on are installed. |
@@ -11,7 +11,6 @@ | |||
11 | 11 | ||
12 | # Sed substitution that helps us do robust quoting. It backslashifies | 12 | # Sed substitution that helps us do robust quoting. It backslashifies |
13 | # metacharacters that are still active within double-quoted strings. | 13 | # metacharacters that are still active within double-quoted strings. |
14 | Xsed='/bin/sed -e 1s/^X//' | ||
15 | sed_quote_subst='s/\([`"$\\]\)/\\\1/g' | 14 | sed_quote_subst='s/\([`"$\\]\)/\\\1/g' |
16 | 15 | ||
17 | # Be Bourne compatible | 16 | # Be Bourne compatible |
@@ -32,39 +31,125 @@ DUALCASE=1; export DUALCASE # for MKS sh | |||
32 | # if CDPATH is set. | 31 | # if CDPATH is set. |
33 | (unset CDPATH) >/dev/null 2>&1 && unset CDPATH | 32 | (unset CDPATH) >/dev/null 2>&1 && unset CDPATH |
34 | 33 | ||
35 | relink_command="(cd /home/grothoff/svn/gnunet/src/pt; { test -z \"\${LIBRARY_PATH+set}\" || unset LIBRARY_PATH || { LIBRARY_PATH=; export LIBRARY_PATH; }; }; { test -z \"\${COMPILER_PATH+set}\" || unset COMPILER_PATH || { COMPILER_PATH=; export COMPILER_PATH; }; }; { test -z \"\${GCC_EXEC_PREFIX+set}\" || unset GCC_EXEC_PREFIX || { GCC_EXEC_PREFIX=; export GCC_EXEC_PREFIX; }; }; { test -z \"\${LD_RUN_PATH+set}\" || unset LD_RUN_PATH || { LD_RUN_PATH=; export LD_RUN_PATH; }; }; LD_LIBRARY_PATH=/usr/lib/debug:/home/grothoff/lib; export LD_LIBRARY_PATH; PATH=/opt/jdk1.6.0_22/bin:/usr/lib/jvm/java-6-sun//bin:.:/home/grothoff/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games; export PATH; gcc -fno-strict-aliasing -Wall -g -Wall -Werror -O0 -I/home/grothoff//include -o \$progdir/\$file gnunet-daemon-pt.o -L/home/grothoff//lib ../../src/vpn/.libs/libgnunetvpn.so ../../src/dns/.libs/libgnunetdns.so ../../src/dns/.libs/libgnunetdnsparser.so ../../src/statistics/.libs/libgnunetstatistics.so ../../src/util/.libs/libgnunetutil.so ../../src/mesh/.libs/libgnunetmesh.so -ldl -Wl,-rpath -Wl,/home/grothoff/svn/gnunet/src/vpn/.libs -Wl,-rpath -Wl,/home/grothoff/svn/gnunet/src/dns/.libs -Wl,-rpath -Wl,/home/grothoff/svn/gnunet/src/statistics/.libs -Wl,-rpath -Wl,/home/grothoff/svn/gnunet/src/util/.libs -Wl,-rpath -Wl,/home/grothoff/svn/gnunet/src/mesh/.libs -Wl,-rpath -Wl,/home/grothoff/lib)" | 34 | relink_command="(cd /home/grothoff/svn/gnunet/src/pt; { test -z \"\${LIBRARY_PATH+set}\" || unset LIBRARY_PATH || { LIBRARY_PATH=; export LIBRARY_PATH; }; }; { test -z \"\${COMPILER_PATH+set}\" || unset COMPILER_PATH || { COMPILER_PATH=; export COMPILER_PATH; }; }; { test -z \"\${GCC_EXEC_PREFIX+set}\" || unset GCC_EXEC_PREFIX || { GCC_EXEC_PREFIX=; export GCC_EXEC_PREFIX; }; }; { test -z \"\${LD_RUN_PATH+set}\" || unset LD_RUN_PATH || { LD_RUN_PATH=; export LD_RUN_PATH; }; }; LD_LIBRARY_PATH=/home/grothoff/lib; export LD_LIBRARY_PATH; PATH=/opt/jdk1.6.0_22/bin/:/home/grothoff/bin/:/usr/local/bin:/usr/bin:/bin:/usr/games:.; export PATH; gcc -fno-strict-aliasing -Wall -g -O0 -Wall -o \$progdir/\$file gnunet-daemon-pt.o -L/home/grothoff//lib ../../src/vpn/.libs/libgnunetvpn.so ../../src/dns/.libs/libgnunetdns.so ../../src/dns/.libs/libgnunetdnsparser.so ../../src/statistics/.libs/libgnunetstatistics.so ../../src/util/.libs/libgnunetutil.so ../../src/mesh/.libs/libgnunetmesh.so -lm -ldl -Wl,-rpath -Wl,/home/grothoff/svn/gnunet/src/vpn/.libs -Wl,-rpath -Wl,/home/grothoff/svn/gnunet/src/dns/.libs -Wl,-rpath -Wl,/home/grothoff/svn/gnunet/src/statistics/.libs -Wl,-rpath -Wl,/home/grothoff/svn/gnunet/src/util/.libs -Wl,-rpath -Wl,/home/grothoff/svn/gnunet/src/mesh/.libs -Wl,-rpath -Wl,/home/grothoff/lib)" |
36 | 35 | ||
37 | # This environment variable determines our operation mode. | 36 | # This environment variable determines our operation mode. |
38 | if test "$libtool_install_magic" = "%%%MAGIC variable%%%"; then | 37 | if test "$libtool_install_magic" = "%%%MAGIC variable%%%"; then |
39 | # install mode needs the following variables: | 38 | # install mode needs the following variables: |
40 | generated_by_libtool_version='2.2.6b' | 39 | generated_by_libtool_version='2.4.2' |
41 | notinst_deplibs=' ../../src/vpn/libgnunetvpn.la ../../src/dns/libgnunetdns.la ../../src/dns/libgnunetdnsparser.la ../../src/statistics/libgnunetstatistics.la ../../src/util/libgnunetutil.la ../../src/mesh/libgnunetmesh.la' | 40 | notinst_deplibs=' ../../src/vpn/libgnunetvpn.la ../../src/dns/libgnunetdns.la ../../src/dns/libgnunetdnsparser.la ../../src/statistics/libgnunetstatistics.la ../../src/util/libgnunetutil.la ../../src/mesh/libgnunetmesh.la' |
42 | else | 41 | else |
43 | # When we are sourced in execute mode, $file and $ECHO are already set. | 42 | # When we are sourced in execute mode, $file and $ECHO are already set. |
44 | if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then | 43 | if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then |
45 | ECHO="echo" | ||
46 | file="$0" | 44 | file="$0" |
47 | # Make sure echo works. | 45 | |
48 | if test "X$1" = X--no-reexec; then | 46 | # A function that is used when there is no print builtin or printf. |
49 | # Discard the --no-reexec flag, and continue. | 47 | func_fallback_echo () |
50 | shift | 48 | { |
51 | elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then | 49 | eval 'cat <<_LTECHO_EOF |
52 | # Yippee, $ECHO works! | 50 | $1 |
53 | : | 51 | _LTECHO_EOF' |
54 | else | 52 | } |
55 | # Restart under the correct shell, and then maybe $ECHO will work. | 53 | ECHO="printf %s\\n" |
56 | exec /bin/bash "$0" --no-reexec ${1+"$@"} | 54 | fi |
57 | fi | 55 | |
56 | # Very basic option parsing. These options are (a) specific to | ||
57 | # the libtool wrapper, (b) are identical between the wrapper | ||
58 | # /script/ and the wrapper /executable/ which is used only on | ||
59 | # windows platforms, and (c) all begin with the string --lt- | ||
60 | # (application programs are unlikely to have options which match | ||
61 | # this pattern). | ||
62 | # | ||
63 | # There are only two supported options: --lt-debug and | ||
64 | # --lt-dump-script. There is, deliberately, no --lt-help. | ||
65 | # | ||
66 | # The first argument to this parsing function should be the | ||
67 | # script's ../../libtool value, followed by no. | ||
68 | lt_option_debug= | ||
69 | func_parse_lt_options () | ||
70 | { | ||
71 | lt_script_arg0=$0 | ||
72 | shift | ||
73 | for lt_opt | ||
74 | do | ||
75 | case "$lt_opt" in | ||
76 | --lt-debug) lt_option_debug=1 ;; | ||
77 | --lt-dump-script) | ||
78 | lt_dump_D=`$ECHO "X$lt_script_arg0" | /bin/sed -e 's/^X//' -e 's%/[^/]*$%%'` | ||
79 | test "X$lt_dump_D" = "X$lt_script_arg0" && lt_dump_D=. | ||
80 | lt_dump_F=`$ECHO "X$lt_script_arg0" | /bin/sed -e 's/^X//' -e 's%^.*/%%'` | ||
81 | cat "$lt_dump_D/$lt_dump_F" | ||
82 | exit 0 | ||
83 | ;; | ||
84 | --lt-*) | ||
85 | $ECHO "Unrecognized --lt- option: '$lt_opt'" 1>&2 | ||
86 | exit 1 | ||
87 | ;; | ||
88 | esac | ||
89 | done | ||
90 | |||
91 | # Print the debug banner immediately: | ||
92 | if test -n "$lt_option_debug"; then | ||
93 | echo "gnunet-daemon-pt:gnunet-daemon-pt:${LINENO}: libtool wrapper (GNU libtool) 2.4.2 Debian-2.4.2-1" 1>&2 | ||
58 | fi | 94 | fi |
95 | } | ||
96 | |||
97 | # Used when --lt-debug. Prints its arguments to stdout | ||
98 | # (redirection is the responsibility of the caller) | ||
99 | func_lt_dump_args () | ||
100 | { | ||
101 | lt_dump_args_N=1; | ||
102 | for lt_arg | ||
103 | do | ||
104 | $ECHO "gnunet-daemon-pt:gnunet-daemon-pt:${LINENO}: newargv[$lt_dump_args_N]: $lt_arg" | ||
105 | lt_dump_args_N=`expr $lt_dump_args_N + 1` | ||
106 | done | ||
107 | } | ||
108 | |||
109 | # Core function for launching the target application | ||
110 | func_exec_program_core () | ||
111 | { | ||
112 | |||
113 | if test -n "$lt_option_debug"; then | ||
114 | $ECHO "gnunet-daemon-pt:gnunet-daemon-pt:${LINENO}: newargv[0]: $progdir/$program" 1>&2 | ||
115 | func_lt_dump_args ${1+"$@"} 1>&2 | ||
116 | fi | ||
117 | exec "$progdir/$program" ${1+"$@"} | ||
118 | |||
119 | $ECHO "$0: cannot exec $program $*" 1>&2 | ||
120 | exit 1 | ||
121 | } | ||
122 | |||
123 | # A function to encapsulate launching the target application | ||
124 | # Strips options in the --lt-* namespace from $@ and | ||
125 | # launches target application with the remaining arguments. | ||
126 | func_exec_program () | ||
127 | { | ||
128 | case " $* " in | ||
129 | *\ --lt-*) | ||
130 | for lt_wr_arg | ||
131 | do | ||
132 | case $lt_wr_arg in | ||
133 | --lt-*) ;; | ||
134 | *) set x "$@" "$lt_wr_arg"; shift;; | ||
135 | esac | ||
136 | shift | ||
137 | done ;; | ||
138 | esac | ||
139 | func_exec_program_core ${1+"$@"} | ||
140 | } | ||
141 | |||
142 | # Parse options | ||
143 | func_parse_lt_options "$0" ${1+"$@"} | ||
59 | 144 | ||
60 | # Find the directory that this script lives in. | 145 | # Find the directory that this script lives in. |
61 | thisdir=`$ECHO "X$file" | $Xsed -e 's%/[^/]*$%%'` | 146 | thisdir=`$ECHO "$file" | /bin/sed 's%/[^/]*$%%'` |
62 | test "x$thisdir" = "x$file" && thisdir=. | 147 | test "x$thisdir" = "x$file" && thisdir=. |
63 | 148 | ||
64 | # Follow symbolic links until we get to the real thisdir. | 149 | # Follow symbolic links until we get to the real thisdir. |
65 | file=`ls -ld "$file" | /bin/sed -n 's/.*-> //p'` | 150 | file=`ls -ld "$file" | /bin/sed -n 's/.*-> //p'` |
66 | while test -n "$file"; do | 151 | while test -n "$file"; do |
67 | destdir=`$ECHO "X$file" | $Xsed -e 's%/[^/]*$%%'` | 152 | destdir=`$ECHO "$file" | /bin/sed 's%/[^/]*$%%'` |
68 | 153 | ||
69 | # If there was a directory component, then change thisdir. | 154 | # If there was a directory component, then change thisdir. |
70 | if test "x$destdir" != "x$file"; then | 155 | if test "x$destdir" != "x$file"; then |
@@ -74,11 +159,10 @@ else | |||
74 | esac | 159 | esac |
75 | fi | 160 | fi |
76 | 161 | ||
77 | file=`$ECHO "X$file" | $Xsed -e 's%^.*/%%'` | 162 | file=`$ECHO "$file" | /bin/sed 's%^.*/%%'` |
78 | file=`ls -ld "$thisdir/$file" | /bin/sed -n 's/.*-> //p'` | 163 | file=`ls -ld "$thisdir/$file" | /bin/sed -n 's/.*-> //p'` |
79 | done | 164 | done |
80 | 165 | ||
81 | |||
82 | # Usually 'no', except on cygwin/mingw when embedded into | 166 | # Usually 'no', except on cygwin/mingw when embedded into |
83 | # the cwrapper. | 167 | # the cwrapper. |
84 | WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=no | 168 | WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=no |
@@ -89,7 +173,7 @@ else | |||
89 | fi | 173 | fi |
90 | # remove .libs from thisdir | 174 | # remove .libs from thisdir |
91 | case "$thisdir" in | 175 | case "$thisdir" in |
92 | *[\\/].libs ) thisdir=`$ECHO "X$thisdir" | $Xsed -e 's%[\\/][^\\/]*$%%'` ;; | 176 | *[\\/].libs ) thisdir=`$ECHO "$thisdir" | /bin/sed 's%[\\/][^\\/]*$%%'` ;; |
93 | .libs ) thisdir=. ;; | 177 | .libs ) thisdir=. ;; |
94 | esac | 178 | esac |
95 | fi | 179 | fi |
@@ -117,7 +201,7 @@ else | |||
117 | if test -n "$relink_command"; then | 201 | if test -n "$relink_command"; then |
118 | if relink_command_output=`eval $relink_command 2>&1`; then : | 202 | if relink_command_output=`eval $relink_command 2>&1`; then : |
119 | else | 203 | else |
120 | echo "$relink_command_output" >&2 | 204 | printf %s\n "$relink_command_output" >&2 |
121 | rm -f "$progdir/$file" | 205 | rm -f "$progdir/$file" |
122 | exit 1 | 206 | exit 1 |
123 | fi | 207 | fi |
@@ -132,17 +216,13 @@ else | |||
132 | if test -f "$progdir/$program"; then | 216 | if test -f "$progdir/$program"; then |
133 | if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then | 217 | if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then |
134 | # Run the actual program with our arguments. | 218 | # Run the actual program with our arguments. |
135 | 219 | func_exec_program ${1+"$@"} | |
136 | exec "$progdir/$program" ${1+"$@"} | ||
137 | |||
138 | $ECHO "$0: cannot exec $program $*" 1>&2 | ||
139 | exit 1 | ||
140 | fi | 220 | fi |
141 | else | 221 | else |
142 | # The program doesn't exist. | 222 | # The program doesn't exist. |
143 | $ECHO "$0: error: \`$progdir/$program' does not exist" 1>&2 | 223 | $ECHO "$0: error: \`$progdir/$program' does not exist" 1>&2 |
144 | $ECHO "This script is just a wrapper for $program." 1>&2 | 224 | $ECHO "This script is just a wrapper for $program." 1>&2 |
145 | echo "See the libtool documentation for more information." 1>&2 | 225 | $ECHO "See the libtool documentation for more information." 1>&2 |
146 | exit 1 | 226 | exit 1 |
147 | fi | 227 | fi |
148 | fi | 228 | fi |