copy: factor sparse-copying code into its own function, because
[coreutils.git] / src / c99-to-c89.diff
bloba5dd6c9b808db7c074bb6ddb8609a99933be788f
1 diff -upr src/remove.c src/remove.c
2 --- src/remove.c 1970-01-01 00:00:00.000000000 +0000
3 +++ src/remove.c 1970-01-01 00:00:00.000000000 +0000
4 @@ -262,9 +262,10 @@ pop_dir (Dirstack_state *ds)
6 size_t n_lengths = obstack_object_size (&ds->len_stack) / sizeof (size_t);
7 size_t *length = obstack_base (&ds->len_stack);
8 + size_t top_len;
10 assert (n_lengths > 0);
11 - size_t top_len = length[n_lengths - 1];
12 + top_len = length[n_lengths - 1];
13 assert (top_len >= 2);
15 /* Pop the specified length of file name. */
16 @@ -422,10 +423,11 @@ AD_stack_top (Dirstack_state const *ds)
17 static void
18 AD_stack_pop (Dirstack_state *ds)
20 + struct AD_ent *top;
21 assert (0 < AD_stack_height (ds));
23 /* operate on Active_dir. pop and free top entry */
24 - struct AD_ent *top = AD_stack_top (ds);
25 + top = AD_stack_top (ds);
26 if (top->unremovable)
27 hash_free (top->unremovable);
28 obstack_blank (&ds->Active_dir, -(int) sizeof (struct AD_ent));
29 @@ -834,14 +836,13 @@ prompt (int fd_cwd, Dirstack_state const
31 int write_protected = 0;
32 int dirent_type = *pdirent_type;
33 + int wp_errno = 0;
35 *is_empty = T_UNKNOWN;
37 if (x->interactive == RMI_NEVER)
38 return RM_OK;
40 - int wp_errno = 0;
42 if (!x->ignore_missing_files
43 && ((x->interactive == RMI_ALWAYS) || x->stdin_tty)
44 && dirent_type != DT_LNK)
45 @@ -889,6 +890,7 @@ prompt (int fd_cwd, Dirstack_state const
46 break;
49 + {
50 char const *quoted_name = quote (full_filename (filename));
52 if (write_protected < 0)
53 @@ -928,6 +930,7 @@ prompt (int fd_cwd, Dirstack_state const
54 : _("%s: remove %s %s? ")),
55 program_name, file_type (sbuf), quoted_name);
57 + }
59 if (!yesno ())
60 return RM_USER_DECLINED;
61 @@ -1547,6 +1550,7 @@ rm_1 (Dirstack_state *ds, char const *fi
62 return RM_ERROR;
65 + {
66 struct stat st;
67 cache_stat_init (&st);
68 cycle_check_init (&ds->cycle_check_state);
69 @@ -1569,6 +1573,7 @@ rm_1 (Dirstack_state *ds, char const *fi
70 AD_push_initial (ds);
71 AD_INIT_OTHER_MEMBERS ();
73 + {
74 enum RM_status status = remove_entry (AT_FDCWD, ds, filename,
75 DT_UNKNOWN, &st, x);
76 if (status == RM_NONEMPTY_DIR)
77 @@ -1587,6 +1592,8 @@ rm_1 (Dirstack_state *ds, char const *fi
78 ds_clear (ds);
79 return status;
81 + }
84 /* Remove all files and/or directories specified by N_FILES and FILE.
85 Apply the options in X. */
86 diff -upr src/rm.c src/rm.c
87 --- src/rm.c 1970-01-01 00:00:00.000000000 +0000
88 +++ src/rm.c 1970-01-01 00:00:00.000000000 +0000
89 @@ -354,6 +354,7 @@ main (int argc, char **argv)
90 quote ("/"));
93 + {
94 size_t n_files = argc - optind;
95 char const *const *file = (char const *const *) argv + optind;
97 @@ -367,7 +368,10 @@ main (int argc, char **argv)
98 if (!yesno ())
99 exit (EXIT_SUCCESS);
102 enum RM_status status = rm (n_files, file, &x);
103 assert (VALID_STATUS (status));
104 exit (status == RM_ERROR ? EXIT_FAILURE : EXIT_SUCCESS);
108 diff -upr src/seq.c src/seq.c
109 --- src/seq.c 1970-01-01 00:00:00.000000000 +0000
110 +++ src/seq.c 1970-01-01 00:00:00.000000000 +0000
111 @@ -163,6 +163,7 @@ scan_arg (const char *arg)
112 : (decimal_point == arg /* .# -> 0.# */
113 || ! ISDIGIT (decimal_point[-1]))); /* -.# -> 0.# */
116 char const *e = strchr (arg, 'e');
117 if (! e)
118 e = strchr (arg, 'E');
119 @@ -171,6 +172,7 @@ scan_arg (const char *arg)
120 long exponent = strtol (e + 1, NULL, 10);
121 ret.precision += exponent < 0 ? -exponent : 0;
126 return ret;
127 @@ -346,6 +348,7 @@ get_default_format (operand first, opera
128 size_t last_width = last.width + (prec - last.precision);
129 if (last.precision && prec == 0)
130 last_width--; /* don't include space for '.' */
132 size_t width = MAX (first_width, last_width);
133 if (width <= INT_MAX)
135 @@ -353,6 +356,7 @@ get_default_format (operand first, opera
136 sprintf (format_buf, "%%0%d.%dLf", w, prec);
137 return format_buf;
141 else
143 @@ -441,6 +445,7 @@ main (int argc, char **argv)
144 if (format_str)
146 validate_format (format_str);
148 char const *f = long_double_format (format_str, &layout);
149 if (! f)
151 @@ -448,6 +453,7 @@ main (int argc, char **argv)
152 usage (EXIT_FAILURE);
154 format_str = f;
158 last = scan_arg (argv[optind++]);
159 diff -upr src/shred.c src/shred.c
160 --- src/shred.c 1970-01-01 00:00:00.000000000 +0000
161 +++ src/shred.c 1970-01-01 00:00:00.000000000 +0000
162 @@ -468,7 +468,7 @@ dopass (int fd, char const *qname, off_t
163 out. Thus, it shouldn't give up on bad blocks. This
164 code works because lim is always a multiple of
165 SECTOR_SIZE, except at the end. */
166 - verify (sizeof r % SECTOR_SIZE == 0);
167 + { verify (sizeof r % SECTOR_SIZE == 0); }
168 if (errnum == EIO && 0 <= size && (soff | SECTOR_MASK) < lim)
170 size_t soff1 = (soff | SECTOR_MASK) + 1;