30 size =
sizeof(buffer);
34 printf(
"End of tape reached.\n");
38 printf(
"End of File marker found, skipping...\n");
51 f =
fopen(
"/tmp/.mt",
"w");
52 fwrite(buffer,
sizeof(buffer), 1, f);
54 system(
"file /tmp/.mt > /tmp/.mtf");
55 f =
fopen(
"/tmp/.mtf",
"r");
57 memset(buffer, 0,
sizeof(buffer));
58 fread(buffer,
sizeof(buffer), 1, f);
79 printf(
"File on tape is no MIDAS data\n");
91 printf(
"Spooling tape...\r");
95 printf(
"Error spooling tape\n");
122 printf(
"End of tape reached.\n");
125 printf(
"End of File marker found, skipping...\n");
133 printf(
"Data on tape is no MIDAS data\n");
135 printf(
"Skipping file...\r");
165 if (
verbose && size >
mb + 1024 * 1024) {
167 printf(
"%d MB\r", size / 1024 / 1024);
177 printf(
"%d MB\n", size / 1024 / 1024);
221 if (
verbose && size >
mb + 1024 * 1024) {
223 printf(
"%d MB\r", size / 1024 / 1024);
233 printf(
"%d MB\n", size / 1024 / 1024);
255#elif defined(OS_UNIX)
260#error This program cannot be compiled under this operating system
277 else if (
argv[
i][0] ==
'-') {
280 if (
argv[
i][1] ==
'f')
282 else if (
argv[
i][1] ==
'd')
286 }
else if (cmd[0] == 0)
287 strcpy(cmd,
argv[
i]);
300 if (
strcmp(cmd,
"status") == 0) {
311 if (
strcmp(cmd,
"rewind") == 0)
314 else if (
strcmp(cmd,
"online") == 0)
317 else if (
strcmp(cmd,
"offline") == 0)
320 else if (
strcmp(cmd,
"eof") == 0 ||
strcmp(cmd,
"weof") == 0) {
332 else if (
strcmp(cmd,
"fsf") == 0 ||
strcmp(cmd,
"ff") == 0)
335 else if (
strcmp(cmd,
"fsr") == 0 ||
strcmp(cmd,
"fr") == 0)
338 else if (
strcmp(cmd,
"bsf") == 0 ||
strcmp(cmd,
"bf") == 0)
341 else if (
strcmp(cmd,
"bsr") == 0 ||
strcmp(cmd,
"br") == 0)
344 else if (
strcmp(cmd,
"seod") == 0)
347 else if (
strcmp(cmd,
"dir") == 0)
350 else if (
strcmp(cmd,
"backup") == 0) {
360 else if (
strcmp(cmd,
"restore") == 0)
365 printf(
"usage: mtape [-f tape_device] [-d file] [-v] command [count] [last]\n\n");
366 printf(
"Following commands are available:\n");
367 printf(
" status Print status information about tape\n");
368 printf(
" rewind Rewind tape\n");
370 (
" eof,weof Write <count> End-of-File marks at the current tape position\n");
371 printf(
" fsf,ff Forward spaces <count> files\n");
372 printf(
" fsr,fr Forward spaces <count> records\n");
373 printf(
" bsf,bf Backspaces <count> files\n");
374 printf(
" bsr,br Backspaces <count> records\n");
375 printf(
" rewind Rewind tape\n");
376 printf(
" offline Places the tape offline (unload)\n");
377 printf(
" online Places the tape online (load)\n");
378 printf(
" seod Space to end of recorded data\n\n");
379 printf(
"Following commands only work with tapes written in MIDAS format:\n");
380 printf(
" dir List next [count] runs on MIDAS tape\n");
383 (
" Copy runs with numbers [count] to [last] from disk to tape.\n");
384 printf(
" If [-d file] is not given, runxxxxx.mid is used where\n");
385 printf(
" xxxxx is the run number. If [file] contains %%05d, it\n");
386 printf(
" is replaced by the run number.\n");
388 printf(
" Copy next [count] files from tape to disk.\n");
389 printf(
" If [-d file] is not given, runxxxxx.mid is used where\n");
390 printf(
" xxxxx is the run number. If [file] contains %%05d, it\n");
391 printf(
" is replaced by the run number.\n");
396 printf(
"Error performing operation\n");
398 printf(
"Error performing operation, status code = %d\n",
status);
INT ss_tape_rskip(INT channel, INT count)
INT ss_tape_write(INT channel, void *pdata, INT count)
INT ss_tape_rewind(INT channel)
INT ss_tape_fskip(INT channel, INT count)
INT ss_tape_close(INT channel)
INT ss_tape_get_blockn(INT channel)
INT ss_tape_status(char *path)
INT ss_tape_mount(INT channel)
INT ss_tape_spool(INT channel)
INT ss_tape_read(INT channel, void *pdata, INT *count)
INT ss_tape_unmount(INT channel)
INT ss_tape_write_eof(INT channel)
INT ss_tape_open(char *path, INT oflag, INT *channel)
INT cm_set_msg_print(INT system_mask, INT user_mask, int(*func)(const char *))
#define write(n, a, f, d)
INT tape_dir(INT channel, INT count)
INT tape_backup(INT channel, INT count1, INT count2, char *file_name)
INT tape_restore(INT channel, INT count, char *file_name)
TH1X EXPRT * h1_book(const char *name, const char *title, int bins, double min, double max)