~jonathank89/burg/burg-percise

« back to all changes in this revision

Viewing changes to commands/crc.c

merge mainline into mips

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* crc.c - command to calculate the crc32 checksum of a file  */
2
2
/*
3
3
 *  GRUB  --  GRand Unified Bootloader
4
 
 *  Copyright (C) 2008  Free Software Foundation, Inc.
 
4
 *  Copyright (C) 2008,2010  Free Software Foundation, Inc.
5
5
 *
6
6
 *  GRUB is free software: you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
23
23
#include <grub/misc.h>
24
24
#include <grub/lib/crc.h>
25
25
#include <grub/command.h>
 
26
#include <grub/i18n.h>
26
27
 
27
28
static grub_err_t
28
29
grub_cmd_crc (grub_command_t cmd __attribute__ ((unused)),
45
46
  while ((size = grub_file_read (file, buf, sizeof (buf))) > 0)
46
47
    crc = grub_getcrc32 (crc, buf, size);
47
48
 
 
49
  if (grub_errno)
 
50
    goto fail;
 
51
 
 
52
  grub_printf ("%08x\n", crc);
 
53
 
 
54
 fail:
48
55
  grub_file_close (file);
49
 
 
50
 
  grub_printf ("%08x\n", crc);
51
 
 
52
56
  return 0;
53
57
}
54
58
 
57
61
GRUB_MOD_INIT(crc)
58
62
{
59
63
  cmd = grub_register_command ("crc", grub_cmd_crc,
60
 
                               "FILE",
61
 
                               "Calculate the crc32 checksum of a file.");
 
64
                               N_("FILE"),
 
65
                               N_("Calculate the crc32 checksum of a file."));
62
66
}
63
67
 
64
68
GRUB_MOD_FINI(crc)