Many files:
Checked in e2fsprogs-1.07
diff --git a/misc/findsuper.c b/misc/findsuper.c
index 1832de5..4cc3e40 100644
--- a/misc/findsuper.c
+++ b/misc/findsuper.c
@@ -42,47 +42,53 @@
main(int argc, char *argv[])
{
- int i;
- int skiprate=512; /* one sector */
- long sk=0; /* limited to 2G filesystems!! */
- FILE *f;
- char *s;
+ int i;
+ int skiprate=512; /* one sector */
+ long sk=0; /* limited to 2G filesystems!! */
+ FILE *f;
+ char *s;
+ time_t tm;
- struct ext2_super_block ext2;
- /* interesting fields: EXT2_SUPER_MAGIC
- s_blocks_count s_log_block_size s_mtime s_magic s_lastcheck */
+ struct ext2_super_block ext2;
+ /* interesting fields: EXT2_SUPER_MAGIC
+ * s_blocks_count s_log_block_size s_mtime s_magic s_lastcheck */
- if (argc<2) {
- fprintf(stderr,"Usage: findsuper device [skiprate [start]]\n");
- exit(1);
- }
- if (argc>2) skiprate=atoi(argv[2]);
- if (skiprate<512){
- fprintf(stderr,"Do you really want to skip less than a sector??\n");
- exit(2);
- }
- if (argc>3) sk=atol(argv[3]);
- if (sk<0) {
- fprintf(stderr,"Have to start at 0 or greater,not %ld\n",sk);
- exit(1);
- }
- f=fopen(argv[1],"r");
- if (!f){
- perror(argv[1]);
- exit(1);
- }
+ if (argc<2) {
+ fprintf(stderr,
+ "Usage: findsuper device [skiprate [start]]\n");
+ exit(1);
+ }
+ if (argc>2)
+ skiprate=atoi(argv[2]);
+ if (skiprate<512) {
+ fprintf(stderr,
+ "Do you really want to skip less than a sector??\n");
+ exit(2);
+ }
+ if (argc>3)
+ sk=atol(argv[3]);
+ if (sk<0) {
+ fprintf(stderr,"Have to start at 0 or greater,not %ld\n",sk);
+ exit(1);
+ }
+ f=fopen(argv[1],"r");
+ if (!f) {
+ perror(argv[1]);
+ exit(1);
+ }
- /* Now, go looking for the superblock ! */
- printf(" thisoff block fs_blk_sz blksz last_mount\n");
- for (;!feof(f) && (i=fseek(f,sk,SEEK_SET))!= -1; sk+=skiprate){
- if (i=fread(&ext2,sizeof(ext2),1, f)!=1){
- perror("read failed");
- } else if (ext2.s_magic == EXT2_SUPER_MAGIC){
- s=ctime(&ext2.s_mtime);
- s[24]=0;
- printf("%9ld %9ld %9ld %5ld %s\n",sk,sk/1024,ext2.s_blocks_count,ext2.s_log_block_size,s);
- }
- }
- printf("Failed on %d at %ld\n",i,sk);
- fclose(f);
+ /* Now, go looking for the superblock ! */
+ printf(" thisoff block fs_blk_sz blksz last_mount\n");
+ for (;!feof(f) && (i=fseek(f,sk,SEEK_SET))!= -1; sk+=skiprate){
+ if (i=fread(&ext2,sizeof(ext2),1, f)!=1) {
+ perror("read failed");
+ } else if (ext2.s_magic == EXT2_SUPER_MAGIC){
+ tm = ext2.s_mtime;
+ s=ctime(&tm);
+ s[24]=0;
+ printf("%9ld %9ld %9ld %5ld %s\n",sk,sk/1024,ext2.s_blocks_count,ext2.s_log_block_size,s);
+ }
+ }
+ printf("Failed on %d at %ld\n", i, sk);
+ fclose(f);
}