From 85ef62444022fc22f7e81b82569f0e71d9fb3662 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Mon, 1 Feb 2021 10:32:21 +0100 Subject: [PATCH] tape: add pmt asf --- src/bin/pmt.rs | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/bin/pmt.rs b/src/bin/pmt.rs index 6e1d57fb..7e6e140a 100644 --- a/src/bin/pmt.rs +++ b/src/bin/pmt.rs @@ -98,6 +98,39 @@ fn get_tape_handle(param: &Value) -> Result { bail!("no drive/device specified"); } +#[api( + input: { + properties: { + drive: { + schema: DRIVE_NAME_SCHEMA, + optional: true, + }, + device: { + schema: LINUX_DRIVE_PATH_SCHEMA, + optional: true, + }, + count: { + schema: FILE_MARK_COUNT_SCHEMA, + }, + }, + }, +)] +/// Position the tape at the beginning of the count file. +/// +/// Positioning is done by first rewinding the tape and then spacing +/// forward over count file marks. +fn asf(count: i32, param: Value) -> Result<(), Error> { + + let mut handle = get_tape_handle(¶m)?; + + handle.rewind()?; + + handle.forward_space_count_files(count)?; + + Ok(()) +} + + #[api( input: { properties: { @@ -574,6 +607,7 @@ fn main() -> Result<(), Error> { }; let cmd_def = CliCommandMap::new() + .insert("asf", std_cmd(&API_METHOD_ASF).arg_param(&["count"])) .insert("bsf", std_cmd(&API_METHOD_BSF).arg_param(&["count"])) .insert("bsfm", std_cmd(&API_METHOD_BSFM).arg_param(&["count"])) .insert("cartridge-memory", std_cmd(&API_METHOD_CARTRIDGE_MEMORY))