From: steve@quintile.net (Steve Simon)
Subject: [TUHS] Determining what was on a tape back in the day
Date: Sun, 19 Nov 2017 20:46:57 +0000 [thread overview]
Message-ID: <5f0bd241efdcba81c747ed0355de9f52@quintile.net> (raw)
It can be hard to visualise what is on a tape when you have no idea
what is on there.
Attached is a simple tool I wrote "back then", shamlessly copying an
idea by Paul Scorer at Leeds Poly (My video systems lecturer).
It is called tm (tape mark).
-Steve
-------------- next part --------------
/* tm.c - read tape marks */
#include <stdio.h>
#include <signal.h>
int halt = 0;
void intr();
int main(int argc, char *argv[])
{
int fd;
static char buf[BUFSIZ * 128];
int got = 0, data = 0, mark = 0, was = -1;
char *dev = "/dev/tape";
if (argc > 1)
dev = argv[1];
if ((fd = open(dev, 0)) == -1){
perror(dev);
return(-1);
}
signal(SIGINT, intr);
do {
got = read(fd, buf, sizeof(buf));
got = (halt)? -1: got; /* check for restarted system call */
mark = (was == 0)? mark +1: 0;
data = (was > 0)? data +1: 0;
if (got != was && was > 0){
printf("%-6d X %-6d\n", data, was);
mark = 0;
}
if (got != was && was == 0){
printf("tm X %-6d\n", mark);
data = 0;
}
was = got;
} while(got != -1);
close(fd);
if (halt){
puts("Interupted");
}
else{
fflush(stdout);
perror("EOF");
}
return(0);
}
void intr()
{
halt = 1;
}
next reply other threads:[~2017-11-19 20:46 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-19 20:46 Steve Simon [this message]
-- strict thread matches above, loose matches on Subject: below --
2017-11-20 19:42 Noel Chiappa
2017-11-20 17:00 Noel Chiappa
2017-11-20 16:01 Noel Chiappa
2017-11-20 17:37 ` Will Senn
2017-11-19 18:45 Noel Chiappa
2017-11-19 17:49 Noel Chiappa
2017-11-19 18:35 ` Arthur Krewat
2017-11-19 13:41 Noel Chiappa
2017-11-19 14:55 ` Clem cole
2017-11-19 21:00 ` William Corcoran
2017-11-19 21:19 ` Ron Natalie
2017-11-19 22:00 ` Dave Horsfall
2017-11-19 22:38 ` Lyndon Nerenberg
2017-11-19 22:40 ` Ronald Natalie
2017-11-19 23:41 ` Dave Horsfall
2017-11-20 1:02 ` Ronald Natalie
2017-11-20 1:18 ` Dave Horsfall
2017-11-20 18:12 ` Random832
2017-11-20 23:22 ` Dave Horsfall
2017-11-20 23:35 ` William Pechter
2017-11-21 0:01 ` Ron Natalie
2017-11-20 19:02 ` Paul Winalski
2017-11-19 14:55 ` Will Senn
2017-11-18 19:23 Noel Chiappa
2017-11-18 21:32 ` Will Senn
2017-11-18 21:49 ` Warren Toomey
2017-11-18 18:34 Noel Chiappa
2017-11-18 18:37 ` Ronald Natalie
2017-11-18 18:40 ` Ronald Natalie
2017-11-18 21:51 ` Dave Horsfall
2017-11-18 21:07 ` Will Senn
2017-11-18 22:53 ` Clem Cole
2017-11-19 1:47 ` Will Senn
2017-11-18 16:39 Will Senn
2017-11-18 18:57 ` Clem Cole
2017-11-18 20:03 ` Don Hopkins
2017-11-18 22:37 ` Dave Horsfall
2017-11-18 23:16 ` Don Hopkins
2017-11-18 23:35 ` Arthur Krewat
2017-11-19 0:35 ` Steve Nickolas
2017-11-19 0:42 ` Don Hopkins
2017-11-19 1:04 ` Clem cole
2017-11-19 16:20 ` Arthur Krewat
2017-11-20 2:33 ` Lawrence Stewart
2017-11-18 21:26 ` Will Senn
2017-11-18 22:39 ` Clem Cole
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5f0bd241efdcba81c747ed0355de9f52@quintile.net \
--to=steve@quintile.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).