diff options
| author | Jim Meyering <meyering@redhat.com> | 2009-08-22 18:56:06 +0200 |
|---|---|---|
| committer | Jim Meyering <meyering@redhat.com> | 2009-08-25 09:21:00 +0200 |
| commit | 5e778f7c8d1ecf3d8f11385db013af2ba026e2a5 (patch) | |
| tree | e460d471f37f0dce1ba06f60f88114d1a65326c4 /src/sum.c | |
| parent | cp: ignore obscure failure to preserve symlink time stamps, (diff) | |
| download | coreutils-5e778f7c8d1ecf3d8f11385db013af2ba026e2a5.tar.gz coreutils-5e778f7c8d1ecf3d8f11385db013af2ba026e2a5.zip | |
global: convert indentation-TABs to spaces
Transformed via this shell code:
t=$'\t'
git ls-files \
| grep -vE '(^|/)((GNU)?[Mm]akefile|ChangeLog)|\.(am|mk)$' \
| grep -vE 'tests/pr/|help2man' \
| xargs grep -lE "^ *$t" \
| xargs perl -MText::Tabs -ni -le \
'$m=/^( *\t[ \t]*)(.*)/; print $m ? expand($1) . $2 : $_'
Diffstat (limited to 'src/sum.c')
| -rw-r--r-- | src/sum.c | 70 |
1 files changed, 35 insertions, 35 deletions
@@ -53,13 +53,13 @@ usage (int status) { if (status != EXIT_SUCCESS) fprintf (stderr, _("Try `%s --help' for more information.\n"), - program_name); + program_name); else { printf (_("\ Usage: %s [OPTION]... [FILE]...\n\ "), - program_name); + program_name); fputs (_("\ Print checksum and block counts for each FILE.\n\ \n\ @@ -98,16 +98,16 @@ bsd_sum_file (const char *file, int print_name) fp = stdin; have_read_stdin = true; if (O_BINARY && ! isatty (STDIN_FILENO)) - xfreopen (NULL, "rb", stdin); + xfreopen (NULL, "rb", stdin); } else { fp = fopen (file, (O_BINARY ? "rb" : "r")); if (fp == NULL) - { - error (0, errno, "%s", file); - return false; - } + { + error (0, errno, "%s", file); + return false; + } } while ((ch = getc (fp)) != EOF) @@ -122,7 +122,7 @@ bsd_sum_file (const char *file, int print_name) { error (0, errno, "%s", file); if (!is_stdin) - fclose (fp); + fclose (fp); return false; } @@ -133,7 +133,7 @@ bsd_sum_file (const char *file, int print_name) } printf ("%05d %5s", checksum, - human_readable (total_bytes, hbuf, human_ceiling, 1, 1024)); + human_readable (total_bytes, hbuf, human_ceiling, 1, 1024)); if (print_name > 1) printf (" %s", file); putchar ('\n'); @@ -166,16 +166,16 @@ sysv_sum_file (const char *file, int print_name) fd = STDIN_FILENO; have_read_stdin = true; if (O_BINARY && ! isatty (STDIN_FILENO)) - xfreopen (NULL, "rb", stdin); + xfreopen (NULL, "rb", stdin); } else { fd = open (file, O_RDONLY | O_BINARY); if (fd == -1) - { - error (0, errno, "%s", file); - return false; - } + { + error (0, errno, "%s", file); + return false; + } } while (1) @@ -184,18 +184,18 @@ sysv_sum_file (const char *file, int print_name) size_t bytes_read = safe_read (fd, buf, sizeof buf); if (bytes_read == 0) - break; + break; if (bytes_read == SAFE_READ_ERROR) - { - error (0, errno, "%s", file); - if (!is_stdin) - close (fd); - return false; - } + { + error (0, errno, "%s", file); + if (!is_stdin) + close (fd); + return false; + } for (i = 0; i < bytes_read; i++) - s += buf[i]; + s += buf[i]; total_bytes += bytes_read; } @@ -209,7 +209,7 @@ sysv_sum_file (const char *file, int print_name) checksum = (r & 0xffff) + (r >> 16); printf ("%d %s", checksum, - human_readable (total_bytes, hbuf, human_ceiling, 1, 512)); + human_readable (total_bytes, hbuf, human_ceiling, 1, 512)); if (print_name) printf (" %s", file); putchar ('\n'); @@ -238,22 +238,22 @@ main (int argc, char **argv) while ((optc = getopt_long (argc, argv, "rs", longopts, NULL)) != -1) { switch (optc) - { - case 'r': /* For SysV compatibility. */ - sum_func = bsd_sum_file; - break; + { + case 'r': /* For SysV compatibility. */ + sum_func = bsd_sum_file; + break; - case 's': - sum_func = sysv_sum_file; - break; + case 's': + sum_func = sysv_sum_file; + break; - case_GETOPT_HELP_CHAR; + case_GETOPT_HELP_CHAR; - case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS); + case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS); - default: - usage (EXIT_FAILURE); - } + default: + usage (EXIT_FAILURE); + } } files_given = argc - optind; |
