annotate packages/net/ftpclient/current/tests/ftp_var_example.c @ 3292:7f8e529b4d82 default tip

Fix FREESCALE_EDMA_NBYTES_MLOFFYES_MLOFF() so it works with negative offsets.
author vae
date Wed, 29 Apr 2015 23:31:48 +0000
parents 996973b15454
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1680
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
1 #include <pkgconf/system.h>
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
2 #define _config_OK
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
3 #if !defined(CYGPKG_NET_FTPCLIENT)
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
4 #error "Configuration is missing: CYGPKG_NET_FTPCLIENT"
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
5 #undef _config_OK
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
6 #endif
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
7 #if !defined(CYGPKG_COMPRESS_ZLIB)
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
8 #error "Configuration is missing: CYGPKG_COMPRESS_ZLIB"
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
9 #undef _config_OK
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
10 #else
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
11 #include <pkgconf/compress_zlib.h>
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
12 #if !defined(CYGSEM_COMPRESS_ZLIB_DEFLATE_MAKES_GZIP)
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
13 #error "Configuration is missing: CYGSEM_COMPRESS_ZLIB_DEFLATE_MAKES_GZIP"
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
14 #undef _config_OK
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
15 #endif
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
16 #endif
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
17 #if !defined(CYGPKG_CRC)
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
18 #error "Configuration is missing: CYGPKG_CRC"
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
19 #undef _config_OK
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
20 #endif
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
21
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
22 #ifdef _config_OK
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
23 #include <stdio.h>
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
24 #include <stdlib.h>
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
25 #include <ftpclient.h>
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
26 #include <cyg/compress/zlib.h>
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
27
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
28 #include <pkgconf/net.h>
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
29 #include <sys/param.h>
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
30 #include <sys/socket.h>
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
31 #include <sys/ioctl.h>
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
32 #include <sys/errno.h>
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
33
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
34 #include <net/if.h>
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
35 #include <netinet/in.h>
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
36 #include <netinet/ip.h>
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
37 #include <netinet/ip_icmp.h>
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
38 #include <net/route.h>
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
39
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
40 #include <cyg/infra/diag.h>
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
41 #include <cyg/kernel/kapi.h>
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
42
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
43 #include <bootp.h>
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
44 #include <network.h>
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
45 #include <arpa/inet.h>
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
46
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
47 #include "nvram.h"
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
48 #include "lkvm.h"
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
49 #include "getopt.h"
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
50
2120
996973b15454 Factor out target specific strings
gthomas
parents: 1680
diff changeset
51 #define FTP_SERV "192.168.1.125"
996973b15454 Factor out target specific strings
gthomas
parents: 1680
diff changeset
52 #define FTP_USER "george"
996973b15454 Factor out target specific strings
gthomas
parents: 1680
diff changeset
53 #define FTP_PASS "allen"
996973b15454 Factor out target specific strings
gthomas
parents: 1680
diff changeset
54
1680
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
55 #define MAX_ARGV 32
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
56
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
57 #ifdef CYGHWR_NET_DRIVER_ETH0
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
58 static struct bootp eth0_bootp_data;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
59 static const char *eth0_name = "eth0";
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
60 #endif
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
61 #ifdef CYGHWR_NET_DRIVER_ETH1
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
62 static struct bootp eth1_bootp_data;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
63 static const char *eth1_name = "eth1";
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
64 #endif
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
65
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
66 // TEMP for debug
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
67 core_info_t test_core_info = {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
68 .fence0 = KCORE_FENCE0_PAT,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
69 .fence1 = KCORE_FENCE1_PAT,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
70 .fence2 = KCORE_FENCE2_PAT,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
71 .fence3 = KCORE_FENCE3_PAT,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
72 .crash = KCORE_CRASH_PANIC,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
73 .panicstr = "This is a panic string",
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
74 .ncpu = 1,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
75 .nsegs = 2,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
76 .physical_banks[0] = { 0x700000, 0x40000 },
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
77 .physical_banks[1] = { 0x740000, 0x40000 },
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
78 .sr[0] = 0xB00B0000,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
79 .sr[1] = 0xB00B0001,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
80 .sr[2] = 0xB00B0002,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
81 .sr[3] = 0xB00B0003,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
82 .sr[4] = 0xB00B0004,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
83 .sr[5] = 0xB00B0005,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
84 .sr[6] = 0xB00B0006,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
85 .sr[7] = 0xB00B0007,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
86 .dbatl[0] = 0xDEAD0000, .dbatu[0] = 0xDEAD1000,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
87 .dbatl[1] = 0xDEAD0001, .dbatu[1] = 0xDEAD1001,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
88 .dbatl[2] = 0xDEAD0002, .dbatu[2] = 0xDEAD1002,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
89 .dbatl[3] = 0xDEAD0003, .dbatu[3] = 0xDEAD1003,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
90 .dbatl[4] = 0xDEAD0004, .dbatu[4] = 0xDEAD1004,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
91 .dbatl[5] = 0xDEAD0005, .dbatu[5] = 0xDEAD1005,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
92 .dbatl[6] = 0xDEAD0006, .dbatu[6] = 0xDEAD1006,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
93 .dbatl[7] = 0xDEAD2007, .dbatu[7] = 0xDEAD3007,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
94 .ibatl[0] = 0xDEAD2000, .ibatu[0] = 0xDEAD3000,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
95 .ibatl[1] = 0xDEAD2001, .ibatu[1] = 0xDEAD3001,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
96 .ibatl[2] = 0xDEAD2002, .ibatu[2] = 0xDEAD3002,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
97 .ibatl[3] = 0xDEAD2003, .ibatu[3] = 0xDEAD3003,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
98 .ibatl[4] = 0xDEAD2004, .ibatu[4] = 0xDEAD3004,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
99 .ibatl[5] = 0xDEAD2005, .ibatu[5] = 0xDEAD3005,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
100 .ibatl[6] = 0xDEAD2006, .ibatu[6] = 0xDEAD3006,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
101 .ibatl[7] = 0xDEAD2007, .ibatu[7] = 0xDEAD3007,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
102 };
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
103 // TEMP
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
104
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
105 #define FTP_BUFSIZE 4096
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
106 struct ftp_data {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
107 z_stream stream;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
108 char buf[FTP_BUFSIZE], *bufp;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
109 int len;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
110 int src_len;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
111 int first;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
112 int (*get_data)(char **ptr, void *param);
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
113 void *get_param;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
114 };
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
115
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
116 int _ftp_write_gz(char *buf, int len, void *priv)
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
117 {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
118 struct ftp_data *dp = (struct ftp_data *)priv;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
119 int err;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
120 int res = 0;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
121 char *src;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
122
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
123 if (dp->first) {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
124 // Ugly hack - zlib needs a value for 'avail_in' at initialization
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
125 // time, even though we don't have anything ready yet
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
126 dp->stream.avail_in = 0;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
127 dp->first = 0;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
128 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
129 while ((dp->len == 0) && (dp->src_len > 0)) {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
130 // Has input buffer been exhausted?
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
131 if (dp->stream.avail_in == 0) {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
132 dp->src_len = (*dp->get_data)(&src, dp->get_param);
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
133 dp->stream.next_in = src;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
134 dp->stream.avail_in = dp->src_len;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
135 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
136 // See if more data is available to be compressed
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
137 dp->stream.avail_out = FTP_BUFSIZE;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
138 dp->stream.next_out = dp->buf;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
139 err = deflate(&dp->stream, dp->src_len ? Z_NO_FLUSH : Z_FINISH);
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
140 dp->len = FTP_BUFSIZE - dp->stream.avail_out;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
141 dp->bufp = dp->buf;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
142 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
143 // Move up to 'len' bytes from internal buffer
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
144 res = len;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
145 if (res > dp->len) {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
146 res = dp->len;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
147 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
148 memcpy(buf, dp->bufp, res);
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
149 dp->bufp += res;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
150 dp->len -= res;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
151 return res;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
152 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
153
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
154 struct _simple_get_data_param {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
155 char *ptr;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
156 int len;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
157 };
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
158
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
159 int
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
160 simple_get_data(char **ptr, void *param)
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
161 {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
162 struct _simple_get_data_param *gp = (struct _simple_get_data_param *)param;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
163 int res;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
164
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
165 *ptr = gp->ptr;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
166 res = gp->len;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
167 gp->len = 0;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
168 return res;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
169
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
170 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
171
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
172
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
173 //
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
174 // Parse (scan/copy) network addresses. If the IP address contains
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
175 // a '/', then use that to determine the netmask and ignore the
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
176 // specified value.
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
177 //
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
178 bool
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
179 parse_eth_addrs(char *desired_ip, char *desired_netmask,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
180 char *ip, char *netmask, char *broadcast)
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
181 {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
182 char *src, *dst;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
183 bool found_netmask = false;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
184 int mask_size, mask, ip_addr;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
185
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
186 // diag_printf("parse - ip: '%s', mask: '%s'\n", desired_ip, desired_netmask);
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
187 // IP address
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
188 src = desired_ip; dst = ip;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
189 while (*src) {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
190 if (*src == '/') {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
191 // Do something with netmask
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
192 src++;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
193 found_netmask = true;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
194 mask_size = 0;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
195 while (*src) {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
196 mask_size = (mask_size * 10) + (*src++ - '0');
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
197 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
198 mask = 0xFFFFFFFF << (32-mask_size);
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
199 break;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
200 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
201 *dst++ = *src++;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
202 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
203 *dst = '\0';
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
204 if (!found_netmask) {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
205 if (!inet_aton(desired_netmask, (struct in_addr *)&mask)) {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
206 diag_printf("Error: Invalid netmask '%s'\n", desired_netmask);
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
207 return false; // Illegal netmask
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
208 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
209 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
210 strcpy(netmask, inet_ntoa(*(struct in_addr *)&mask));
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
211 if (!inet_aton(ip, (struct in_addr *)&ip_addr)) {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
212 diag_printf("Error: Invalid IP address '%s'\n", ip);
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
213 return false;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
214 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
215 ip_addr = (ip_addr & mask) | ~mask;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
216 strcpy(broadcast, inet_ntoa(*(struct in_addr *)&ip_addr));
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
217 // diag_printf("ip: '%s', netmask: '%s', broadcast: '%s'\n", ip, netmask, broadcast);
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
218 return true;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
219 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
220
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
221 struct core_dump_param {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
222 int phase;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
223 int segno;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
224 core_info_t *cp;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
225 kcore_hdr_t hdr;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
226 kcore_seg_t cpu_hdr, ram_hdr;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
227 cpu_kcore_hdr_t cpu_info;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
228 phys_ram_seg_t cpu_phys_segs[8];
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
229 };
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
230
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
231 #define ALIGN(v,n) ((((v)+((n)-1))/(n))*(n))
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
232
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
233 int
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
234 dump_core(char **ptr, void *param)
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
235 {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
236 struct core_dump_param *dp = (struct core_dump_param *)param;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
237 int len;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
238
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
239 switch (dp->phase) {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
240 case 0:
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
241 // File header (kcore_hdr_t)
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
242 dp->phase = 1;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
243 *ptr = (char *)&dp->hdr;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
244 return ALIGN(sizeof(dp->hdr), 8);
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
245 case 1:
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
246 // CPU header (kcore_seg_t)
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
247 dp->phase = 2;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
248 *ptr = (char *)&dp->cpu_hdr;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
249 return ALIGN(sizeof(dp->cpu_hdr), 8);
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
250 case 2:
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
251 // CPU info (cpu_kcore_hdr_t)
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
252 dp->phase = 3;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
253 dp->segno = 0;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
254 *ptr = (char *)&dp->cpu_info;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
255 return sizeof(dp->cpu_info);
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
256 case 3:
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
257 // Physical RAM segment descriptions (phys_ram_seg_t)
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
258 *ptr = (char *)&dp->cpu_phys_segs[dp->segno];
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
259 if (++dp->segno == dp->cp->nsegs) {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
260 dp->phase = 4;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
261 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
262 return sizeof(dp->cpu_phys_segs[0]);
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
263 case 4:
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
264 // RAM header (kcore_seg_t)
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
265 dp->phase = 5;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
266 *ptr = (char *)&dp->ram_hdr;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
267 dp->segno = 0;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
268 return ALIGN(sizeof(dp->ram_hdr), 8);
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
269 case 5:
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
270 // RAM segment
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
271 *ptr = (char *)dp->cpu_phys_segs[dp->segno].start;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
272 len = dp->cpu_phys_segs[dp->segno].size;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
273 if (++dp->segno == dp->cp->nsegs) {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
274 dp->phase = 6;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
275 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
276 return len;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
277 case 6:
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
278 // All done!
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
279 return 0;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
280 default:
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
281 diag_printf("Bad core dump phase: %d\n", dp->phase);
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
282 return 0;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
283 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
284 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
285
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
286 void
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
287 expand_file_name(char *file_name, char *path, char *ip)
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
288 {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
289 char *fn = nvram_get("dump_name");
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
290 char *dp = file_name;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
291 char last = '\0';
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
292
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
293 if (!fn) fn = "XPathOS.%i.core.gz";
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
294 if (!path) path = "/";
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
295 while (*path) {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
296 last = *path++;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
297 *dp++ = last;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
298 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
299 if (last != '/') {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
300 *dp++ = '/';
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
301 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
302 while (*fn) {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
303 if (*fn == '%') {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
304 fn += 2; // Skip '%i'
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
305 while (*ip) {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
306 *dp++ = *ip++;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
307 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
308 } else {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
309 *dp++ = *fn++;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
310 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
311 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
312 *dp = '\0';
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
313 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
314
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
315 void
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
316 do_core_dump(core_info_t *cp, char *ip)
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
317 {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
318 struct core_dump_param cd;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
319 // Caution - this can't be on the stack unless you increase the stack size!
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
320 static struct ftp_data dp;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
321 int err, wlen, i;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
322 unsigned long total_ram_size;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
323 char file_name[256];
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
324 char *dump_ip, *dump_user, *dump_pass;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
325
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
326 dump_ip = nvram_get("dump_server");
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
327 if (!dump_ip) {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
328 diag_printf("Can't dump: server IP missing in NVRAM\n");
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
329 return;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
330 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
331 dump_user = nvram_get("dump_user");
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
332 if (!dump_user) {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
333 diag_printf("Can't dump: user name missing in NVRAM\n");
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
334 return;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
335 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
336 dump_pass = nvram_get("dump_pass");
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
337 if (!dump_pass) {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
338 diag_printf("Can't dump: password missing in NVRAM\n");
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
339 return;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
340 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
341 expand_file_name(file_name, nvram_get("dump_path"), ip);
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
342
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
343 // Fill in core dump structures
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
344 cd.hdr.c_midmag = KCORE_HDR_MAGIC;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
345 cd.hdr.c_hdrsize = ALIGN(sizeof(cd.hdr), 8);
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
346 cd.hdr.c_seghdrsize = ALIGN(sizeof(cd.cpu_hdr), 8);
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
347 cd.hdr.c_nseg = cp->nsegs;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
348
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
349 cd.cpu_hdr.c_midmag = KCORE_CPU_SEGMENT;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
350 cd.cpu_hdr.c_size = sizeof(kcore_seg_t)+sizeof(cpu_kcore_hdr_t)+(cp->nsegs*sizeof(phys_ram_seg_t));
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
351 // Copy info from core-dump area
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
352 cd.cpu_info.pvr = cp->pvr;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
353 cd.cpu_info.sdr1 = cp->sdr1;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
354 for (i = 0; i < 8; i++) {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
355 cd.cpu_info.sr[i] = cp->sr[i];
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
356 cd.cpu_info.dbatl[i] = cp->dbatl[i];
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
357 cd.cpu_info.dbatu[i] = cp->dbatu[i];
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
358 cd.cpu_info.ibatl[i] = cp->ibatl[i];
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
359 cd.cpu_info.ibatu[i] = cp->ibatu[i];
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
360 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
361 for (i = 0; i < 8; i++) {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
362 cd.cpu_phys_segs[i].start = cp->physical_banks[i].base;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
363 cd.cpu_phys_segs[i].size = cp->physical_banks[i].length;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
364 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
365
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
366 total_ram_size = 0;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
367 cd.ram_hdr.c_midmag = KCORE_DATA_SEGMENT;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
368 cd.ram_hdr.c_size = sizeof(kcore_seg_t)+total_ram_size;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
369
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
370 cd.phase = 0;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
371 cd.cp = cp;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
372
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
373 dp.len = 0;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
374 dp.get_data = dump_core;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
375 dp.get_param = &cd;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
376 dp.src_len = 1;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
377 dp.first = 1;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
378 dp.stream.next_in = 0;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
379 dp.stream.avail_in = 0x1000;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
380 dp.stream.next_out = dp.buf;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
381 dp.stream.avail_out = FTP_BUFSIZE;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
382 dp.stream.zalloc = (alloc_func)0;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
383 dp.stream.zfree = (free_func)0;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
384 dp.stream.opaque = (voidpf)0;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
385
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
386 err = deflateInit(&dp.stream, Z_DEFAULT_COMPRESSION);
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
387 diag_printf("err = %d\n", err);
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
388
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
389 diag_printf("... dumping core as %s\n", file_name);
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
390
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
391 wlen = ftp_put_var(dump_ip, dump_user, dump_pass, file_name,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
392 _ftp_write_gz, &dp, ftpclient_printf);
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
393 diag_printf("res = %d\n", wlen);
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
394 deflateEnd(&dp.stream);
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
395 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
396
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
397 void
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
398 scan_args(char *cmdline, int *argc, char **argv, char **alt_cmdline)
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
399 {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
400 char *cp = cmdline;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
401 int indx = 0;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
402
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
403 argv[indx++] = "secondary-load";
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
404 *alt_cmdline = (char *)0;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
405 while (*cp) {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
406 // Skip over any white space
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
407 while (*cp && (*cp == ' ')) cp++;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
408 if (!*cp) break;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
409 // Check for -- break
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
410 if ((cp[0] == '-') && (cp[1] == '-')) {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
411 // End of normal list
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
412 cp += 2;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
413 while (*cp && (*cp == ' ')) cp++;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
414 *alt_cmdline = cp;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
415 *argc = indx;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
416 return;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
417 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
418 // Split argument
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
419 argv[indx++] = cp;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
420 while (*cp) {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
421 if (*cp == ' ') {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
422 *cp++ = '\0';
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
423 break;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
424 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
425 cp++;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
426 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
427 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
428 *argc = indx;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
429 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
430
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
431 int
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
432 loader_main(char *cmdline)
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
433 {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
434 int len, wlen;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
435 int err;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
436 int argc, i;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
437 char *argv[MAX_ARGV], *alt_cmdline;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
438 bool force_dump = false;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
439 bool quick_boot = false;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
440 bool verbose = false;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
441 char *boot_info = (char *)NULL;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
442 // Caution - this can't be on the stack unless you increase the stack size!
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
443 static struct ftp_data dp;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
444 struct _simple_get_data_param gp;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
445 #ifdef CYGHWR_NET_DRIVER_ETH0
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
446 char eth0_ip[32], eth0_netmask[32], eth0_broadcast[32];
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
447 #endif
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
448 #ifdef CYGHWR_NET_DRIVER_ETH1
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
449 char eth1_ip[32], eth1_netmask[32], eth1_broadcast[32];
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
450 #endif
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
451 char *eth_gateway;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
452
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
453 scan_args(cmdline, &argc, argv, &alt_cmdline);
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
454 while (1) {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
455 i = getopt(argc, argv, "fqv");
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
456 if (i < 0) break;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
457 switch (i) {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
458 case 'f':
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
459 force_dump = true;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
460 break;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
461 case 'q':
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
462 quick_boot = true;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
463 break;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
464 case 'v':
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
465 verbose = true;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
466 break;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
467 default:
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
468 diag_printf("Invalid return from getopt: %d\n", i);
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
469 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
470 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
471 if (optind < argc) {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
472 boot_info = argv[optind];
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
473 };
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
474
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
475 if (!(eth_gateway = nvram_get("net_gateway"))) {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
476 diag_printf("Error: need network gateway\n");
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
477 return 1;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
478 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
479 #ifdef CYGHWR_NET_DRIVER_ETH0
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
480 if (!parse_eth_addrs(nvram_get("net0_ip"), nvram_get("net0_mask"),
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
481 eth0_ip, eth0_netmask, eth0_broadcast)) {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
482 diag_printf("Can't set up ethernet 'net0' - I give up!\n");
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
483 return 1;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
484 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
485 build_bootp_record(&eth0_bootp_data,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
486 eth0_name,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
487 eth0_ip,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
488 eth0_netmask,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
489 eth0_broadcast,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
490 eth_gateway,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
491 "0.0.0.0");
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
492 show_bootp(eth0_name, &eth0_bootp_data);
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
493 if (!init_net(eth0_name, &eth0_bootp_data)) {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
494 diag_printf("Network initialization failed for eth0\n");
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
495 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
496 #endif
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
497 #ifdef CYGHWR_NET_DRIVER_ETH1
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
498 if (!parse_eth_addrs(nvram_get("net1_ip"), nvram_get("net1_mask"),
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
499 eth1_ip, eth1_netmask, eth1_broadcast)) {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
500 diag_printf("Can't set up ethernet 'net1' - I give up!\n");
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
501 return 1;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
502 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
503 build_bootp_record(&eth1_bootp_data,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
504 eth1_name,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
505 eth1_ip,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
506 eth1_netmask,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
507 eth1_broadcast,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
508 eth_gateway,
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
509 "0.0.0.0");
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
510 show_bootp(eth1_name, &eth1_bootp_data);
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
511 if (!init_net(eth1_name, &eth1_bootp_data)) {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
512 diag_printf("Network initialization failed for eth1\n");
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
513 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
514 #endif
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
515
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
516 if (!quick_boot) {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
517 if (!force_dump) {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
518 // See if the 'core dump' page contains an indication that a
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
519 // dump should be taken
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
520 force_dump = true;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
521 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
522 do_core_dump(&test_core_info, eth0_ip);
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
523 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
524
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
525 do_load(boot_info);
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
526
2120
996973b15454 Factor out target specific strings
gthomas
parents: 1680
diff changeset
527 len = ftp_get(FTP_SERV, FTP_USER, FTP_PASS, "TEST.dat",
1680
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
528 (char *)0x200000, 0x100000, ftpclient_printf);
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
529 diag_printf("res = %d\n", len);
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
530 if (len <= 0) exit(0);
2120
996973b15454 Factor out target specific strings
gthomas
parents: 1680
diff changeset
531 wlen = ftp_put(FTP_SERV, FTP_USER, FTP_PASS, "TEST2.dat",
1680
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
532 (char *)0x200000, len, ftpclient_printf);
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
533 diag_printf("res = %d\n", wlen);
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
534
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
535 // Set up to compress data
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
536 gp.ptr = (char *)0x200000;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
537 gp.len = len;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
538 dp.len = 0;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
539 dp.get_data = simple_get_data;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
540 dp.get_param = &gp;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
541 dp.src_len = 1;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
542 dp.first = 1;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
543 dp.stream.next_in = 0;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
544 dp.stream.avail_in = 0x1000;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
545 dp.stream.next_out = dp.buf;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
546 dp.stream.avail_out = FTP_BUFSIZE;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
547 dp.stream.zalloc = (alloc_func)0;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
548 dp.stream.zfree = (free_func)0;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
549 dp.stream.opaque = (voidpf)0;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
550
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
551 err = deflateInit(&dp.stream, Z_DEFAULT_COMPRESSION);
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
552 diag_printf("err = %d\n", err);
2120
996973b15454 Factor out target specific strings
gthomas
parents: 1680
diff changeset
553 wlen = ftp_put_var(FTP_SERV, FTP_USER, FTP_PASS, "TEST3.dat.gz",
1680
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
554 _ftp_write_gz, &dp, ftpclient_printf);
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
555 diag_printf("res = %d\n", wlen);
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
556 deflateEnd(&dp.stream);
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
557
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
558 return 0;
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
559 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
560
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
561 int
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
562 main(void)
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
563 {
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
564 return (loader_main("-f -t test joe -- junk"));
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
565 }
68e5dffc36e4 New test for variable [stream] FTP client support
gthomas
parents:
diff changeset
566 #endif // _config_OK