From a0ade33e2291f525bdccdc0dada286987d3d70f6 Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Mon, 29 Jun 2020 00:52:06 +0200 Subject: pkgs/profpatsch: add static build of profpatsch.de This was previously located verbatim on my webserver. Since `df.eu` thought it was a good idea to unilaterally cancel it when I moved my domain, it is now a good idea to nixify what was there. --- pkgs/profpatsch/profpatsch.de/cv.pdf | Bin 0 -> 61424 bytes pkgs/profpatsch/profpatsch.de/default.nix | 142 ++++++++ pkgs/profpatsch/profpatsch.de/id.txt | 96 +++++ pkgs/profpatsch/profpatsch.de/index.html.nix | 95 +++++ pkgs/profpatsch/profpatsch.de/main.css | 49 +++ pkgs/profpatsch/profpatsch.de/normalize.css | 527 +++++++++++++++++++++++++++ pkgs/profpatsch/profpatsch.de/record-get.rs | 56 +++ 7 files changed, 965 insertions(+) create mode 100644 pkgs/profpatsch/profpatsch.de/cv.pdf create mode 100644 pkgs/profpatsch/profpatsch.de/default.nix create mode 100644 pkgs/profpatsch/profpatsch.de/id.txt create mode 100644 pkgs/profpatsch/profpatsch.de/index.html.nix create mode 100644 pkgs/profpatsch/profpatsch.de/main.css create mode 100644 pkgs/profpatsch/profpatsch.de/normalize.css create mode 100644 pkgs/profpatsch/profpatsch.de/record-get.rs (limited to 'pkgs/profpatsch/profpatsch.de') diff --git a/pkgs/profpatsch/profpatsch.de/cv.pdf b/pkgs/profpatsch/profpatsch.de/cv.pdf new file mode 100644 index 00000000..de8291f6 Binary files /dev/null and b/pkgs/profpatsch/profpatsch.de/cv.pdf differ diff --git a/pkgs/profpatsch/profpatsch.de/default.nix b/pkgs/profpatsch/profpatsch.de/default.nix new file mode 100644 index 00000000..9fa5d988 --- /dev/null +++ b/pkgs/profpatsch/profpatsch.de/default.nix @@ -0,0 +1,142 @@ +{ pkgs, lib, toNetstring, writeExecline, runExecline, getBins, writeRustSimple, netencode-rs, el-semicolon, el-substitute, el-exec, netencode }: + +let + bins = getBins pkgs.coreutils [ "ln" "mkdir" "echo" "printenv" "cat" "env" ] + // getBins pkgs.fdtools [ "multitee" ]; + + jquery = pkgs.fetchurl { + url = "https://code.jquery.com/jquery-3.5.1.min.js"; + sha256 = "0gbfbfcbcpl8nq2shknsyz5pirf5wbnb54m3dynxs68x9y4sbxpp"; + }; + + joinPath = lib.concatStringsSep "/"; + + stderr-tee = writeExecline "stderr-tee" {} [ + "pipeline" [ bins.multitee "0-1,2" ] "$@" + ]; + + staticFiles = + let + jsJquery = { + relativeDir = [ "js" ]; + relativeFile = "jquery.js"; + path = jquery; + }; + cssNormalize = { + relativeDir = [ "css" ]; + relativeFile = "normalize.css"; + path = ./normalize.css; + }; + cssMain = { + relativeDir = [ "css" ]; + relativeFile = "main.css"; + path = ./main.css; + }; + cv_pdf = { + relativeDir = []; + relativeFile = "cv.pdf"; + path = ./cv.pdf; + }; + id_txt = { + relativeDir = []; + relativeFile = "id.txt"; + path = ./id.txt; + }; + index_html = { + relativeDir = []; + relativeFile = "index.html"; + path = pkgs.writeText "index.html" + (import ./index.html.nix + (lib.mapAttrs + (k: v: joinPath (v.relativeDir ++ [ v.relativeFile ])) + { + inherit jsJquery cssNormalize cssMain; + inherit cv_pdf id_txt; + })); + }; + in { + inherit jsJquery cssNormalize cssMain; + inherit cv_pdf id_txt index_html; + }; + + record-get = writeRustSimple "record-get" { + dependencies = [ netencode-rs el-semicolon el-exec ]; + # TODO: for some reason the skarnet linker flag + # is propagated by the link target is not? + buildInputs = [ pkgs.skalibs ]; + } ./record-get.rs; + + importas-if = writeRustSimple "importas-if" { + dependencies = [ netencode-rs el-substitute el-exec ]; + # TODO: for some reason the skarnet linker flag + # is propagated by the link target is not? + buildInputs = [ pkgs.skalibs pkgs.execline ]; + } (pkgs.writeText "importas-if.rs" '' + extern crate el_exec; + extern crate el_substitute; + use std::ffi::CString; + use std::ffi::{OsString, OsStr}; + use std::os::unix::ffi::{OsStringExt, OsStrExt}; + fn main() { + let args = std::env::args_os().into_iter() + .map(|arg| CString::new(arg.as_bytes()).unwrap()) + .collect::>(); + assert!(args.len() >= 3, "at least two arguments required"); + let import = args[2].as_bytes(); + let as_var = &args[1]; + match std::env::var_os(OsStr::from_bytes(import)) { + // If envar doesn’t exist, exit 1. + // This makes it possible to react outside + None => std::process::exit(1), + // If it does, continue + Some(val) => + el_exec::xpathexec0( + &el_substitute::simple_substitute_argv( + &vec![el_substitute::Subst { + var: &as_var, + value: &CString::new(val.as_bytes()).unwrap(), + }], + &args[3..] + ) + ) + } + } + ''); + + linkStaticFiles = files: runExecline "link-static-files" { + stdin = lib.concatStrings ( + lib.mapAttrsToList (_: static: + toNetstring + (netencode.record + ((lib.optional (static.relativeDir != []) { key = "relDir"; val = netencode.binary (joinPath static.relativeDir); }) + ++ [ + { key = "relFile"; val = netencode.binary static.relativeFile; } + { key = "path"; val = netencode.binary static.path; } + ]))) + files + ); + } [ + "importas" "-ui" "out" "out" + "if" [ bins.mkdir "$out" ] + "forstdin" "-d" "" "dict" + "pipeline" [ bins.printenv "dict" ] + record-get [ "relDir" "relFile" "path" ] + "importas" "-ui" "relFile" "relFile" + "importas" "-ui" "path" "path" + "if" "-n" [ + importas-if "relDir" "relDir" + "if" [ bins.mkdir "-p" "\${out}/\${relDir}" ] + bins.ln "-s" "$path" "\${out}/\${relDir}/\${relFile}" + ] + bins.ln "-s" "$path" "\${out}/\${relFile}" + ]; + + websiteStatic = linkStaticFiles staticFiles; + +in { + inherit + websiteStatic + record-get + importas-if + ; +} diff --git a/pkgs/profpatsch/profpatsch.de/id.txt b/pkgs/profpatsch/profpatsch.de/id.txt new file mode 100644 index 00000000..219b6e7e --- /dev/null +++ b/pkgs/profpatsch/profpatsch.de/id.txt @@ -0,0 +1,96 @@ +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA256 + + +---------------------------------------------------------------------------+ + | | + | Profpatsch | + | mail@profpatsch.de | + | Augsburg, Germany | + | | + +---------------------------------------------------------------------------+ + + VALIDITY + ============================================================================ + This information is current as of 2017-02-14. If in doubt, check: + http://profpatsch.de/id.txt + for an updated version. + + + CRYPTOGRAPHIC INFORMATION + ============================================================================= + + GPG KEY AND SIGNING POLICY + ----------------------------------------------------------------------------- +pub 4096R/22247CDF 2012-06-19 + Key fingerprint = 4ACF D759 2710 266E 18CE BB28 C5CF D08B 2224 7CDF +uid Profpatsch +uid Profpatsch (jabber@ccc) +uid Profpatsch (jabber@deshalbfrei) +uid Profpatsch (jabber@ola) +sub 4096R/74FE6DF8 2012-06-19 + + You can find it at: http://profpatsch.de/key.asc + + I have no key transition statements at this time. + + Level 3 "I have done very careful checking" signatures by me indicate that: + * I personally know the subject of the key by that name, and have for some + time; + * I can readily recognise them; and + * I verified their key fingerprint in person. + + Level 2 "I have done casual checking" signatures by me indicate that: + * I physically met this person, not by voice or video chat; + * they presented me with very difficult to forge evidence of their identity + (normally state issued photo identification) or are widely recognized by their + identity by their peers; and + * I verified their key fingerprint at that time. + + + XMPP ACCOUNTS, OTR FINGERPRINTS & LOGGING STATEMENTS + ----------------------------------------------------------------------------- + + Profpatsch@ola.wtf/jabber - DSA + B00BE5D6 C2798E45 CDE9C94F 8A90071D DC133E8D + + Fallback accounts: + profpatsch@jabber.ccc.de + profpatsch@deshalbfrei.org + + I generally LOG my OTR sessions (for backlog). Holler if you don’t want that. + + + HOW TO VERIFY THIS FILE + ----------------------------------------------------------------------------- + 1) Import GPG key above (22247CDF) + 2) + $ curl http://profpatsch.de/id.txt > profpatsch.txt + $ gpg --verify profpatsch.txt + + + HOW TO SIGN THIS FILE + ----------------------------------------------------------------------------- + $ gpg --clearsign id.txt + + + THANKS TO + ----------------------------------------------------------------------------- + Johannes Führmann @weltraumpflege; from whom I blatantly stole this file. ;) + +-----BEGIN PGP SIGNATURE----- + +iQJHBAEBCAAxFiEESs/XWScQJm4Yzrsoxc/QiyIkfN8FAlijDtATHG1haWxAcHJv +ZnBhdHNjaC5kZQAKCRDFz9CLIiR830F8EACWeNr1v1orTtmS6EQc1Hi5g0+U22JD +7HnDrUKjnSwzfOJ6SEHCKJ9qlUQBxOO5d6orpMtDvsOnvPzyhWyGutnLFJw4sKmD +kGCeZdbURWKHDOTKVZCgOdHxpn2KRIxFArtYaQ09PzNGgNkJXfYkxnxXU0lEIbk7 +NKtXoisblf1FJLvIInEjbCaXqiDUifB5TeuSQzodwAcpziXQBjoXhVLimvoxhMWP +732hts7OJf9SLtnBEFTHdIAciNQ1jl6dBxnZxPCWT1Sh+pwCfuEzbhsre8PjDvR1 +HVJmazwwp4wNq8chs2yuzjcdQ37XI5okLaob8PlyQ6iJl3/BOoLNnkaQiDrGYPt8 +wX5NkWe3TS4pqAxnIoCvDVecwfk7p6cWX47ZtVNIIA0er+R14LltvJh3IR7PovCB +lLl8yJkNpWheA70F8aWjc5Xi/nnvz+uWo7iSXL+FUx6o6jGpREH4C0Yc4SAkBfTv +8aSFOMuSv2V40EZE3Q12CTQDXrUmfWYn/2kBT5T0VfbFSDWibIwjcJRR4B2KtM2D +/kI2kLUhN2GPqdG59n8wpKJ3g+hK1NA5wQ6kypdfYWWgyqbH2dMxbCQ1Tr2iq9oC +DpX48YJolT8etzvpsNHlE7uKeH0h/Eas4+pTs7sLVVEW5Ljm5VYRQ5VrHAXYZ0uh +jpDl4snBQ4LUFw== +=Y79X +-----END PGP SIGNATURE----- diff --git a/pkgs/profpatsch/profpatsch.de/index.html.nix b/pkgs/profpatsch/profpatsch.de/index.html.nix new file mode 100644 index 00000000..95e6f2ca --- /dev/null +++ b/pkgs/profpatsch/profpatsch.de/index.html.nix @@ -0,0 +1,95 @@ +{ jsJquery, cssNormalize, cssMain, id_txt, cv_pdf }: +'' + + + + + + Profpatsch’s Lair + + + + + + + + + + +
+

