Makefile, libdelimit: update for including libdelimit in utilities
This commit is contained in:
parent
31b424d205
commit
15039805f9
11
Makefile
11
Makefile
@ -30,7 +30,8 @@ SYSEXITS != printf '\043include <sysexits.h>\n' | cpp -M - | tr ' ' '\n' \
|
||||
|
||||
CC ?= cc
|
||||
RUSTC ?= rustc
|
||||
RUSTFLAGS += --extern getopt=build/o/libgetopt.rlib \
|
||||
RUSTFLAGS += --extern delimit=build/o/libdelimit.rlib \
|
||||
--extern getopt=build/o/libgetopt.rlib \
|
||||
--extern strerror=build/o/libstrerror.rlib \
|
||||
--extern sysexits=build/o/libsysexits.rlib
|
||||
CFLAGS += -I$(SYSEXITS)
|
||||
@ -88,8 +89,12 @@ docs: docs/ build
|
||||
include $(OS_INCLUDE)
|
||||
|
||||
.PHONY: rustlibs
|
||||
rustlibs: build/o/libgetopt.rlib build/o/libstrerror.rlib \
|
||||
build/o/libsysexits.rlib $(OSLIB)
|
||||
rustlibs: build/o/libdelimit.rlib build/o/libgetopt.rlib \
|
||||
build/o/libstrerror.rlib build/o/libsysexits.rlib $(OSLIB)
|
||||
|
||||
build/o/libdelimit.rlib: build src/libdelimit.rs
|
||||
$(RUSTC) $(RUSTFLAGS) --crate-type=lib --crate-name=delimit \
|
||||
-o $@ src/libdelimit.rs
|
||||
|
||||
build/o/libgetopt.rlib: build src/libgetopt.rs
|
||||
$(RUSTC) $(RUSTFLAGS) --crate-type=lib --crate-name=getopt \
|
||||
|
||||
@ -17,21 +17,20 @@
|
||||
*/
|
||||
|
||||
use std::{
|
||||
io::{ Read, Result, stdin },
|
||||
io::{ Read, Result },
|
||||
mem::self,
|
||||
process::ExitCode,
|
||||
};
|
||||
|
||||
const BUFFER_SIZE: usize = 4096;
|
||||
|
||||
struct Delimited {
|
||||
pub struct Delimited {
|
||||
stream: Box<dyn Read>,
|
||||
delimiter: Vec<u8>,
|
||||
buffer: Vec<u8>
|
||||
}
|
||||
|
||||
impl Delimited {
|
||||
fn new(stream: Box<dyn Read>, delimiter: &[u8]) -> Self {
|
||||
pub fn new(stream: Box<dyn Read>, delimiter: &[u8]) -> Self {
|
||||
Delimited {
|
||||
stream,
|
||||
delimiter: delimiter.to_vec(),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user