blob: 7552c8518807b42377b75cdf830e79cae33863dc [file] [log] [blame]
Erik Andersene49d5ec2000-02-08 19:58:47 +00001/* vi: set sw=4 ts=4: */
Eric Andersencc8ed391999-10-05 16:24:54 +00002/*
Eric Andersenc4996011999-10-20 22:08:37 +00003 * Mini dd implementation for busybox
4 *
Eric Andersenc4996011999-10-20 22:08:37 +00005 *
Matt Kraai3eeab3b2001-12-07 16:27:37 +00006 * Copyright (C) 2000,2001 Matt Kraai
Eric Andersenc4996011999-10-20 22:08:37 +00007 *
Bernhard Reutner-Fischerc2cb0f32006-04-13 12:45:04 +00008 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
Eric Andersencc8ed391999-10-05 16:24:54 +00009 */
10
Bernhard Reutner-Fischer73561cc2006-08-28 23:31:54 +000011#include <signal.h> /* For FEATURE_DD_SIGNAL_HANDLING */
Denis Vlasenkob6adbf12007-05-26 19:00:18 +000012#include "libbb.h"
Denis Vlasenko99912ca2007-04-10 15:43:37 +000013
14/* This is a NOEXEC applet. Be very careful! */
15
Eric Andersencbe31da2001-02-20 06:14:08 +000016
Denis Vlasenkoe2532ab2007-12-02 01:44:42 +000017enum {
18 ifd = STDIN_FILENO,
19 ofd = STDOUT_FILENO,
20};
21
Matt Kraaia164c642001-02-05 17:50:03 +000022static const struct suffix_mult dd_suffixes[] = {
Matt Kraai24ac0172000-12-18 21:38:57 +000023 { "c", 1 },
24 { "w", 2 },
25 { "b", 512 },
26 { "kD", 1000 },
27 { "k", 1024 },
Bernhard Reutner-Fischer2a47dea2007-04-04 14:01:23 +000028 { "K", 1024 }, /* compat with coreutils dd */
Matt Kraai24ac0172000-12-18 21:38:57 +000029 { "MD", 1000000 },
30 { "M", 1048576 },
31 { "GD", 1000000000 },
32 { "G", 1073741824 },
Denis Vlasenkof8689632007-07-27 15:06:25 +000033 { }
Matt Kraai24ac0172000-12-18 21:38:57 +000034};
35
Bernhard Reutner-Fischer2a47dea2007-04-04 14:01:23 +000036struct globals {
37 off_t out_full, out_part, in_full, in_part;
38};
39#define G (*(struct globals*)&bb_common_bufsiz1)
Denis Vlasenko75878702007-07-27 15:02:00 +000040/* We have to zero it out because of NOEXEC */
41#define INIT_G() memset(&G, 0, sizeof(G))
42
Rob Landleyc5598172006-05-02 22:44:04 +000043
Bernhard Reutner-Fischer73561cc2006-08-28 23:31:54 +000044static void dd_output_status(int ATTRIBUTE_UNUSED cur_signal)
Rob Landleyc5598172006-05-02 22:44:04 +000045{
Denis Vlasenko980864d2007-07-30 10:58:09 +000046 /* Deliberately using %u, not %d */
47 fprintf(stderr, "%"OFF_FMT"u+%"OFF_FMT"u records in\n"
48 "%"OFF_FMT"u+%"OFF_FMT"u records out\n",
Bernhard Reutner-Fischer2a47dea2007-04-04 14:01:23 +000049 G.in_full, G.in_part,
50 G.out_full, G.out_part);
Rob Landleyc5598172006-05-02 22:44:04 +000051}
52
Denis Vlasenkoe2532ab2007-12-02 01:44:42 +000053static ssize_t full_write_or_warn(const void *buf, size_t len,
Denis Vlasenko6ca409e2007-08-12 20:58:27 +000054 const char *const filename)
Denis Vlasenko3b8ff682006-10-31 15:55:56 +000055{
Denis Vlasenkoe2532ab2007-12-02 01:44:42 +000056 ssize_t n = full_write(ofd, buf, len);
Denis Vlasenko3b8ff682006-10-31 15:55:56 +000057 if (n < 0)
58 bb_perror_msg("writing '%s'", filename);
59 return n;
60}
61
Denis Vlasenkoe2532ab2007-12-02 01:44:42 +000062static bool write_and_stats(const void *buf, size_t len, size_t obs,
Denis Vlasenko990d0f62007-07-24 15:54:42 +000063 const char *filename)
Bernhard Reutner-Fischer2a47dea2007-04-04 14:01:23 +000064{
Denis Vlasenkoe2532ab2007-12-02 01:44:42 +000065 ssize_t n = full_write_or_warn(buf, len, filename);
Bernhard Reutner-Fischer2a47dea2007-04-04 14:01:23 +000066 if (n < 0)
67 return 1;
68 if (n == obs)
69 G.out_full++;
Denis Vlasenkod1801a42007-04-19 20:08:19 +000070 else if (n) /* > 0 */
Bernhard Reutner-Fischer2a47dea2007-04-04 14:01:23 +000071 G.out_part++;
72 return 0;
73}
74
Denis Vlasenko5dd27b12006-11-25 14:46:21 +000075#if ENABLE_LFS
76#define XATOU_SFX xatoull_sfx
77#else
78#define XATOU_SFX xatoul_sfx
79#endif
80
Denis Vlasenko9b49a5e2007-10-11 10:05:36 +000081int dd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
Matt Kraai24ac0172000-12-18 21:38:57 +000082int dd_main(int argc, char **argv)
Eric Andersen3cf52d11999-10-12 22:26:06 +000083{
Denis Vlasenko3b8ff682006-10-31 15:55:56 +000084 enum {
Denis Vlasenko75878702007-07-27 15:02:00 +000085 FLAG_SYNC = 1 << 0,
86 FLAG_NOERROR = 1 << 1,
87 FLAG_NOTRUNC = 1 << 2,
88 FLAG_TWOBUFS = 1 << 3,
89 FLAG_COUNT = 1 << 4,
Denis Vlasenko3b8ff682006-10-31 15:55:56 +000090 };
Denis Vlasenko6ca409e2007-08-12 20:58:27 +000091 static const char keywords[] ALIGN1 =
Denis Vlasenko990d0f62007-07-24 15:54:42 +000092 "bs=\0""count=\0""seek=\0""skip=\0""if=\0""of=\0"
Bernhard Reutner-Fischer2a47dea2007-04-04 14:01:23 +000093#if ENABLE_FEATURE_DD_IBS_OBS
Denis Vlasenko990d0f62007-07-24 15:54:42 +000094 "ibs=\0""obs=\0""conv=\0""notrunc\0""sync\0""noerror\0"
Bernhard Reutner-Fischer2a47dea2007-04-04 14:01:23 +000095#endif
Denis Vlasenko990d0f62007-07-24 15:54:42 +000096 ;
Bernhard Reutner-Fischer99003b82007-04-10 19:30:50 +000097 enum {
98 OP_bs = 1,
99 OP_count,
100 OP_seek,
101 OP_skip,
102 OP_if,
103 OP_of,
Bernhard Reutner-Fischere468ef22007-04-16 12:21:05 +0000104#if ENABLE_FEATURE_DD_IBS_OBS
Bernhard Reutner-Fischer99003b82007-04-10 19:30:50 +0000105 OP_ibs,
106 OP_obs,
107 OP_conv,
108 OP_conv_notrunc,
109 OP_conv_sync,
Denis Vlasenkof6250a32007-04-19 20:16:14 +0000110 OP_conv_noerror,
Bernhard Reutner-Fischere468ef22007-04-16 12:21:05 +0000111#endif
Bernhard Reutner-Fischer99003b82007-04-10 19:30:50 +0000112 };
Denis Vlasenkoe2532ab2007-12-02 01:44:42 +0000113 int exitcode = EXIT_FAILURE;
Denis Vlasenko75878702007-07-27 15:02:00 +0000114 size_t ibs = 512, obs = 512;
Denis Vlasenko3b8ff682006-10-31 15:55:56 +0000115 ssize_t n, w;
Rob Landley2686d3b2006-05-16 16:52:12 +0000116 char *ibuf, *obuf;
Denis Vlasenko75878702007-07-27 15:02:00 +0000117 /* And these are all zeroed at once! */
118 struct {
119 int flags;
Denis Vlasenko75878702007-07-27 15:02:00 +0000120 size_t oc;
121 off_t count;
122 off_t seek, skip;
123 const char *infile, *outfile;
124#if ENABLE_FEATURE_DD_SIGNAL_HANDLING
125 struct sigaction sigact;
126#endif
127 } Z;
128#define flags (Z.flags )
Denis Vlasenko75878702007-07-27 15:02:00 +0000129#define oc (Z.oc )
130#define count (Z.count )
131#define seek (Z.seek )
132#define skip (Z.skip )
133#define infile (Z.infile )
134#define outfile (Z.outfile)
135#define sigact (Z.sigact )
Eric Andersenddea3682000-11-29 22:33:02 +0000136
Denis Vlasenko75878702007-07-27 15:02:00 +0000137 memset(&Z, 0, sizeof(Z));
138 INIT_G();
Denis Vlasenkoe2532ab2007-12-02 01:44:42 +0000139 //fflush(NULL); - is this needed because of NOEXEC?
Denis Vlasenkof6250a32007-04-19 20:16:14 +0000140
Denis Vlasenko75878702007-07-27 15:02:00 +0000141#if ENABLE_FEATURE_DD_SIGNAL_HANDLING
142 sigact.sa_handler = dd_output_status;
143 sigact.sa_flags = SA_RESTART;
144 sigemptyset(&sigact.sa_mask);
145 sigaction(SIGUSR1, &sigact, NULL);
146#endif
Rob Landleyc5598172006-05-02 22:44:04 +0000147
Bernhard Reutner-Fischer73561cc2006-08-28 23:31:54 +0000148 for (n = 1; n < argc; n++) {
Bernhard Reutner-Fischer99003b82007-04-10 19:30:50 +0000149 smalluint key_len;
150 smalluint what;
Bernhard Reutner-Fischer2a47dea2007-04-04 14:01:23 +0000151 char *key;
Denis Vlasenko3b8ff682006-10-31 15:55:56 +0000152 char *arg = argv[n];
Denis Vlasenko3b8ff682006-10-31 15:55:56 +0000153
Bernhard Reutner-Fischer2a47dea2007-04-04 14:01:23 +0000154//XXX:FIXME: we reject plain "dd --" This would cost ~20 bytes, so..
155//if (*arg == '-' && *++arg == '-' && !*++arg) continue;
156 key = strstr(arg, "=");
157 if (key == NULL)
Manuel Novoa III cad53642003-03-19 09:13:01 +0000158 bb_show_usage();
Bernhard Reutner-Fischer2a47dea2007-04-04 14:01:23 +0000159 key_len = key - arg + 1;
160 key = xstrndup(arg, key_len);
Denis Vlasenko990d0f62007-07-24 15:54:42 +0000161 what = index_in_strings(keywords, key) + 1;
Bernhard Reutner-Fischer2a47dea2007-04-04 14:01:23 +0000162 if (ENABLE_FEATURE_CLEAN_UP)
163 free(key);
164 if (what == 0)
165 bb_show_usage();
166 arg += key_len;
167 /* Must fit into positive ssize_t */
Bernhard Reutner-Fischere468ef22007-04-16 12:21:05 +0000168#if ENABLE_FEATURE_DD_IBS_OBS
Bernhard Reutner-Fischer2a47dea2007-04-04 14:01:23 +0000169 if (what == OP_ibs) {
170 ibs = xatoul_range_sfx(arg, 1, ((size_t)-1L)/2, dd_suffixes);
171 continue;
172 }
173 if (what == OP_obs) {
174 obs = xatoul_range_sfx(arg, 1, ((size_t)-1L)/2, dd_suffixes);
175 continue;
176 }
177 if (what == OP_conv) {
178 while (1) {
179 /* find ',', replace them with nil so we can use arg for
Denis Vlasenko990d0f62007-07-24 15:54:42 +0000180 * index_in_strings() without copying.
Denis Vlasenkod1801a42007-04-19 20:08:19 +0000181 * We rely on arg being non-null, else strchr would fault.
Bernhard Reutner-Fischer2a47dea2007-04-04 14:01:23 +0000182 */
Denis Vlasenkod1801a42007-04-19 20:08:19 +0000183 key = strchr(arg, ',');
Bernhard Reutner-Fischer2a47dea2007-04-04 14:01:23 +0000184 if (key)
185 *key = '\0';
Denis Vlasenko990d0f62007-07-24 15:54:42 +0000186 what = index_in_strings(keywords, arg) + 1;
Bernhard Reutner-Fischer2a47dea2007-04-04 14:01:23 +0000187 if (what < OP_conv_notrunc)
188 bb_error_msg_and_die(bb_msg_invalid_arg, arg, "conv");
189 if (what == OP_conv_notrunc)
Denis Vlasenko75878702007-07-27 15:02:00 +0000190 flags |= FLAG_NOTRUNC;
Bernhard Reutner-Fischer2a47dea2007-04-04 14:01:23 +0000191 if (what == OP_conv_sync)
Denis Vlasenko75878702007-07-27 15:02:00 +0000192 flags |= FLAG_SYNC;
Denis Vlasenkof6250a32007-04-19 20:16:14 +0000193 if (what == OP_conv_noerror)
Denis Vlasenko75878702007-07-27 15:02:00 +0000194 flags |= FLAG_NOERROR;
Bernhard Reutner-Fischer2a47dea2007-04-04 14:01:23 +0000195 if (!key) /* no ',' left, so this was the last specifier */
196 break;
Denis Vlasenkod1801a42007-04-19 20:08:19 +0000197 arg = key + 1; /* skip this keyword and ',' */
Bernhard Reutner-Fischer2a47dea2007-04-04 14:01:23 +0000198 }
199 continue;
200 }
Bernhard Reutner-Fischere468ef22007-04-16 12:21:05 +0000201#endif
Bernhard Reutner-Fischer2a47dea2007-04-04 14:01:23 +0000202 if (what == OP_bs) {
203 ibs = obs = xatoul_range_sfx(arg, 1, ((size_t)-1L)/2, dd_suffixes);
204 continue;
205 }
206 /* These can be large: */
207 if (what == OP_count) {
Denis Vlasenko75878702007-07-27 15:02:00 +0000208 flags |= FLAG_COUNT;
Bernhard Reutner-Fischer2a47dea2007-04-04 14:01:23 +0000209 count = XATOU_SFX(arg, dd_suffixes);
210 continue;
211 }
212 if (what == OP_seek) {
213 seek = XATOU_SFX(arg, dd_suffixes);
214 continue;
215 }
Denis Vlasenkod1801a42007-04-19 20:08:19 +0000216 if (what == OP_skip) {
Bernhard Reutner-Fischer2a47dea2007-04-04 14:01:23 +0000217 skip = XATOU_SFX(arg, dd_suffixes);
218 continue;
219 }
220 if (what == OP_if) {
221 infile = arg;
222 continue;
223 }
224 if (what == OP_of)
225 outfile = arg;
Eric Andersen3cf52d11999-10-12 22:26:06 +0000226 }
Bernhard Reutner-Fischer2a47dea2007-04-04 14:01:23 +0000227//XXX:FIXME for huge ibs or obs, malloc'ing them isn't the brightest idea ever
Denis Vlasenko3b8ff682006-10-31 15:55:56 +0000228 ibuf = obuf = xmalloc(ibs);
229 if (ibs != obs) {
Denis Vlasenko75878702007-07-27 15:02:00 +0000230 flags |= FLAG_TWOBUFS;
Bernhard Reutner-Fischer73561cc2006-08-28 23:31:54 +0000231 obuf = xmalloc(obs);
Denis Vlasenko3b8ff682006-10-31 15:55:56 +0000232 }
Bernhard Reutner-Fischer73561cc2006-08-28 23:31:54 +0000233 if (infile != NULL)
Denis Vlasenkoe2532ab2007-12-02 01:44:42 +0000234 xmove_fd(xopen(infile, O_RDONLY), ifd);
Bernhard Reutner-Fischer73561cc2006-08-28 23:31:54 +0000235 else {
Manuel Novoa III cad53642003-03-19 09:13:01 +0000236 infile = bb_msg_standard_input;
Erik Andersene49d5ec2000-02-08 19:58:47 +0000237 }
Matt Kraai24ac0172000-12-18 21:38:57 +0000238 if (outfile != NULL) {
Bernhard Reutner-Fischer2a47dea2007-04-04 14:01:23 +0000239 int oflag = O_WRONLY | O_CREAT;
Matt Kraaic9acf8c2001-01-17 00:21:05 +0000240
Denis Vlasenko75878702007-07-27 15:02:00 +0000241 if (!seek && !(flags & FLAG_NOTRUNC))
Matt Kraaic9acf8c2001-01-17 00:21:05 +0000242 oflag |= O_TRUNC;
243
Denis Vlasenkoe2532ab2007-12-02 01:44:42 +0000244 xmove_fd(xopen(outfile, oflag), ofd);
Matt Kraaic9acf8c2001-01-17 00:21:05 +0000245
Denis Vlasenko75878702007-07-27 15:02:00 +0000246 if (seek && !(flags & FLAG_NOTRUNC)) {
Rob Landley2686d3b2006-05-16 16:52:12 +0000247 if (ftruncate(ofd, seek * obs) < 0) {
Matt Kraaieb834782002-02-05 15:28:54 +0000248 struct stat st;
249
Bernhard Reutner-Fischer73561cc2006-08-28 23:31:54 +0000250 if (fstat(ofd, &st) < 0 || S_ISREG(st.st_mode) ||
251 S_ISDIR(st.st_mode))
252 goto die_outfile;
Matt Kraaieb834782002-02-05 15:28:54 +0000253 }
Matt Kraaic9acf8c2001-01-17 00:21:05 +0000254 }
Matt Kraai24ac0172000-12-18 21:38:57 +0000255 } else {
Manuel Novoa III cad53642003-03-19 09:13:01 +0000256 outfile = bb_msg_standard_output;
Erik Andersene49d5ec2000-02-08 19:58:47 +0000257 }
Matt Kraai24ac0172000-12-18 21:38:57 +0000258 if (skip) {
Denis Vlasenko7039a662006-10-08 17:54:47 +0000259 if (lseek(ifd, skip * ibs, SEEK_CUR) < 0) {
Rob Landley2686d3b2006-05-16 16:52:12 +0000260 while (skip-- > 0) {
261 n = safe_read(ifd, ibuf, ibs);
262 if (n < 0)
Bernhard Reutner-Fischer2a47dea2007-04-04 14:01:23 +0000263 goto die_infile;
Rob Landley2686d3b2006-05-16 16:52:12 +0000264 if (n == 0)
265 break;
266 }
Glenn L McGratheaed78a2002-11-28 11:05:28 +0000267 }
Matt Kraai24ac0172000-12-18 21:38:57 +0000268 }
Matt Kraai24ac0172000-12-18 21:38:57 +0000269 if (seek) {
Denis Vlasenko7039a662006-10-08 17:54:47 +0000270 if (lseek(ofd, seek * obs, SEEK_CUR) < 0)
Bernhard Reutner-Fischer73561cc2006-08-28 23:31:54 +0000271 goto die_outfile;
Matt Kraai24ac0172000-12-18 21:38:57 +0000272 }
Eric Andersenddea3682000-11-29 22:33:02 +0000273
Denis Vlasenko2b03e5e2007-07-29 14:59:06 +0000274 while (!(flags & FLAG_COUNT) || (G.in_full + G.in_part != count)) {
Denis Vlasenko75878702007-07-27 15:02:00 +0000275 if (flags & FLAG_NOERROR) /* Pre-zero the buffer if conv=noerror */
276 memset(ibuf, 0, ibs);
Rob Landley2686d3b2006-05-16 16:52:12 +0000277 n = safe_read(ifd, ibuf, ibs);
Bernhard Reutner-Fischer73561cc2006-08-28 23:31:54 +0000278 if (n == 0)
Rob Landley2686d3b2006-05-16 16:52:12 +0000279 break;
Eric Andersenef38b392002-04-27 01:31:43 +0000280 if (n < 0) {
Denis Vlasenkoe2532ab2007-12-02 01:44:42 +0000281 if (!(flags & FLAG_NOERROR))
Bernhard Reutner-Fischer2a47dea2007-04-04 14:01:23 +0000282 goto die_infile;
Denis Vlasenkoe2532ab2007-12-02 01:44:42 +0000283 n = ibs;
284 bb_simple_perror_msg(infile);
Eric Andersenef38b392002-04-27 01:31:43 +0000285 }
Bernhard Reutner-Fischer73561cc2006-08-28 23:31:54 +0000286 if ((size_t)n == ibs)
Bernhard Reutner-Fischer2a47dea2007-04-04 14:01:23 +0000287 G.in_full++;
Bernhard Reutner-Fischer73561cc2006-08-28 23:31:54 +0000288 else {
Bernhard Reutner-Fischer2a47dea2007-04-04 14:01:23 +0000289 G.in_part++;
Denis Vlasenko75878702007-07-27 15:02:00 +0000290 if (flags & FLAG_SYNC) {
Rob Landley2686d3b2006-05-16 16:52:12 +0000291 memset(ibuf + n, '\0', ibs - n);
292 n = ibs;
293 }
Glenn L McGratheaed78a2002-11-28 11:05:28 +0000294 }
Denis Vlasenko75878702007-07-27 15:02:00 +0000295 if (flags & FLAG_TWOBUFS) {
Rob Landley2686d3b2006-05-16 16:52:12 +0000296 char *tmp = ibuf;
297 while (n) {
298 size_t d = obs - oc;
299
Bernhard Reutner-Fischer73561cc2006-08-28 23:31:54 +0000300 if (d > n)
301 d = n;
Rob Landley2686d3b2006-05-16 16:52:12 +0000302 memcpy(obuf + oc, tmp, d);
303 n -= d;
304 tmp += d;
305 oc += d;
306 if (oc == obs) {
Denis Vlasenkoe2532ab2007-12-02 01:44:42 +0000307 if (write_and_stats(obuf, obs, obs, outfile))
Bernhard Reutner-Fischer2a47dea2007-04-04 14:01:23 +0000308 goto out_status;
Rob Landley2686d3b2006-05-16 16:52:12 +0000309 oc = 0;
310 }
311 }
Denis Vlasenkoe2532ab2007-12-02 01:44:42 +0000312 } else if (write_and_stats(ibuf, n, obs, outfile))
Denis Vlasenkod1801a42007-04-19 20:08:19 +0000313 goto out_status;
Glenn L McGrathf0b073f2000-09-11 00:32:13 +0000314 }
Denis Vlasenko9213a9e2006-09-17 16:28:10 +0000315
Rob Landley2686d3b2006-05-16 16:52:12 +0000316 if (ENABLE_FEATURE_DD_IBS_OBS && oc) {
Denis Vlasenkoe2532ab2007-12-02 01:44:42 +0000317 w = full_write_or_warn(obuf, oc, outfile);
Denis Vlasenko3b8ff682006-10-31 15:55:56 +0000318 if (w < 0) goto out_status;
319 if (w > 0)
Bernhard Reutner-Fischer2a47dea2007-04-04 14:01:23 +0000320 G.out_part++;
Rob Landley2686d3b2006-05-16 16:52:12 +0000321 }
Denis Vlasenko3b8ff682006-10-31 15:55:56 +0000322 if (close(ifd) < 0) {
Denis Vlasenko990d0f62007-07-24 15:54:42 +0000323 die_infile:
Denis Vlasenko0c97c9d2007-10-01 11:58:38 +0000324 bb_simple_perror_msg_and_die(infile);
Glenn L McGratheaed78a2002-11-28 11:05:28 +0000325 }
Matt Kraai3eeab3b2001-12-07 16:27:37 +0000326
Denis Vlasenko3b8ff682006-10-31 15:55:56 +0000327 if (close(ofd) < 0) {
Denis Vlasenko990d0f62007-07-24 15:54:42 +0000328 die_outfile:
Denis Vlasenko0c97c9d2007-10-01 11:58:38 +0000329 bb_simple_perror_msg_and_die(outfile);
Glenn L McGratheaed78a2002-11-28 11:05:28 +0000330 }
Denis Vlasenkoe2532ab2007-12-02 01:44:42 +0000331
332 exitcode = EXIT_SUCCESS;
Denis Vlasenko990d0f62007-07-24 15:54:42 +0000333 out_status:
Rob Landleyc5598172006-05-02 22:44:04 +0000334 dd_output_status(0);
Matt Kraai24ac0172000-12-18 21:38:57 +0000335
Denis Vlasenkoe2532ab2007-12-02 01:44:42 +0000336 return exitcode;
Eric Andersen3cf52d11999-10-12 22:26:06 +0000337}