Profpatsch

+

+ + +

+
+
+ +
+

+ id.txt
+ CV +

+ +

Hey there. Seems like you landed on my webpage.

+ +

Well, more like a simple HTML page. But that’s fine for the moment, since I don’t use it as a web presence yet. + I may when I finally write those articles I have in mind, but for now you are stuck with this.

+ +

That’s not a problem, though, since other people do a lot better job at designing these. For example the folks at Youtube, StackExchange or Github.

+ +

If you are searching for a skilled programmer to do some work for you, look no further. + In case you want to know what I do in my free time, you can follow me on Twitter.

+

On another note, you can find me practically everywhere under my nick (Github, G+, several mailinglists, SO, &c.) + +

There you go. Cya!

+
+ + +'' diff --git a/pkgs/profpatsch/profpatsch.de/main.css b/pkgs/profpatsch/profpatsch.de/main.css new file mode 100644 index 00000000..f3c862dd --- /dev/null +++ b/pkgs/profpatsch/profpatsch.de/main.css @@ -0,0 +1,49 @@ +@import url(http://fonts.googleapis.com/css?family=Quattrocento|Open+Sans:400,300); + +body { + font-family: 'Open Sans', sans-serif; + font-size: 1em; +} + +main { + margin: 0 auto; + width: 500px; +} + +#title { + text-align: center; +} +#title h1 { + font-size: 4em; + font-weight: 300; + margin-bottom: 0em; +} +#title h2 { + font-size: 1.5em; + font-weight: 300; + margin-top: 0; +} +#title h2 a { + color: #000; + text-decoration: none; +} +#title h2 a:hover { + color: #333; +} +#title hr { + width: 100px; + border: 1px solid grey; + margin-bottom: 2em; +} + +p { + font-family: 'Quattrocento', serif; + text-align: justify; + line-height: 1.5em; +} + +#codeblock { + text-align: center; + font-family: monospace; + font-size: 16px; +} diff --git a/pkgs/profpatsch/profpatsch.de/normalize.css b/pkgs/profpatsch/profpatsch.de/normalize.css new file mode 100644 index 00000000..42e24d68 --- /dev/null +++ b/pkgs/profpatsch/profpatsch.de/normalize.css @@ -0,0 +1,527 @@ +/*! normalize.css v1.1.3 | MIT License | git.io/normalize */ + +/* ========================================================================== + HTML5 display definitions + ========================================================================== */ + +/** + * Correct `block` display not defined in IE 6/7/8/9 and Firefox 3. + */ + +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +main, +nav, +section, +summary { + display: block; +} + +/** + * Correct `inline-block` display not defined in IE 6/7/8/9 and Firefox 3. + */ + +audio, +canvas, +video { + display: inline-block; + *display: inline; + *zoom: 1; +} + +/** + * Prevent modern browsers from displaying `audio` without controls. + * Remove excess height in iOS 5 devices. + */ + +audio:not([controls]) { + display: none; + height: 0; +} + +/** + * Address styling not present in IE 7/8/9, Firefox 3, and Safari 4. + * Known issue: no IE 6 support. + */ + +[hidden] { + display: none; +} + +/* ========================================================================== + Base + ========================================================================== */ + +/** + * 1. Correct text resizing oddly in IE 6/7 when body `font-size` is set using + * `em` units. + * 2. Prevent iOS text size adjust after orientation change, without disabling + * user zoom. + */ + +html { + font-size: 100%; /* 1 */ + -ms-text-size-adjust: 100%; /* 2 */ + -webkit-text-size-adjust: 100%; /* 2 */ +} + +/** + * Address `font-family` inconsistency between `textarea` and other form + * elements. + */ + +html, +button, +input, +select, +textarea { + font-family: sans-serif; +} + +/** + * Address margins handled incorrectly in IE 6/7. + */ + +body { + margin: 0; +} + +/* ========================================================================== + Links + ========================================================================== */ + +/** + * Address `outline` inconsistency between Chrome and other browsers. + */ + +a:focus { + outline: thin dotted; +} + +/** + * Improve readability when focused and also mouse hovered in all browsers. + */ + +a:active, +a:hover { + outline: 0; +} + +/* ========================================================================== + Typography + ========================================================================== */ + +/** + * Address font sizes and margins set differently in IE 6/7. + * Address font sizes within `section` and `article` in Firefox 4+, Safari 5, + * and Chrome. + */ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +h2 { + font-size: 1.5em; + margin: 0.83em 0; +} + +h3 { + font-size: 1.17em; + margin: 1em 0; +} + +h4 { + font-size: 1em; + margin: 1.33em 0; +} + +h5 { + font-size: 0.83em; + margin: 1.67em 0; +} + +h6 { + font-size: 0.67em; + margin: 2.33em 0; +} + +/** + * Address styling not present in IE 7/8/9, Safari 5, and Chrome. + */ + +abbr[title] { + border-bottom: 1px dotted; +} + +/** + * Address style set to `bolder` in Firefox 3+, Safari 4/5, and Chrome. + */ + +b, +strong { + font-weight: bold; +} + +blockquote { + margin: 1em 40px; +} + +/** + * Address styling not present in Safari 5 and Chrome. + */ + +dfn { + font-style: italic; +} + +/** + * Address differences between Firefox and other browsers. + * Known issue: no IE 6/7 normalization. + */ + +hr { + -moz-box-sizing: content-box; + box-sizing: content-box; + height: 0; +} + +/** + * Address styling not present in IE 6/7/8/9. + */ + +mark { + background: #ff0; + color: #000; +} + +/** + * Address margins set differently in IE 6/7. + */ + +p, +pre { + margin: 1em 0; +} + +/** + * Correct font family set oddly in IE 6, Safari 4/5, and Chrome. + */ + +code, +kbd, +pre, +samp { + font-family: monospace, serif; + _font-family: 'courier new', monospace; + font-size: 1em; +} + +/** + * Improve readability of pre-formatted text in all browsers. + */ + +pre { + white-space: pre; + white-space: pre-wrap; + word-wrap: break-word; +} + +/** + * Address CSS quotes not supported in IE 6/7. + */ + +q { + quotes: none; +} + +/** + * Address `quotes` property not supported in Safari 4. + */ + +q:before, +q:after { + content: ''; + content: none; +} + +/** + * Address inconsistent and variable font size in all browsers. + */ + +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` affecting `line-height` in all browsers. + */ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sup { + top: -0.5em; +} + +sub { + bottom: -0.25em; +} + +/* ========================================================================== + Lists + ========================================================================== */ + +/** + * Address margins set differently in IE 6/7. + */ + +dl, +menu, +ol, +ul { + margin: 1em 0; +} + +dd { + margin: 0 0 0 40px; +} + +/** + * Address paddings set differently in IE 6/7. + */ + +menu, +ol, +ul { + padding: 0 0 0 40px; +} + +/** + * Correct list images handled incorrectly in IE 7. + */ + +nav ul, +nav ol { + list-style: none; + list-style-image: none; +} + +/* ========================================================================== + Embedded content + ========================================================================== */ + +/** + * 1. Remove border when inside `a` element in IE 6/7/8/9 and Firefox 3. + * 2. Improve image quality when scaled in IE 7. + */ + +img { + border: 0; /* 1 */ + -ms-interpolation-mode: bicubic; /* 2 */ +} + +/** + * Correct overflow displayed oddly in IE 9. + */ + +svg:not(:root) { + overflow: hidden; +} + +/* ========================================================================== + Figures + ========================================================================== */ + +/** + * Address margin not present in IE 6/7/8/9, Safari 5, and Opera 11. + */ + +figure { + margin: 0; +} + +/* ========================================================================== + Forms + ========================================================================== */ + +/** + * Correct margin displayed oddly in IE 6/7. + */ + +form { + margin: 0; +} + +/** + * Define consistent border, margin, and padding. + */ + +fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; +} + +/** + * 1. Correct color not being inherited in IE 6/7/8/9. + * 2. Correct text not wrapping in Firefox 3. + * 3. Correct alignment displayed oddly in IE 6/7. + */ + +legend { + border: 0; /* 1 */ + padding: 0; + white-space: normal; /* 2 */ + *margin-left: -7px; /* 3 */ +} + +/** + * 1. Correct font size not being inherited in all browsers. + * 2. Address margins set differently in IE 6/7, Firefox 3+, Safari 5, + * and Chrome. + * 3. Improve appearance and consistency in all browsers. + */ + +button, +input, +select, +textarea { + font-size: 100%; /* 1 */ + margin: 0; /* 2 */ + vertical-align: baseline; /* 3 */ + *vertical-align: middle; /* 3 */ +} + +/** + * Address Firefox 3+ setting `line-height` on `input` using `!important` in + * the UA stylesheet. + */ + +button, +input { + line-height: normal; +} + +/** + * Address inconsistent `text-transform` inheritance for `button` and `select`. + * All other form control elements do not inherit `text-transform` values. + * Correct `button` style inheritance in Chrome, Safari 5+, and IE 6+. + * Correct `select` style inheritance in Firefox 4+ and Opera. + */ + +button, +select { + text-transform: none; +} + +/** + * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` + * and `video` controls. + * 2. Correct inability to style clickable `input` types in iOS. + * 3. Improve usability and consistency of cursor style between image-type + * `input` and others. + * 4. Remove inner spacing in IE 7 without affecting normal text inputs. + * Known issue: inner spacing remains in IE 6. + */ + +button, +html input[type="button"], /* 1 */ +input[type="reset"], +input[type="submit"] { + -webkit-appearance: button; /* 2 */ + cursor: pointer; /* 3 */ + *overflow: visible; /* 4 */ +} + +/** + * Re-set default cursor for disabled elements. + */ + +button[disabled], +html input[disabled] { + cursor: default; +} + +/** + * 1. Address box sizing set to content-box in IE 8/9. + * 2. Remove excess padding in IE 8/9. + * 3. Remove excess padding in IE 7. + * Known issue: excess padding remains in IE 6. + */ + +input[type="checkbox"], +input[type="radio"] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ + *height: 13px; /* 3 */ + *width: 13px; /* 3 */ +} + +/** + * 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome. + * 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome + * (include `-moz` to future-proof). + */ + +input[type="search"] { + -webkit-appearance: textfield; /* 1 */ + -moz-box-sizing: content-box; + -webkit-box-sizing: content-box; /* 2 */ + box-sizing: content-box; +} + +/** + * Remove inner padding and search cancel button in Safari 5 and Chrome + * on OS X. + */ + +input[type="search"]::-webkit-search-cancel-button, +input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * Remove inner padding and border in Firefox 3+. + */ + +button::-moz-focus-inner, +input::-moz-focus-inner { + border: 0; + padding: 0; +} + +/** + * 1. Remove default vertical scrollbar in IE 6/7/8/9. + * 2. Improve readability and alignment in all browsers. + */ + +textarea { + overflow: auto; /* 1 */ + vertical-align: top; /* 2 */ +} + +/* ========================================================================== + Tables + ========================================================================== */ + +/** + * Remove most spacing between table cells. + */ + +table { + border-collapse: collapse; + border-spacing: 0; +} diff --git a/pkgs/profpatsch/profpatsch.de/record-get.rs b/pkgs/profpatsch/profpatsch.de/record-get.rs new file mode 100644 index 00000000..bf4db3dd --- /dev/null +++ b/pkgs/profpatsch/profpatsch.de/record-get.rs @@ -0,0 +1,56 @@ +extern crate netencode; +extern crate el_semicolon; +extern crate el_exec; + +use std::io::Read; +use std::ffi::{CString, OsStr}; +use std::os::unix::ffi::{OsStringExt, OsStrExt}; +use el_semicolon::{el_semicolon, Arg}; +use netencode::{U}; +use netencode::parse::{u_u}; + +fn main() { + let args = std::env::args_os().by_ref() + .map(|s| s.into_vec()) + .skip(1) + .collect::>(); + let args_ref : Vec<&[u8]> = args.iter().map(|v| v.as_slice()).collect(); + let (arg, prog) = el_semicolon::el_semicolon(&args_ref).unwrap(); + assert!(prog.len() > 0, "record get neets a block of vars and prog, no prog provided"); + match arg { + Arg::EndOfArgv | Arg::Arg(_) => { + panic!("first argument must be a block of vars"); + }, + Arg::Block(vars) => { + let mut stdin = vec![]; + std::io::stdin().read_to_end(&mut stdin); + match u_u(&stdin) { + Ok((_, U::Record(m))) => { + for (key, val) in m.into_iter() { + // only set if it appears in the block of values. + // If the block is empty, don’t filter. + if vars.is_empty() || vars.contains(&key.as_bytes()) { + match *val { + U::Binary(b) => std::env::set_var(key, OsStr::from_bytes(b)), + _ => panic!("the value of {:?} was not a binary value!", key) + } + } + } + let mut p : Vec = vec![]; + for arg in prog { + p.push(CString::new(*arg).unwrap()); + } + el_exec::xpathexec0(&p); + }, + Ok(_) => { + eprintln!("not a record!"); + std::process::exit(100); + } + Err(e) => { + eprintln!("could not parse netencode: {:?}", e); + std::process::exit(100); + }, + } + } + } +} -- cgit 1.4.1