/****************************************************************************** * This program simply writes lines with the alphabet to a file. * * Copyright © 2020 Richard Lesh. All rights reserved. *****************************************************************************/ mod utils; use std::error; use std::sync::Arc; fn writeTextFile(filespec:&str) -> Result<(), Arc> { utf8mode(ofh); printLine("ABCDEFGHIJKLMNOPQRSTUVWXYZ",ofh); printLine("ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ",ofh); printLine("АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ",ofh); printLine("゠ァアィイゥウェエォオカガキギクグケゲコゴサザシジスズセゼソゾタ",ofh); printLine("ダチヂッツヅテデトドナニヌネノハバパヒビピフブプヘベペホボポマミ",ofh); printLine("ムメモャヤュユョヨラリルレロヮワヰヱヲンヴヵヶヷヸヹヺ・ーヽヾヿ",ofh); close(ofh)?; } fn main() { if args.len() != 2 { println!("Syntax: {} {{filename}}", utils::program_name().expect("program name should not be empty!")); exit(1); } let mut filespec:String = args[1]; match (|| -> Result<(), Arc>{ writeTextFile(&filespec)?; return Ok(()); })() { Ok(()) => {}, Err(ex) => { if let Some(ex) = utils::isCustomErrorType(ex.clone(), io::Error("".to_string())){ println!("Error: {}", format!("{}", ex)); } } }; }