get system hostname

This commit is contained in:
Brandon Thomas committed 2016-08-02 01:29:51 -04:00
1 parent b0be23f618
commit 4f79e3d719
4 files changed
+60 -4

No files matched your search

Generated
+11
View File
@@ -7,6 +7,7 @@ dependencies = [
"hyper 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"iron 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"resolve 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"router 0.0.16 (registry+https://github.com/rust-lang/crates.io-index)",
"rust-crypto 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -315,6 +316,16 @@ dependencies = [
"winapi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "resolve"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "route-recognizer"
version = "0.1.11"
+1
View File
@@ -14,6 +14,7 @@
hyper = "0.7.*"
iron = "0.2.*"
log = "0.3.*"
resolve = "0.1.1"
router = "0.0.16"
rust-crypto = "0.2.*"
rustc-serialize = "0.3.15"
+16
View File
@@ -6,6 +6,7 @@ extern crate hound;
extern crate iron;
#[macro_use]
extern crate log;
extern crate resolve;
extern crate router;
extern crate rustc_serialize;
extern crate time;
@@ -23,6 +24,7 @@ use std::path::{Path, PathBuf};
use clap::{App, Arg, ArgMatches};
use iron::prelude::*;
use router::Router;
use resolve::hostname;
use config::Config;
use handlers::audio_synth_handler::AudioSynthHandler;
@@ -52,6 +54,8 @@ fn main() {
VocabularyLibrary::read_from_directory(
Path::new(&config.sound_path_development));
get_hostname();
start_server(&config, port);
}
@@ -89,3 +93,15 @@ fn start_server(config: &Config, port: u16) {
Iron::new(router).http(("0.0.0.0", port)).unwrap();
}
fn get_hostname() {
match hostname::get_hostname() {
Ok(s) => { println!("Hostname: {}", s); },
Err(_) => {},
};
/*let len = 34u;
let mut buf = std::vec::from_elem(len, 0u8);
let err = unsafe {gethostname (vec::raw::to_mut_ptr(buf) as *mut i8, len as u64)};
if err != 0 { println("oops, gethostname failed"); return; }*/
}
+32 -4
View File
@@ -1,10 +1,38 @@
const SENTENCES : string[] = [
"hillary is my favorite person in the world",
"i think your parents are absolutely stupid",
"what are you doing to those children",
"i remember when I was only fifty seven years of age",
"don't murder the poor people",
"hillary destroys all the good things",
"hillary is my favorite person in the world",
"i feel that war is a beautiful thing",
"i must be going crazy",
"i needed my mother and father that day",
"i remember when I was only fifty seven years of age",
"i saw children dying every way i look",
"i think your parents are absolutely stupid",
"i want all of your money immediately after this",
"i want to come in first place",
"i will always think you are stupid",
"i'm smarter than your children",
"i'm the president of reality space and the internet",
"it was a long time ago when hillary and bill got married",
"it's really amazing how dumb you are",
"just see the chaos i can create",
"let's count some numbers",
"let's make america great again",
"our civilization is better than the one they have",
"stop it",
"that man has taken all of my money",
"the total chaos and destruction is beautiful",
"there are countless children i needed to take from their countries",
"there are great images on the internet you know",
"this is the opportunity to take from the rich",
"we are all victims of harassment and abuse",
"what are you doing to those children",
"you and i are the same",
"you are all fools and i hate you",
"you fricken moron",
"that has increased my interest",
"your country is tragic and terrible",
];
export = SENTENCES;