| 1 | /* |
| 2 | * Copyright (C) 1999,2001 Ross Combs ([email protected]) |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; either version 2 |
| 7 | * of the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 17 | */ |
| 18 | #include "common/setup_before.h"cxx . . $ `<file>/src/common/setup_before.h`/ |
| 19 | #include <cstdio> |
| 20 | #include <cstdlib> |
| 21 | #include <ctime> |
| 22 | #include <cstring> |
| 23 | #include <cctype> |
| 24 | #ifdef HAVE_SYS_STAT_Hcxx . . $ `build/config.h:21:9`! |
| 25 | # include <sys/stat.h> |
| 26 | #endif |
| 27 | #ifdef HAVE_TERMIOS_Hcxx . . $ `build/config.h:15:9`! |
| 28 | # include <termios.h> |
| 29 | #endif |
| 30 | |
| 31 | #include "compat/termios.h"cxx . . $ `<file>/src/compat/termios.h`/ |
| 32 | #include "compat/psock.h"cxx . . $ `<file>/src/compat/psock.h`/ |
| 33 | #include "common/packet.h"cxx . . $ `<file>/src/common/packet.h`/ |
| 34 | #include "common/field_sizes.h"cxx . . $ `<file>/src/common/field_sizes.h`/ |
| 35 | #include "common/bnettime.h"cxx . . $ `<file>/src/common/bnettime.h`/ |
| 36 | #include "common/hexdump.h"cxx . . $ `<file>/src/common/hexdump.h`/ |
| 37 | #include "common/util.h"cxx . . $ `<file>/src/common/util.h`/ |
| 38 | #include "common/tag.h"cxx . . $ `<file>/src/common/tag.h`/ |
| 39 | #include "common/bn_type.h"cxx . . $ `<file>/src/common/bn_type.h`/ |
| 40 | #include "common/xalloc.h"cxx . . $ `<file>/src/common/xalloc.h`/ |
| 41 | #include "common/file_protocol.h"cxx . . $ `<file>/src/common/file_protocol.h`/ |
| 42 | #include "common/init_protocol.h"cxx . . $ `<file>/src/common/init_protocol.h`/ |
| 43 | #ifdef CLIENTDEBUGcxx . . $ `src/common/setup_before.h:49:9`! |
| 44 | # include "common/eventlog.h"cxx . . $ `<file>/src/common/eventlog.h`/ |
| 45 | #endif |
| 46 | #include "client.h"cxx . . $ `<file>/src/client/client.h`/ |
| 47 | |
| 48 | #ifdef HAVE_ARPA_INET_Hcxx . . $ `build/config.h:13:9`! |
| 49 | # include <arpa/inet.h> |
| 50 | #endif |
| 51 | #ifdef HAVE_WS2TCPIP_H |
| 52 | # include <Ws2tcpip.h> |
| 53 | #endif |
| 54 | |
| 55 | #include "common/setup_after.h"cxx . . $ `<file>/src/common/setup_after.h`/ |
| 56 | |
| 57 | using namespace pvpgn; |
| 58 | using namespace pvpgncxx . . $ pvpgn/::client; |
| 59 | |
| 60 | namespacecxx . . $ `$anonymous_namespace_src/client/bnftp.cpp`/ |
| 61 | { |
| 62 | |
| 63 | void usagecxx . . $ `$anonymous_namespace_src/client/bnftp.cpp`/usage(85c52e162fed56f9).(char const * progname) |
| 64 | { |
| 65 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "usage: %s [<options>] [<servername> [<TCP portnumber>]]\n", progname); |
| 66 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, |
| 67 | " -b, --client=SEXP report client as Brood Wars\n" |
| 68 | " -d, --client=DRTL report client as Diablo Retail\n" |
| 69 | " --client=DSHR report client as Diablo Shareware\n" |
| 70 | " -s, --client=STAR report client as Starcraft (default)\n"); |
| 71 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, |
| 72 | " --client=SSHR report client as Starcraft Shareware\n" |
| 73 | " -w, --client=W2BN report client as Warcraft II BNE\n" |
| 74 | " --client=D2DV report client as Diablo II\n" |
| 75 | " --client=D2XP report client as Diablo II: LoD\n" |
| 76 | " --client=WAR3 report client as Warcraft III\n" |
| 77 | " --client=W3XP report client as Warcraft III: FT\n" |
| 78 | " --hexdump=FILE do hex dump of packets into FILE\n"); |
| 79 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, |
| 80 | " --arch=IX86 report architecture as Windows (x86)\n" |
| 81 | " --arch=PMAC report architecture as Macintosh\n" |
| 82 | " --arch=XMAC report architecture as Macintosh OSX\n" |
| 83 | ); |
| 84 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, |
| 85 | " --startoffset=OFFSET force offset to be OFFSET\n" |
| 86 | " --exists=ACTION Ask/Overwrite/Backup/Resume if the file exists\n" |
| 87 | " --file=FILENAME use FILENAME instead of asking\n" |
| 88 | " -h, --help, --usage show this information and exit\n" |
| 89 | " -v, --version print version number and exit\n"); |
| 90 | stdcxx . . $ std/::exit(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!); |
| 91 | } |
| 92 | |
| 93 | } |
| 94 | |
| 95 | extern int maincxx . . $ main(afcd3168fc1188a4).(int argc, char * argv[]) |
| 96 | { |
| 97 | int a; |
| 98 | int sd; |
| 99 | struct sockaddr_in saddr; |
| 100 | t_packetcxx . . $ pvpgn/t_packet# * packet; |
| 101 | t_packetcxx . . $ pvpgn/t_packet# * rpacket; |
| 102 | t_packetcxx . . $ pvpgn/t_packet# * fpacket; |
| 103 | char const * clienttag = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 104 | char const * archtag = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 105 | char const * servname = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 106 | unsigned short servport = 0; |
| 107 | char const * hexfile = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 108 | char text[MAX_MESSAGE_LENcxx . . $ MAX_MESSAGE_LEN.]; |
| 109 | char const * reqfile = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 110 | struct hostent * host; |
| 111 | unsigned int commpos; |
| 112 | struct termios in_attr_old; |
| 113 | struct termios in_attr_new; |
| 114 | int changed_in; |
| 115 | unsigned int currsize; |
| 116 | unsigned int filelen; |
| 117 | unsigned int startoffset; |
| 118 | int startoffsetoverride = 0; |
| 119 | #define EXIST_ACTION_UNSPECcxx . . $ `src/client/bnftp.cpp:119:9`! -1 |
| 120 | #define EXIST_ACTION_ASKcxx . . $ `src/client/bnftp.cpp:120:9`! 0 |
| 121 | #define EXIST_ACTION_OVERWRITEcxx . . $ `src/client/bnftp.cpp:121:9`! 1 |
| 122 | #define EXIST_ACTION_BACKUPcxx . . $ `src/client/bnftp.cpp:122:9`! 2 |
| 123 | #define EXIST_ACTION_RESUMEcxx . . $ `src/client/bnftp.cpp:123:9`! 3 |
| 124 | int exist_action = EXIST_ACTION_UNSPECcxx . . $ `src/client/bnftp.cpp:119:9`!; |
| 125 | struct stat exist_buf; |
| 126 | char const * filename; |
| 127 | stdcxx . . $ std/::FILEcxx . . $ std/FILE# * fp; |
| 128 | stdcxx . . $ std/::FILEcxx . . $ std/FILE# * hexstrm = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 129 | int fd_stdin; |
| 130 | t_bnettimecxx . . $ pvpgn/t_bnettime# bntime; |
| 131 | stdcxx . . $ std/::time_tcxx . . $ std/time_t# tm; |
| 132 | char timestr[FILE_TIME_MAXLENcxx . . $ FILE_TIME_MAXLEN.]; |
| 133 | unsigned int screen_width, screen_height; |
| 134 | int munged; |
| 135 | unsigned int newproto = 0; |
| 136 | |
| 137 | if (argc < 1 || !argv || !argv[0]) |
| 138 | { |
| 139 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "bad arguments\n"); |
| 140 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!; |
| 141 | } |
| 142 | |
| 143 | for (a = 1; a < argc; a++) |
| 144 | if (servname && stdcxx . . $ std/::isdigitcxx . . $ std/isdigit(a1851578aea3f541).((int)argv[a][0]) && a + 1 >= argc) |
| 145 | { |
| 146 | if (str_to_ushortcxx . . $ pvpgn/str_to_ushort(c9bce2f4bcd31d4).(argv[a], &servport) < 0) |
| 147 | { |
| 148 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: \"%s\" should be a positive integer\n", argv[0], argv[a]); |
| 149 | usagecxx . . $ `$anonymous_namespace_src/client/bnftp.cpp`/usage(85c52e162fed56f9).(argv[0]); |
| 150 | } |
| 151 | } |
| 152 | else if (!servname && argv[a][0] != '-' && a + 2 >= argc) |
| 153 | servname = argv[a]; |
| 154 | else if (stdcxx . . $ std/::strcmp(argv[a], "-b") == 0 || stdcxx . . $ std/::strcmp(argv[a], "--client=SEXP") == 0) |
| 155 | { |
| 156 | if (clienttag) |
| 157 | { |
| 158 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: client type was already specified as \"%s\"\n", argv[0], clienttag); |
| 159 | usagecxx . . $ `$anonymous_namespace_src/client/bnftp.cpp`/usage(85c52e162fed56f9).(argv[0]); |
| 160 | } |
| 161 | clienttag = CLIENTTAG_BROODWARScxx . . $ `src/common/tag.h:88:9`!; |
| 162 | } |
| 163 | else if (stdcxx . . $ std/::strcmp(argv[a], "-d") == 0 || stdcxx . . $ std/::strcmp(argv[a], "--client=DRTL") == 0) |
| 164 | { |
| 165 | if (clienttag) |
| 166 | { |
| 167 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: client type was already specified as \"%s\"\n", argv[0], clienttag); |
| 168 | usagecxx . . $ `$anonymous_namespace_src/client/bnftp.cpp`/usage(85c52e162fed56f9).(argv[0]); |
| 169 | } |
| 170 | clienttag = CLIENTTAG_DIABLORTLcxx . . $ `src/common/tag.h:92:9`!; |
| 171 | } |
| 172 | else if (stdcxx . . $ std/::strcmp(argv[a], "--client=DSHR") == 0) |
| 173 | { |
| 174 | if (clienttag) |
| 175 | { |
| 176 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: client type was already specified as \"%s\"\n", argv[0], clienttag); |
| 177 | usagecxx . . $ `$anonymous_namespace_src/client/bnftp.cpp`/usage(85c52e162fed56f9).(argv[0]); |
| 178 | } |
| 179 | clienttag = CLIENTTAG_DIABLOSHRcxx . . $ `src/common/tag.h:94:9`!; |
| 180 | } |
| 181 | else if (stdcxx . . $ std/::strcmp(argv[a], "-s") == 0 || stdcxx . . $ std/::strcmp(argv[a], "--client=STAR") == 0) |
| 182 | { |
| 183 | if (clienttag) |
| 184 | { |
| 185 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: client type was already specified as \"%s\"\n", argv[0], clienttag); |
| 186 | usagecxx . . $ `$anonymous_namespace_src/client/bnftp.cpp`/usage(85c52e162fed56f9).(argv[0]); |
| 187 | } |
| 188 | clienttag = CLIENTTAG_STARCRAFTcxx . . $ `src/common/tag.h:86:9`!; |
| 189 | } |
| 190 | else if (stdcxx . . $ std/::strcmp(argv[a], "--client=SSHR") == 0) |
| 191 | { |
| 192 | if (clienttag) |
| 193 | { |
| 194 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: client type was already specified as \"%s\"\n", argv[0], clienttag); |
| 195 | usagecxx . . $ `$anonymous_namespace_src/client/bnftp.cpp`/usage(85c52e162fed56f9).(argv[0]); |
| 196 | } |
| 197 | clienttag = CLIENTTAG_SHAREWAREcxx . . $ `src/common/tag.h:90:9`!; |
| 198 | } |
| 199 | else if (stdcxx . . $ std/::strcmp(argv[a], "-w") == 0 || stdcxx . . $ std/::strcmp(argv[a], "--client=W2BN") == 0) |
| 200 | { |
| 201 | if (clienttag) |
| 202 | { |
| 203 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: client type was already specified as \"%s\"\n", argv[0], clienttag); |
| 204 | usagecxx . . $ `$anonymous_namespace_src/client/bnftp.cpp`/usage(85c52e162fed56f9).(argv[0]); |
| 205 | } |
| 206 | clienttag = CLIENTTAG_WARCIIBNEcxx . . $ `src/common/tag.h:96:9`!; |
| 207 | } |
| 208 | else if (stdcxx . . $ std/::strcmp(argv[a], "--client=D2DV") == 0) |
| 209 | { |
| 210 | if (clienttag) |
| 211 | { |
| 212 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: client type was already specified as \"%s\"\n", argv[0], clienttag); |
| 213 | usagecxx . . $ `$anonymous_namespace_src/client/bnftp.cpp`/usage(85c52e162fed56f9).(argv[0]); |
| 214 | } |
| 215 | clienttag = CLIENTTAG_DIABLO2DVcxx . . $ `src/common/tag.h:98:9`!; |
| 216 | } |
| 217 | else if (stdcxx . . $ std/::strcmp(argv[a], "--client=D2XP") == 0) |
| 218 | { |
| 219 | if (clienttag) |
| 220 | { |
| 221 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: client type was already specified as \"%s\"\n", argv[0], clienttag); |
| 222 | usagecxx . . $ `$anonymous_namespace_src/client/bnftp.cpp`/usage(85c52e162fed56f9).(argv[0]); |
| 223 | } |
| 224 | clienttag = CLIENTTAG_DIABLO2XPcxx . . $ `src/common/tag.h:104:9`!; |
| 225 | } |
| 226 | else if (stdcxx . . $ std/::strcmp(argv[a], "--client=WAR3") == 0) |
| 227 | { |
| 228 | if (clienttag) |
| 229 | { |
| 230 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: client type was already specified as \"%s\"\n", argv[0], clienttag); |
| 231 | usagecxx . . $ `$anonymous_namespace_src/client/bnftp.cpp`/usage(85c52e162fed56f9).(argv[0]); |
| 232 | } |
| 233 | clienttag = CLIENTTAG_WARCRAFT3cxx . . $ `src/common/tag.h:110:9`!; |
| 234 | newproto = 1; |
| 235 | } |
| 236 | else if (stdcxx . . $ std/::strcmp(argv[a], "--client=W3XP") == 0) |
| 237 | { |
| 238 | if (clienttag) |
| 239 | { |
| 240 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: client type was already specified as \"%s\"\n", argv[0], clienttag); |
| 241 | usagecxx . . $ `$anonymous_namespace_src/client/bnftp.cpp`/usage(85c52e162fed56f9).(argv[0]); |
| 242 | } |
| 243 | clienttag = CLIENTTAG_WAR3XPcxx . . $ `src/common/tag.h:112:9`!; |
| 244 | newproto = 1; |
| 245 | } |
| 246 | else if (stdcxx . . $ std/::strncmp(argv[a], "--client=", 9) == 0) |
| 247 | { |
| 248 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: unknown client tag \"%s\"\n", argv[0], &argv[a][9]); |
| 249 | usagecxx . . $ `$anonymous_namespace_src/client/bnftp.cpp`/usage(85c52e162fed56f9).(argv[0]); |
| 250 | } |
| 251 | else if (stdcxx . . $ std/::strcmp(argv[a], "--arch=IX86") == 0) |
| 252 | { |
| 253 | if (archtag) |
| 254 | { |
| 255 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: architecture type was already specified as \"%s\"\n", argv[0], archtag); |
| 256 | usagecxx . . $ `$anonymous_namespace_src/client/bnftp.cpp`/usage(85c52e162fed56f9).(argv[0]); |
| 257 | } |
| 258 | archtag = ARCHTAG_WINX86cxx . . $ `src/common/tag.h:155:9`!; |
| 259 | } |
| 260 | else if (stdcxx . . $ std/::strcmp(argv[a], "--arch=PMAC") == 0) |
| 261 | { |
| 262 | if (archtag) |
| 263 | { |
| 264 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: architecture type was already specified as \"%s\"\n", argv[0], archtag); |
| 265 | usagecxx . . $ `$anonymous_namespace_src/client/bnftp.cpp`/usage(85c52e162fed56f9).(argv[0]); |
| 266 | } |
| 267 | archtag = ARCHTAG_MACPPCcxx . . $ `src/common/tag.h:156:9`!; |
| 268 | } |
| 269 | else if (stdcxx . . $ std/::strcmp(argv[a], "--arch=XMAC") == 0) |
| 270 | { |
| 271 | if (archtag) |
| 272 | { |
| 273 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: architecture type was already specified as \"%s\"\n", argv[0], archtag); |
| 274 | usagecxx . . $ `$anonymous_namespace_src/client/bnftp.cpp`/usage(85c52e162fed56f9).(argv[0]); |
| 275 | } |
| 276 | archtag = ARCHTAG_OSXPPCcxx . . $ `src/common/tag.h:157:9`!; |
| 277 | } |
| 278 | else if (stdcxx . . $ std/::strncmp(argv[a], "--arch=", 9) == 0) |
| 279 | { |
| 280 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: unknown architecture tag \"%s\"\n", argv[0], &argv[a][9]); |
| 281 | usagecxx . . $ `$anonymous_namespace_src/client/bnftp.cpp`/usage(85c52e162fed56f9).(argv[0]); |
| 282 | } |
| 283 | else if (stdcxx . . $ std/::strncmp(argv[a], "--hexdump=", 10) == 0) |
| 284 | { |
| 285 | if (hexfile) |
| 286 | { |
| 287 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: hexdump file was already specified as \"%s\"\n", argv[0], hexfile); |
| 288 | usagecxx . . $ `$anonymous_namespace_src/client/bnftp.cpp`/usage(85c52e162fed56f9).(argv[0]); |
| 289 | } |
| 290 | hexfile = &argv[a][10]; |
| 291 | } |
| 292 | else if (stdcxx . . $ std/::strncmp(argv[a], "--startoffset=", 14) == 0) |
| 293 | { |
| 294 | if (startoffsetoverride) |
| 295 | { |
| 296 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: startoffset was already specified as %u\n", argv[0], startoffset); |
| 297 | usagecxx . . $ `$anonymous_namespace_src/client/bnftp.cpp`/usage(85c52e162fed56f9).(argv[0]); |
| 298 | } |
| 299 | if (str_to_uintcxx . . $ pvpgn/str_to_uint(6974107818eeb505).(&argv[a][14], &startoffset) < 0) |
| 300 | { |
| 301 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: startoffset \"%s\" should be a positive integer\n", argv[0], &argv[a][14]); |
| 302 | usagecxx . . $ `$anonymous_namespace_src/client/bnftp.cpp`/usage(85c52e162fed56f9).(argv[0]); |
| 303 | } |
| 304 | startoffsetoverride = 1; |
| 305 | } |
| 306 | else if (stdcxx . . $ std/::strncmp(argv[a], "--exists=", 9) == 0) |
| 307 | { |
| 308 | if (exist_action != EXIST_ACTION_UNSPECcxx . . $ `src/client/bnftp.cpp:119:9`!) |
| 309 | { |
| 310 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: exists was already specified\n", argv[0]); |
| 311 | usagecxx . . $ `$anonymous_namespace_src/client/bnftp.cpp`/usage(85c52e162fed56f9).(argv[0]); |
| 312 | } |
| 313 | if (argv[a][9] == 'o' || argv[a][9] == 'O') |
| 314 | exist_action = EXIST_ACTION_OVERWRITEcxx . . $ `src/client/bnftp.cpp:121:9`!; |
| 315 | else if (argv[a][9] == 'a' || argv[a][9] == 'A') |
| 316 | exist_action = EXIST_ACTION_ASKcxx . . $ `src/client/bnftp.cpp:120:9`!; |
| 317 | else if (argv[a][9] == 'b' || argv[a][9] == 'B') |
| 318 | exist_action = EXIST_ACTION_BACKUPcxx . . $ `src/client/bnftp.cpp:122:9`!; |
| 319 | else if (argv[a][9] == 'r' || argv[a][9] == 'R') |
| 320 | exist_action = EXIST_ACTION_RESUMEcxx . . $ `src/client/bnftp.cpp:123:9`!; |
| 321 | else { |
| 322 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: exists must begin with a,A,o,O,b,B,r or R", argv[0]); |
| 323 | usagecxx . . $ `$anonymous_namespace_src/client/bnftp.cpp`/usage(85c52e162fed56f9).(argv[0]); |
| 324 | } |
| 325 | } |
| 326 | else if (stdcxx . . $ std/::strncmp(argv[a], "--file=", 7) == 0) |
| 327 | { |
| 328 | if (reqfile) |
| 329 | { |
| 330 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: file was already specified as \"%s\"\n", argv[0], reqfile); |
| 331 | usagecxx . . $ `$anonymous_namespace_src/client/bnftp.cpp`/usage(85c52e162fed56f9).(argv[0]); |
| 332 | } |
| 333 | reqfile = &argv[a][7]; |
| 334 | } |
| 335 | else if (stdcxx . . $ std/::strcmp(argv[a], "-v") == 0 || stdcxx . . $ std/::strcmp(argv[a], "--version") == 0) |
| 336 | { |
| 337 | stdcxx . . $ std/::printfcxx . . $ std/printf(581fddd72a8db8fc).("version " PVPGN_VERSIONcxx . . $ `src/common/version.h:23:9`! "\n"); |
| 338 | return 0; |
| 339 | } |
| 340 | else if (stdcxx . . $ std/::strcmp(argv[a], "-h") == 0 || stdcxx . . $ std/::strcmp(argv[a], "--help") == 0 || stdcxx . . $ std/::strcmp(argv[a], "--usage") == 0) |
| 341 | usagecxx . . $ `$anonymous_namespace_src/client/bnftp.cpp`/usage(85c52e162fed56f9).(argv[0]); |
| 342 | else if (stdcxx . . $ std/::strcmp(argv[a], "--client") == 0 || stdcxx . . $ std/::strcmp(argv[a], "--hexdump") == 0) |
| 343 | { |
| 344 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: option \"%s\" requires an argument\n", argv[0], argv[a]); |
| 345 | usagecxx . . $ `$anonymous_namespace_src/client/bnftp.cpp`/usage(85c52e162fed56f9).(argv[0]); |
| 346 | } |
| 347 | else |
| 348 | { |
| 349 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: unknown option \"%s\"\n", argv[0], argv[a]); |
| 350 | usagecxx . . $ `$anonymous_namespace_src/client/bnftp.cpp`/usage(85c52e162fed56f9).(argv[0]); |
| 351 | } |
| 352 | |
| 353 | if (servport == 0) |
| 354 | servport = BNETD_SERV_PORTcxx . . $ BNETD_SERV_PORT.; |
| 355 | if (!clienttag) |
| 356 | clienttag = CLIENTTAG_STARCRAFTcxx . . $ `src/common/tag.h:86:9`!; |
| 357 | if (!archtag) |
| 358 | archtag = ARCHTAG_WINX86cxx . . $ `src/common/tag.h:155:9`!; |
| 359 | if (!servname) |
| 360 | servname = BNETD_DEFAULT_HOSTcxx . . $ BNETD_DEFAULT_HOST.; |
| 361 | if (exist_action == EXIST_ACTION_UNSPECcxx . . $ `src/client/bnftp.cpp:119:9`!) |
| 362 | exist_action = EXIST_ACTION_ASKcxx . . $ `src/client/bnftp.cpp:120:9`!; |
| 363 | |
| 364 | if (hexfile) |
| 365 | { |
| 366 | if (!(hexstrm = stdcxx . . $ std/::fopencxx . . $ std/fopen(82ec0787cd37e0a3).(hexfile, "w"))) |
| 367 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: could not open file \"%s\" for writing the hexdump (std::fopen: %s)", argv[0], hexfile, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 368 | else |
| 369 | { |
| 370 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(hexstrm, "# dump generated by bnftp version " PVPGN_VERSIONcxx . . $ `src/common/version.h:23:9`! "\n"); |
| 371 | } |
| 372 | } |
| 373 | |
| 374 | if (psock_initcxx . . $ `src/compat/psock.h:284:9`!() < 0) |
| 375 | { |
| 376 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: could not inialialize socket functions\n", argv[0]); |
| 377 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!; |
| 378 | } |
| 379 | |
| 380 | if (!(host = gethostbyname(servname))) |
| 381 | { |
| 382 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: unknown host \"%s\"\n", argv[0], servname); |
| 383 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!; |
| 384 | } |
| 385 | |
| 386 | fd_stdin = fileno(stdincxx . . $ `<external>/232824719582829767/stdio.h:153:9`!); |
| 387 | if (tcgetattr(fd_stdin, &in_attr_old) >= 0) |
| 388 | { |
| 389 | in_attr_new = in_attr_old; |
| 390 | in_attr_new.c_lflag &= ~(ECHOcxx . . $ `<external>/2220421410900157355/termios-c_lflag.h:29:9`! | ICANONcxx . . $ `<external>/2220421410900157355/termios-c_lflag.h:25:9`!); /* turn off ECHO and ICANON */ |
| 391 | in_attr_new.c_cc[VMINcxx . . $ `<external>/5505922754558120548/termios-c_cc.h:30:9`!] = 1; /* require reads to return at least one byte */ |
| 392 | in_attr_new.c_cc[VTIMEcxx . . $ `<external>/5505922754558120548/termios-c_cc.h:29:9`!] = 0; /* no timeout */ |
| 393 | tcsetattr(fd_stdin, TCSANOWcxx . . $ `<external>/7740429199341890421/termios-tcflow.h:24:9`!, &in_attr_new); |
| 394 | changed_in = 1; |
| 395 | } |
| 396 | else |
| 397 | { |
| 398 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: could not get terminal attributes for stdin\n", argv[0]); |
| 399 | changed_in = 0; |
| 400 | } |
| 401 | |
| 402 | if (client_get_termsizecxx . . $ pvpgn/client/client_get_termsize(1ea1e3350d45fd0e).(fd_stdin, &screen_width, &screen_height) < 0) |
| 403 | { |
| 404 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: could not determine screen size\n", argv[0]); |
| 405 | if (changed_in) |
| 406 | tcsetattr(fd_stdin, TCSAFLUSHcxx . . $ `<external>/7740429199341890421/termios-tcflow.h:26:9`!, &in_attr_old); |
| 407 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!; |
| 408 | } |
| 409 | |
| 410 | if ((sd = psock_socketcxx . . $ `src/compat/psock.h:287:9`!(PSOCK_PF_INETcxx . . $ `src/compat/psock.h:186:9`!, PSOCK_SOCK_STREAMcxx . . $ `src/compat/psock.h:192:9`!, PSOCK_IPPROTO_TCPcxx . . $ `src/compat/psock.h:197:10`!)) < 0) |
| 411 | { |
| 412 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: could not create socket (psock_socket: %s)\n", argv[0], stdcxx . . $ std/::strerror(psock_errnocxx . . $ `src/compat/psock.h:286:9`!())); |
| 413 | if (changed_in) |
| 414 | tcsetattr(fd_stdin, TCSAFLUSHcxx . . $ `<external>/7740429199341890421/termios-tcflow.h:26:9`!, &in_attr_old); |
| 415 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!; |
| 416 | } |
| 417 | |
| 418 | stdcxx . . $ std/::memset(&saddr, 0, sizeof(saddr)); |
| 419 | saddr.sin_family = PSOCK_AF_INETcxx . . $ `src/compat/psock.h:189:9`!; |
| 420 | saddr.sin_port = htons(servport); |
| 421 | stdcxx . . $ std/::memcpy(&saddr.sin_addr.s_addr, host->h_addr_list[0], host->h_length); |
| 422 | if (psock_connectcxx . . $ `src/compat/psock.h:294:9`!(sd, (struct sockaddr *)&saddr, sizeof(saddr)) < 0) |
| 423 | { |
| 424 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: could not connect to server \"%s\" port %hu (psock_connect: %s)\n", argv[0], servname, servport, stdcxx . . $ std/::strerror(psock_errnocxx . . $ `src/compat/psock.h:286:9`!())); |
| 425 | if (changed_in) |
| 426 | tcsetattr(fd_stdin, TCSAFLUSHcxx . . $ `<external>/7740429199341890421/termios-tcflow.h:26:9`!, &in_attr_old); |
| 427 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!; |
| 428 | } |
| 429 | |
| 430 | char addrstr[INET_ADDRSTRLENcxx . . $ `<external>/9581057695539925927/in.h:244:9`!] = { 0 }; |
| 431 | inet_ntop(AF_INETcxx . . $ `<external>/8962547315054503424/socket.h:97:9`!, &(saddr.sin_addr), addrstr, sizeof(addrstr)); |
| 432 | stdcxx . . $ std/::printfcxx . . $ std/printf(581fddd72a8db8fc).("Connected to %s:%hu.\n", addrstr, servport); |
| 433 | |
| 434 | #ifdef CLIENTDEBUGcxx . . $ `src/common/setup_before.h:49:9`! |
| 435 | eventlog_setcxx . . $ pvpgn/eventlog_set(8d4262d45fc644ab).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!); |
| 436 | #endif |
| 437 | |
| 438 | if (!(packet = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_initcxx . . $ pvpgn/packet_class_init.))) |
| 439 | { |
| 440 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: could not create packet\n", argv[0]); |
| 441 | if (changed_in) |
| 442 | tcsetattr(fd_stdin, TCSAFLUSHcxx . . $ `<external>/7740429199341890421/termios-tcflow.h:26:9`!, &in_attr_old); |
| 443 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!; |
| 444 | } |
| 445 | bn_byte_set(&packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_initconncxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_initconn..cclasscxx . . $ pvpgn/$anonymous_type_7cca3803bac3bad7_0#cclass., CLIENT_INITCONN_CLASS_FILEcxx . . $ `src/common/init_protocol.h:60:9`!); |
| 446 | if (hexstrm) |
| 447 | { |
| 448 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(hexstrm, "%d: send class=%s[0x%02hx] type=%s[0x%04hx] length=%u\n", |
| 449 | sd, |
| 450 | packet_get_class_strcxx . . $ pvpgn/packet_get_class_str(a17b58f78809526d).(packet), (unsigned int)packet_get_classcxx . . $ pvpgn/packet_get_class(6361653567fd72e5).(packet), |
| 451 | packet_get_type_strcxx . . $ pvpgn/packet_get_type_str(4ae5f643727ae88e).(packet, packet_dir_from_clientcxx . . $ pvpgn/packet_dir_from_client.), packet_get_typecxx . . $ pvpgn/packet_get_type(e4ac9e2b4744cb4b).(packet), |
| 452 | packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet)); |
| 453 | hexdumpcxx . . $ pvpgn/hexdump(23ce3b3157473ba).(hexstrm, packet_get_raw_datacxx . . $ pvpgn/packet_get_raw_data(ed324b086ed1b636).(packet, 0), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet)); |
| 454 | } |
| 455 | client_blocksend_packetcxx . . $ pvpgn/client/client_blocksend_packet(906e81e3c6d5802b).(sd, packet); |
| 456 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(packet); |
| 457 | |
| 458 | if (!(rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_filecxx . . $ pvpgn/packet_class_file.))) |
| 459 | { |
| 460 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: could not create packet\n", argv[0]); |
| 461 | if (changed_in) |
| 462 | tcsetattr(fd_stdin, TCSAFLUSHcxx . . $ `<external>/7740429199341890421/termios-tcflow.h:26:9`!, &in_attr_old); |
| 463 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!; |
| 464 | } |
| 465 | |
| 466 | if (!(fpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_rawcxx . . $ pvpgn/packet_class_raw.))) |
| 467 | { |
| 468 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: could not create packet\n", argv[0]); |
| 469 | if (changed_in) |
| 470 | tcsetattr(fd_stdin, TCSAFLUSHcxx . . $ `<external>/7740429199341890421/termios-tcflow.h:26:9`!, &in_attr_old); |
| 471 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket); |
| 472 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!; |
| 473 | } |
| 474 | |
| 475 | if (!reqfile) /* if not specified on the command line then prompt for it */ |
| 476 | { |
| 477 | munged = 1; |
| 478 | commpos = 0; |
| 479 | text[0] = '\0'; |
| 480 | |
| 481 | for (;;) |
| 482 | { |
| 483 | switch (client_get_commcxx . . $ pvpgn/client/client_get_comm(e9a6a98b384956c7).("filename: ", text, sizeof(text), &commpos, 1, munged, screen_width)) |
| 484 | { |
| 485 | case -1: /* cancel or error */ |
| 486 | stdcxx . . $ std/::printfcxx . . $ std/printf(581fddd72a8db8fc).("\n"); |
| 487 | if (changed_in) |
| 488 | tcsetattr(fd_stdin, TCSAFLUSHcxx . . $ `<external>/7740429199341890421/termios-tcflow.h:26:9`!, &in_attr_old); |
| 489 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(fpacket); |
| 490 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket); |
| 491 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!; |
| 492 | |
| 493 | case 0: /* timeout */ |
| 494 | munged = 0; |
| 495 | continue; |
| 496 | |
| 497 | case 1: |
| 498 | munged = 0; |
| 499 | if (text[0] == '\0') |
| 500 | continue; |
| 501 | stdcxx . . $ std/::printfcxx . . $ std/printf(581fddd72a8db8fc).("\n"); |
| 502 | } |
| 503 | break; |
| 504 | } |
| 505 | reqfile = text; |
| 506 | } |
| 507 | |
| 508 | if (stat(reqfile, &exist_buf) == 0) /* check if the file exists */ |
| 509 | { |
| 510 | char text2[MAX_MESSAGE_LENcxx . . $ MAX_MESSAGE_LEN.]; |
| 511 | |
| 512 | munged = 1; |
| 513 | commpos = 0; |
| 514 | text2[0] = '\0'; |
| 515 | |
| 516 | while (exist_action == EXIST_ACTION_ASKcxx . . $ `src/client/bnftp.cpp:120:9`!) |
| 517 | { |
| 518 | switch (client_get_commcxx . . $ pvpgn/client/client_get_comm(e9a6a98b384956c7).("File exists [O]verwrite, [B]ackup or [R]esume?: ", text2, sizeof(text2), &commpos, 1, munged, screen_width)) |
| 519 | { |
| 520 | case -1: /* cancel or error */ |
| 521 | stdcxx . . $ std/::printfcxx . . $ std/printf(581fddd72a8db8fc).("\n"); |
| 522 | if (changed_in) |
| 523 | tcsetattr(fd_stdin, TCSAFLUSHcxx . . $ `<external>/7740429199341890421/termios-tcflow.h:26:9`!, &in_attr_old); |
| 524 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(fpacket); |
| 525 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket); |
| 526 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!; |
| 527 | |
| 528 | case 0: /* timeout */ |
| 529 | munged = 0; |
| 530 | continue; |
| 531 | |
| 532 | case 1: |
| 533 | munged = 0; |
| 534 | if (text2[0] == '\0') |
| 535 | continue; |
| 536 | stdcxx . . $ std/::printfcxx . . $ std/printf(581fddd72a8db8fc).("\n"); |
| 537 | break; |
| 538 | } |
| 539 | |
| 540 | switch (text2[0]) |
| 541 | { |
| 542 | case 'o': |
| 543 | case 'O': |
| 544 | exist_action = EXIST_ACTION_OVERWRITEcxx . . $ `src/client/bnftp.cpp:121:9`!; |
| 545 | break; |
| 546 | case 'b': |
| 547 | case 'B': |
| 548 | exist_action = EXIST_ACTION_BACKUPcxx . . $ `src/client/bnftp.cpp:122:9`!; |
| 549 | break; |
| 550 | case 'r': |
| 551 | case 'R': |
| 552 | exist_action = EXIST_ACTION_RESUMEcxx . . $ `src/client/bnftp.cpp:123:9`!; |
| 553 | break; |
| 554 | default: |
| 555 | stdcxx . . $ std/::printfcxx . . $ std/printf(581fddd72a8db8fc).("Please answer with o,O,b,B,r or R.\n"); |
| 556 | munged = 1; |
| 557 | continue; |
| 558 | } |
| 559 | break; |
| 560 | } |
| 561 | |
| 562 | switch (exist_action) |
| 563 | { |
| 564 | case EXIST_ACTION_OVERWRITEcxx . . $ `src/client/bnftp.cpp:121:9`!: |
| 565 | if (!startoffsetoverride) |
| 566 | startoffset = 0; |
| 567 | break; |
| 568 | case EXIST_ACTION_BACKUPcxx . . $ `src/client/bnftp.cpp:122:9`!: |
| 569 | { |
| 570 | char * bakfile; |
| 571 | unsigned int bnr; |
| 572 | int renamed = 0; |
| 573 | |
| 574 | bakfile = (char*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(std::strlen(reqfile) + 1 + 2 + 1); /* assuming we go up to bnr 99 we need reqfile+'.'+'99'+'\0' */ |
| 575 | for (bnr = 0; bnr < 100; bnr++) |
| 576 | { |
| 577 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(bakfile, "%s.%d", reqfile, bnr); |
| 578 | if (stat(bakfile, &exist_buf) == 0) |
| 579 | continue; /* backup exists */ |
| 580 | /* backup does not exist */ |
| 581 | if (stdcxx . . $ std/::renamecxx . . $ std/rename(60a48a9ca27c28a).(reqfile, bakfile) < 0) /* just std::rename the existing file to the backup */ |
| 582 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: could not create backup file \"%s\" (std::rename: %s)\n", argv[0], bakfile, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 583 | else |
| 584 | { |
| 585 | renamed = 1; |
| 586 | stdcxx . . $ std/::printfcxx . . $ std/printf(581fddd72a8db8fc).("Renaming \"%s\" to \"%s\".\n", reqfile, bakfile); |
| 587 | } |
| 588 | break; |
| 589 | } |
| 590 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(bakfile); |
| 591 | if (!renamed) |
| 592 | { |
| 593 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: could not create backup for \"%s\".\n", argv[0], reqfile); |
| 594 | if (changed_in) |
| 595 | tcsetattr(fd_stdin, TCSAFLUSHcxx . . $ `<external>/7740429199341890421/termios-tcflow.h:26:9`!, &in_attr_old); |
| 596 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(fpacket); |
| 597 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket); |
| 598 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!; |
| 599 | } |
| 600 | if (!startoffsetoverride) |
| 601 | startoffset = 0; |
| 602 | } |
| 603 | break; |
| 604 | case EXIST_ACTION_RESUMEcxx . . $ `src/client/bnftp.cpp:123:9`!: |
| 605 | if (!startoffsetoverride) |
| 606 | startoffset = exist_buf.st_size; |
| 607 | break; |
| 608 | } |
| 609 | } |
| 610 | else |
| 611 | if (!startoffsetoverride) |
| 612 | startoffset = 0; |
| 613 | |
| 614 | if (changed_in) |
| 615 | tcsetattr(fd_stdin, TCSAFLUSHcxx . . $ `<external>/7740429199341890421/termios-tcflow.h:26:9`!, &in_attr_old); |
| 616 | |
| 617 | if (!(packet = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_filecxx . . $ pvpgn/packet_class_file.))) |
| 618 | { |
| 619 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: could not create packet\n", argv[0]); |
| 620 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(fpacket); |
| 621 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket); |
| 622 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!; |
| 623 | } |
| 624 | if (newproto) { |
| 625 | /* first send ARCH/CTAG */ |
| 626 | packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(packet, sizeof(t_client_file_req2cxx . . $ pvpgn/t_client_file_req2#)); |
| 627 | packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(packet, CLIENT_FILE_REQ2cxx . . $ `src/common/file_protocol.h:92:9`!); |
| 628 | bn_int_tag_set(&packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_file_req2cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_file_req2..archtagcxx . . $ pvpgn/$anonymous_type_d2bac4e24f922c3_3#archtag., archtag); |
| 629 | bn_int_tag_set(&packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_file_req2cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_file_req2..clienttagcxx . . $ pvpgn/$anonymous_type_d2bac4e24f922c3_3#clienttag., clienttag); |
| 630 | bn_long_set_a_b(&packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_file_req2cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_file_req2..unknown1cxx . . $ pvpgn/$anonymous_type_d2bac4e24f922c3_3#unknown1., 0, 0); |
| 631 | } |
| 632 | else { |
| 633 | packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(packet, sizeof(t_client_file_reqcxx . . $ pvpgn/t_client_file_req#)); |
| 634 | packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(packet, CLIENT_FILE_REQcxx . . $ `src/common/file_protocol.h:68:9`!); |
| 635 | bn_int_tag_set(&packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_file_reqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_file_req..archtagcxx . . $ pvpgn/$anonymous_type_d2bac4e24f922c3_2#archtag., archtag); |
| 636 | bn_int_tag_set(&packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_file_reqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_file_req..clienttagcxx . . $ pvpgn/$anonymous_type_d2bac4e24f922c3_2#clienttag., clienttag); |
| 637 | bn_int_set(&packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_file_reqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_file_req..adidcxx . . $ pvpgn/$anonymous_type_d2bac4e24f922c3_2#adid., 0); |
| 638 | bn_int_set(&packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_file_reqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_file_req..extensiontagcxx . . $ pvpgn/$anonymous_type_d2bac4e24f922c3_2#extensiontag., 0); |
| 639 | bn_int_set(&packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_file_reqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_file_req..startoffsetcxx . . $ pvpgn/$anonymous_type_d2bac4e24f922c3_2#startoffset., startoffset); |
| 640 | bn_long_set_a_b(&packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_file_reqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_file_req..timestampcxx . . $ pvpgn/$anonymous_type_d2bac4e24f922c3_2#timestamp., 0x00000000, 0x00000000); |
| 641 | packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(packet, reqfile); |
| 642 | } |
| 643 | if (hexstrm) |
| 644 | { |
| 645 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(hexstrm, "%d: send class=%s[0x%02hx] type=%s[0x%04hx] length=%u\n", |
| 646 | sd, |
| 647 | packet_get_class_strcxx . . $ pvpgn/packet_get_class_str(a17b58f78809526d).(packet), (unsigned int)packet_get_classcxx . . $ pvpgn/packet_get_class(6361653567fd72e5).(packet), |
| 648 | packet_get_type_strcxx . . $ pvpgn/packet_get_type_str(4ae5f643727ae88e).(packet, packet_dir_from_clientcxx . . $ pvpgn/packet_dir_from_client.), packet_get_typecxx . . $ pvpgn/packet_get_type(e4ac9e2b4744cb4b).(packet), |
| 649 | packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet)); |
| 650 | hexdumpcxx . . $ pvpgn/hexdump(23ce3b3157473ba).(hexstrm, packet_get_raw_datacxx . . $ pvpgn/packet_get_raw_data(ed324b086ed1b636).(packet, 0), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet)); |
| 651 | } |
| 652 | if (newproto) stdcxx . . $ std/::printfcxx . . $ std/printf(581fddd72a8db8fc).("\nSending ARCH/CTAG info..."); |
| 653 | else stdcxx . . $ std/::printfcxx . . $ std/printf(581fddd72a8db8fc).("\nRequesting info..."); |
| 654 | stdcxx . . $ std/::fflushcxx . . $ std/fflush(89bc1efcdac0ca22).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!); |
| 655 | client_blocksend_packetcxx . . $ pvpgn/client/client_blocksend_packet(906e81e3c6d5802b).(sd, packet); |
| 656 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(packet); |
| 657 | |
| 658 | if (newproto) { |
| 659 | /* received the stupid 4 bytes unknown "packet" */ |
| 660 | packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(fpacket, sizeof(t_server_file_unknown1cxx . . $ pvpgn/t_server_file_unknown1#)); |
| 661 | if (client_blockrecv_packetcxx . . $ pvpgn/client/client_blockrecv_packet(98f963a6be74727b).(sd, fpacket) < 0) |
| 662 | { |
| 663 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: server closed connection\n", argv[0]); |
| 664 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(fpacket); |
| 665 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket); |
| 666 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!; |
| 667 | } |
| 668 | if (hexstrm) |
| 669 | { |
| 670 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(hexstrm, "%d: recv class=%s[0x%02hx] type=%s[0x%04hx] length=%u\n", |
| 671 | sd, |
| 672 | packet_get_class_strcxx . . $ pvpgn/packet_get_class_str(a17b58f78809526d).(fpacket), (unsigned int)packet_get_classcxx . . $ pvpgn/packet_get_class(6361653567fd72e5).(fpacket), |
| 673 | packet_get_type_strcxx . . $ pvpgn/packet_get_type_str(4ae5f643727ae88e).(fpacket, packet_dir_from_servercxx . . $ pvpgn/packet_dir_from_server.), packet_get_typecxx . . $ pvpgn/packet_get_type(e4ac9e2b4744cb4b).(fpacket), |
| 674 | packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(fpacket)); |
| 675 | hexdumpcxx . . $ pvpgn/hexdump(23ce3b3157473ba).(hexstrm, packet_get_raw_datacxx . . $ pvpgn/packet_get_raw_data(ed324b086ed1b636).(fpacket, 0), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(fpacket)); |
| 676 | } |
| 677 | |
| 678 | /* send file info request */ |
| 679 | packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(fpacket, sizeof(t_client_file_req3cxx . . $ pvpgn/t_client_file_req3#)); |
| 680 | bn_int_set(&fpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_file_req3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_file_req3..unknown1cxx . . $ pvpgn/$anonymous_type_d2bac4e24f922c3_4#unknown1., 0); |
| 681 | bn_long_set_a_b(&fpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_file_req3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_file_req3..timestampcxx . . $ pvpgn/$anonymous_type_d2bac4e24f922c3_4#timestamp., 0, 0); |
| 682 | bn_long_set_a_b(&fpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_file_req3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_file_req3..unknown2cxx . . $ pvpgn/$anonymous_type_d2bac4e24f922c3_4#unknown2., 0, 0); |
| 683 | bn_long_set_a_b(&fpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_file_req3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_file_req3..unknown3cxx . . $ pvpgn/$anonymous_type_d2bac4e24f922c3_4#unknown3., 0, 0); |
| 684 | bn_long_set_a_b(&fpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_file_req3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_file_req3..unknown4cxx . . $ pvpgn/$anonymous_type_d2bac4e24f922c3_4#unknown4., 0, 0); |
| 685 | bn_long_set_a_b(&fpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_file_req3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_file_req3..unknown5cxx . . $ pvpgn/$anonymous_type_d2bac4e24f922c3_4#unknown5., 0, 0); |
| 686 | bn_long_set_a_b(&fpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..client_file_req3cxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#client_file_req3..unknown6cxx . . $ pvpgn/$anonymous_type_d2bac4e24f922c3_4#unknown6., 0, 0); |
| 687 | packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(fpacket, reqfile); |
| 688 | stdcxx . . $ std/::printfcxx . . $ std/printf(581fddd72a8db8fc).("\nRequesting info..."); |
| 689 | stdcxx . . $ std/::fflushcxx . . $ std/fflush(89bc1efcdac0ca22).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!); |
| 690 | client_blocksend_packetcxx . . $ pvpgn/client/client_blocksend_packet(906e81e3c6d5802b).(sd, fpacket); |
| 691 | if (hexstrm) |
| 692 | { |
| 693 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(hexstrm, "%d: send class=%s[0x%02hx] type=%s[0x%04hx] length=%u\n", |
| 694 | sd, |
| 695 | packet_get_class_strcxx . . $ pvpgn/packet_get_class_str(a17b58f78809526d).(fpacket), (unsigned int)packet_get_classcxx . . $ pvpgn/packet_get_class(6361653567fd72e5).(fpacket), |
| 696 | packet_get_type_strcxx . . $ pvpgn/packet_get_type_str(4ae5f643727ae88e).(fpacket, packet_dir_from_clientcxx . . $ pvpgn/packet_dir_from_client.), packet_get_typecxx . . $ pvpgn/packet_get_type(e4ac9e2b4744cb4b).(fpacket), |
| 697 | packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(fpacket)); |
| 698 | hexdumpcxx . . $ pvpgn/hexdump(23ce3b3157473ba).(hexstrm, packet_get_raw_datacxx . . $ pvpgn/packet_get_raw_data(ed324b086ed1b636).(fpacket, 0), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(fpacket)); |
| 699 | } |
| 700 | } |
| 701 | do |
| 702 | { |
| 703 | if (client_blockrecv_packetcxx . . $ pvpgn/client/client_blockrecv_packet(98f963a6be74727b).(sd, rpacket) < 0) |
| 704 | { |
| 705 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: server closed connection\n", argv[0]); |
| 706 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(fpacket); |
| 707 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket); |
| 708 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!; |
| 709 | } |
| 710 | if (hexstrm) |
| 711 | { |
| 712 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(hexstrm, "%d: recv class=%s[0x%02hx] type=%s[0x%04hx] length=%u\n", |
| 713 | sd, |
| 714 | packet_get_class_strcxx . . $ pvpgn/packet_get_class_str(a17b58f78809526d).(rpacket), (unsigned int)packet_get_classcxx . . $ pvpgn/packet_get_class(6361653567fd72e5).(rpacket), |
| 715 | packet_get_type_strcxx . . $ pvpgn/packet_get_type_str(4ae5f643727ae88e).(rpacket, packet_dir_from_servercxx . . $ pvpgn/packet_dir_from_server.), packet_get_typecxx . . $ pvpgn/packet_get_type(e4ac9e2b4744cb4b).(rpacket), |
| 716 | packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(rpacket)); |
| 717 | hexdumpcxx . . $ pvpgn/hexdump(23ce3b3157473ba).(hexstrm, packet_get_raw_datacxx . . $ pvpgn/packet_get_raw_data(ed324b086ed1b636).(rpacket, 0), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(rpacket)); |
| 718 | } |
| 719 | } while (packet_get_typecxx . . $ pvpgn/packet_get_type(e4ac9e2b4744cb4b).(rpacket) != SERVER_FILE_REPLYcxx . . $ `src/common/file_protocol.h:130:9`!); |
| 720 | |
| 721 | filelen = bn_int_get(rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_file_replycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_file_reply..filelencxx . . $ pvpgn/$anonymous_type_d2bac4e24f922c3_5#filelen.); |
| 722 | bn_long_to_bnettimecxx . . $ pvpgn/bn_long_to_bnettime(42c8eeb10f75b1bc).(rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..server_file_replycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#server_file_reply..timestampcxx . . $ pvpgn/$anonymous_type_d2bac4e24f922c3_5#timestamp., &bntime); |
| 723 | tm = bnettime_to_timecxx . . $ pvpgn/bnettime_to_time(f37c7c75a9c2d829).(bntime); |
| 724 | stdcxx . . $ std/::strftimecxx . . $ std/strftime(689617e6f2fd1a9a).(timestr, FILE_TIME_MAXLENcxx . . $ FILE_TIME_MAXLEN., FILE_TIME_FORMATcxx . . $ `src/common/setup_before.h:103:9`!, stdcxx . . $ std/::localtimecxx . . $ std/localtime(7d91c9e5f6bb884b).(&tm)); |
| 725 | filename = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(rpacket, sizeof(t_server_file_replycxx . . $ pvpgn/t_server_file_reply#), MAX_FILENAME_STRcxx . . $ MAX_FILENAME_STR.); |
| 726 | |
| 727 | if (exist_action == EXIST_ACTION_RESUMEcxx . . $ `src/client/bnftp.cpp:123:9`!) |
| 728 | { |
| 729 | if (!(fp = stdcxx . . $ std/::fopencxx . . $ std/fopen(82ec0787cd37e0a3).(reqfile, "ab"))) |
| 730 | { |
| 731 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: could not open file \"%s\" for appending (std::fopen: %s)\n", argv[0], reqfile, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 732 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(fpacket); |
| 733 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket); |
| 734 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!; |
| 735 | } |
| 736 | } |
| 737 | else |
| 738 | { |
| 739 | if (!(fp = stdcxx . . $ std/::fopencxx . . $ std/fopen(82ec0787cd37e0a3).(reqfile, "wb"))) |
| 740 | { |
| 741 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: could not open file \"%s\" for writing (std::fopen: %s)\n", argv[0], reqfile, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 742 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(fpacket); |
| 743 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket); |
| 744 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!; |
| 745 | } |
| 746 | } |
| 747 | |
| 748 | stdcxx . . $ std/::printfcxx . . $ std/printf(581fddd72a8db8fc).("\n name: \""); |
| 749 | str_print_termcxx . . $ pvpgn/str_print_term(977aada8a81832c9).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, filename, 0, 0); |
| 750 | stdcxx . . $ std/::printfcxx . . $ std/printf(581fddd72a8db8fc).("\"\n changed: %s\n length: %u bytes\n", timestr, filelen); |
| 751 | stdcxx . . $ std/::fflushcxx . . $ std/fflush(89bc1efcdac0ca22).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!); |
| 752 | |
| 753 | if (startoffset > 0) { |
| 754 | filelen -= startoffset; /* for resuming files */ |
| 755 | stdcxx . . $ std/::printfcxx . . $ std/printf(581fddd72a8db8fc).("Resuming at position %u (%u bytes remaining).\n", startoffset, filelen); |
| 756 | } |
| 757 | |
| 758 | stdcxx . . $ std/::printfcxx . . $ std/printf(581fddd72a8db8fc).("\nSaving to \"%s\"...", reqfile); |
| 759 | |
| 760 | for (currsize = 0; currsize + MAX_PACKET_SIZEcxx . . $ MAX_PACKET_SIZE. <= filelen; currsize += MAX_PACKET_SIZEcxx . . $ MAX_PACKET_SIZE.) |
| 761 | { |
| 762 | stdcxx . . $ std/::printfcxx . . $ std/printf(581fddd72a8db8fc).("."); |
| 763 | stdcxx . . $ std/::fflushcxx . . $ std/fflush(89bc1efcdac0ca22).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!); |
| 764 | |
| 765 | if (client_blockrecv_raw_packetcxx . . $ pvpgn/client/client_blockrecv_raw_packet(8525baaf8ed3d6bc).(sd, fpacket, MAX_PACKET_SIZEcxx . . $ MAX_PACKET_SIZE.) < 0) |
| 766 | { |
| 767 | stdcxx . . $ std/::printfcxx . . $ std/printf(581fddd72a8db8fc).("error\n"); |
| 768 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: server closed connection\n", argv[0]); |
| 769 | if (stdcxx . . $ std/::fclosecxx . . $ std/fclose(89bc1efcdac0ca22).(fp) < 0) |
| 770 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: could not close file \"%s\" after writing (std::fclose: %s)\n", argv[0], reqfile, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 771 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(fpacket); |
| 772 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket); |
| 773 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!; |
| 774 | } |
| 775 | if (hexstrm) |
| 776 | { |
| 777 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(hexstrm, "%d: recv class=%s[0x%02hx] type=%s[0x%04hx] length=%u\n", |
| 778 | sd, |
| 779 | packet_get_class_strcxx . . $ pvpgn/packet_get_class_str(a17b58f78809526d).(fpacket), (unsigned int)packet_get_classcxx . . $ pvpgn/packet_get_class(6361653567fd72e5).(fpacket), |
| 780 | packet_get_type_strcxx . . $ pvpgn/packet_get_type_str(4ae5f643727ae88e).(fpacket, packet_dir_from_servercxx . . $ pvpgn/packet_dir_from_server.), packet_get_typecxx . . $ pvpgn/packet_get_type(e4ac9e2b4744cb4b).(fpacket), |
| 781 | packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(fpacket)); |
| 782 | hexdumpcxx . . $ pvpgn/hexdump(23ce3b3157473ba).(hexstrm, packet_get_raw_datacxx . . $ pvpgn/packet_get_raw_data(ed324b086ed1b636).(fpacket, 0), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(fpacket)); |
| 783 | } |
| 784 | if (stdcxx . . $ std/::fwritecxx . . $ std/fwrite(ab0609fa07c47d6e).(packet_get_raw_data_constcxx . . $ pvpgn/packet_get_raw_data_const(1f58ab00371793b4).(fpacket, 0), 1, MAX_PACKET_SIZEcxx . . $ MAX_PACKET_SIZE., fp) < MAX_PACKET_SIZEcxx . . $ MAX_PACKET_SIZE.) |
| 785 | { |
| 786 | stdcxx . . $ std/::printfcxx . . $ std/printf(581fddd72a8db8fc).("error\n"); |
| 787 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: could not write to file \"%s\" (std::fwrite: %s)\n", argv[0], reqfile, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 788 | if (stdcxx . . $ std/::fclosecxx . . $ std/fclose(89bc1efcdac0ca22).(fp) < 0) |
| 789 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: could not close file \"%s\" after writing (std::fclose: %s)\n", argv[0], reqfile, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 790 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(fpacket); |
| 791 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket); |
| 792 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!; |
| 793 | } |
| 794 | } |
| 795 | filelen -= currsize; |
| 796 | if (filelen) |
| 797 | { |
| 798 | stdcxx . . $ std/::printfcxx . . $ std/printf(581fddd72a8db8fc).("."); |
| 799 | stdcxx . . $ std/::fflushcxx . . $ std/fflush(89bc1efcdac0ca22).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!); |
| 800 | |
| 801 | if (client_blockrecv_raw_packetcxx . . $ pvpgn/client/client_blockrecv_raw_packet(8525baaf8ed3d6bc).(sd, fpacket, filelen) < 0) |
| 802 | { |
| 803 | stdcxx . . $ std/::printfcxx . . $ std/printf(581fddd72a8db8fc).("error\n"); |
| 804 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: server closed connection\n", argv[0]); |
| 805 | if (stdcxx . . $ std/::fclosecxx . . $ std/fclose(89bc1efcdac0ca22).(fp) < 0) |
| 806 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: could not close file \"%s\" after writing (std::fclose: %s)\n", argv[0], reqfile, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 807 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(fpacket); |
| 808 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket); |
| 809 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!; |
| 810 | } |
| 811 | if (hexstrm) |
| 812 | { |
| 813 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(hexstrm, "%d: recv class=%s[0x%02hx] type=%s[0x%04hx] length=%u\n", |
| 814 | sd, |
| 815 | packet_get_class_strcxx . . $ pvpgn/packet_get_class_str(a17b58f78809526d).(fpacket), (unsigned int)packet_get_classcxx . . $ pvpgn/packet_get_class(6361653567fd72e5).(fpacket), |
| 816 | packet_get_type_strcxx . . $ pvpgn/packet_get_type_str(4ae5f643727ae88e).(fpacket, packet_dir_from_servercxx . . $ pvpgn/packet_dir_from_server.), packet_get_typecxx . . $ pvpgn/packet_get_type(e4ac9e2b4744cb4b).(fpacket), |
| 817 | packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(fpacket)); |
| 818 | hexdumpcxx . . $ pvpgn/hexdump(23ce3b3157473ba).(hexstrm, packet_get_raw_datacxx . . $ pvpgn/packet_get_raw_data(ed324b086ed1b636).(fpacket, 0), packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(fpacket)); |
| 819 | } |
| 820 | if (stdcxx . . $ std/::fwritecxx . . $ std/fwrite(ab0609fa07c47d6e).(packet_get_raw_data_constcxx . . $ pvpgn/packet_get_raw_data_const(1f58ab00371793b4).(fpacket, 0), 1, filelen, fp) < filelen) |
| 821 | { |
| 822 | stdcxx . . $ std/::printfcxx . . $ std/printf(581fddd72a8db8fc).("error\n"); |
| 823 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: could not write to file \"%s\"\n", argv[0], reqfile); |
| 824 | if (stdcxx . . $ std/::fclosecxx . . $ std/fclose(89bc1efcdac0ca22).(fp) < 0) |
| 825 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: could not close file \"%s\" after writing (std::fclose: %s)\n", argv[0], reqfile, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 826 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(fpacket); |
| 827 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket); |
| 828 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!; |
| 829 | } |
| 830 | } |
| 831 | |
| 832 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(fpacket); |
| 833 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket); |
| 834 | |
| 835 | if (hexstrm) |
| 836 | { |
| 837 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(hexstrm, "# end of dump\n"); |
| 838 | if (stdcxx . . $ std/::fclosecxx . . $ std/fclose(89bc1efcdac0ca22).(hexstrm) < 0) |
| 839 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: could not close hexdump file \"%s\" after writing (std::fclose: %s)", argv[0], hexfile, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 840 | } |
| 841 | |
| 842 | if (stdcxx . . $ std/::fclosecxx . . $ std/fclose(89bc1efcdac0ca22).(fp) < 0) |
| 843 | { |
| 844 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: could not close file \"%s\" after writing (std::fclose: %s)\n", argv[0], reqfile, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 845 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!; |
| 846 | } |
| 847 | |
| 848 | stdcxx . . $ std/::printfcxx . . $ std/printf(581fddd72a8db8fc).("done\n"); |
| 849 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!; |
| 850 | } |