atEOF = true;
atEOD = true;
close_file();
- current_file = last_file;
+ current_file = last_file+1;
current_block = -1;
/* Ne pas creer le fichier si on est a la fin */
check_file();
+ /* check all block record */
for(i=0; (i < count) && (where != -1) ; i++) {
- Dmsg3(dbglevel," fsr ok count=%i i=%i where=%i\n", count, i, where);
- nb = ::read(cur_fd, &size, sizeof(size));
+ nb = ::read(cur_fd, &size, sizeof(size)); /* get size of block */
if (nb == sizeof(size)) {
- where = lseek(cur_fd, size, SEEK_CUR);
+ current_block++;
+ where = lseek(cur_fd, size, SEEK_CUR); /* seek after this block */
if (where == -1) {
errno = EIO;
return -1;
}
- current_block++;
} else {
errno = EIO;
return -1;
}
}
- Dmsg2(dbglevel," fsr ok i=%i where=%i\n", i, where);
return 0;
}
printf("write something (3 writes)\n");
print_pos();
+ /* write EOF */
+ printf("WEOF\n");
+ mt_com.mt_op = MTWEOF;
+ mt_com.mt_count = 1;
+ r1 = ioctl(fd, MTIOCTOP, &mt_com);
+ print_pos();
+
+ /* write a second file */
+ write(fd, "abcdefghijklmnopqrstuvwyz", strlen("abcdefghijklmnopqrstuvwyz")+1);
+ printf("write something\n");
+ print_pos();
+
/* rewind */
mt_com.mt_count = 1;
mt_com.mt_op = MTREW;
r1 = ioctl(fd, MTIOCTOP, &mt_com);
printf("goto eom\n");
print_pos();
-
+
+ /* write something */
+ printf("write something\n");
+ write(fd, "abcdefghijklmnopqrstuvwyz", strlen("abcdefghijklmnopqrstuvwyz")+1);
+ print_pos();
+
close(fd);
return(0);
}