dd: clarify meaning of multiplication factors; put xM in order
[platform/upstream/coreutils.git] / src / c99-to-c89.diff
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)
5  {
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;
9
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);
14
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)
19  {
20 +  struct AD_ent *top;
21    assert (0 < AD_stack_height (ds));
22
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
30  {
31    int write_protected = 0;
32    int dirent_type = *pdirent_type;
33 +  int wp_errno = 0;
34
35    *is_empty = T_UNKNOWN;
36
37    if (x->interactive == RMI_NEVER)
38      return RM_OK;
39
40 -  int wp_errno = 0;
41 -
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;
47           }
48
49 +      {
50        char const *quoted_name = quote (full_filename (filename));
51
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);
56         }
57 +      }
58
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;
63      }
64
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 ();
72
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;
80  }
81 +  }
82 +}
83
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 ("/"));
91      }
92
93 +  {
94    size_t n_files = argc - optind;
95    char const *const *file = (char const *const *) argv + optind;
96
97 @@ -367,7 +368,10 @@ main (int argc, char **argv)
98        if (!yesno ())
99         exit (EXIT_SUCCESS);
100      }
101 +  {
102    enum RM_status status = rm (n_files, file, &x);
103    assert (VALID_STATUS (status));
104    exit (status == RM_ERROR ? EXIT_FAILURE : EXIT_SUCCESS);
105 +  }
106 +  }
107  }
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.# */
114         }
115 +      {
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;
122         }
123 +      }
124      }
125
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 '.' */
131 +         {
132           size_t width = MAX (first_width, last_width);
133           if (width <= INT_MAX)
134             {
135 @@ -353,6 +356,7 @@ get_default_format (operand first, opera
136               sprintf (format_buf, "%%0%d.%dLf", w, prec);
137               return format_buf;
138             }
139 +         }
140         }
141        else
142         {
143 @@ -441,6 +445,7 @@ main (int argc, char **argv)
144    if (format_str)
145      {
146        validate_format (format_str);
147 +      {
148        char const *f = long_double_format (format_str, &layout);
149        if (! f)
150         {
151 @@ -448,6 +453,7 @@ main (int argc, char **argv)
152           usage (EXIT_FAILURE);
153         }
154        format_str = f;
155 +      }
156      }
157
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)
169                     {
170                       size_t soff1 = (soff | SECTOR_MASK) + 1;