summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhilipp Gesang <phg@phi-gamma.net>2017-01-22 18:11:44 +0100
committerGitHub <noreply@github.com>2017-01-22 18:11:44 +0100
commit655401ba67c5bd83faa3225e0b87be7bb2c3d789 (patch)
tree77b8a7a9cf46d198bf40270db48b63cd7d108eb4 /src
parent3592d70fd18686ca984db32204e6dcccd05731eb (diff)
parent2d64a773ee04192faf2e7be27256f9696a63f378 (diff)
downloadvtcol-655401ba67c5bd83faa3225e0b87be7bb2c3d789.tar.gz
Merge pull request #1 from aclemons/fix_build
Fix building against current rust versions
Diffstat (limited to 'src')
-rw-r--r--src/vtcol.rs43
1 files changed, 13 insertions, 30 deletions
diff --git a/src/vtcol.rs b/src/vtcol.rs
index e4f0b06..a82e5bb 100644
--- a/src/vtcol.rs
+++ b/src/vtcol.rs
@@ -1,24 +1,7 @@
-#![feature(libc)]
-#![feature(rustc_private)]
-#![feature(convert)]
-
-/* Core appears to require some extra handholding …
- */
-#![feature(core)]
-#![feature(core_slice_ext)]
-#![feature(core_str_ext)]
-
extern crate libc;
extern crate getopts;
extern crate core;
-use std::io::BufRead;
-
-/* Various traits.
- */
-use core::slice::SliceExt;
-use core::str::StrExt;
-
type Fd = libc::c_int;
static mut VERBOSITY : u8 = 0_u8;
@@ -156,16 +139,16 @@ impl<'a> Job {
{
let argv : Vec<String> = std::env::args().collect();
let this = argv[0].clone();
- let opts = &[
- getopts::optopt("s", "scheme", "predefined color scheme", "NAME"),
- getopts::optopt("d", "dump", "dump predefined scheme", "NAME"),
- getopts::optopt("f", "file", "apply scheme from file", "PATH"),
- getopts::optflag("v", "verbose", "enable verbose messages"),
- getopts::optflag("l", "list", "list available color schemes"),
- getopts::optflag("h", "help", "print this message")
- ];
-
- let matches = match getopts::getopts(argv.tail(), opts)
+ let mut opts = getopts::Options::new();
+
+ opts.optopt("s", "scheme", "predefined color scheme", "NAME");
+ opts.optopt("d", "dump", "dump predefined scheme", "NAME");
+ opts.optopt("f", "file", "apply scheme from file", "PATH");
+ opts.optflag("v", "verbose", "enable verbose messages");
+ opts.optflag("l", "list", "list available color schemes");
+ opts.optflag("h", "help", "print this message");
+
+ let matches = match opts.parse(&argv[1..])
{
Ok(m) => m,
Err(f) => panic!(f.to_string())
@@ -252,10 +235,10 @@ impl<'a> Job {
}
fn
- usage (this : &String, opts: &[getopts::OptGroup])
+ usage (this : &String, opts: getopts::Options)
{
let brief = format!("usage: {} [options]", this);
- print!("{}", getopts::usage(brief.as_str(), opts));
+ print!("{}", opts.usage(&brief));
}
fn
@@ -469,7 +452,7 @@ impl Palette {
if off > len - 6_usize { /* no room left for color definition after '#' char */
panic!("invalid color definition: {}", line);
}
- let col = line.slice_chars(off, off + RAW_COLEXPR_SIZE);
+ let col = &line[off..(off + RAW_COLEXPR_SIZE)];
let (r, g, b) = rgb_of_hex_triplet(col);
pal[pal_idx + 0_usize] = r;