ports: add gnu grep
This commit is contained in:
parent
56640a4fc2
commit
69649f1cea
1
ports/gnu-grep/compile.sh
Symbolic link
1
ports/gnu-grep/compile.sh
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../meta-port-scripts/gnu-compile.sh
|
1
ports/gnu-grep/fetch.sh
Symbolic link
1
ports/gnu-grep/fetch.sh
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../meta-port-scripts/gnu-fetch.sh
|
3
ports/gnu-grep/gnu-project.sh
Normal file
3
ports/gnu-grep/gnu-project.sh
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export GNU_PROJECT=grep
|
||||||
|
export SRC_SHA256=1f31014953e71c3cddcedb97692ad7620cb9d6d04fbdc19e0d8dd836f87622bb
|
||||||
|
export GNU_CONFIGURE_OPTIONS=--disable-threads
|
1
ports/gnu-grep/install.sh
Symbolic link
1
ports/gnu-grep/install.sh
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../meta-port-scripts/gnu-install.sh
|
File diff suppressed because it is too large
Load Diff
2
ports/gnu-grep/port.toml
Normal file
2
ports/gnu-grep/port.toml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
description = "GNU text search utility"
|
||||||
|
version = "3.11"
|
@ -12,4 +12,7 @@ typedef int32_t ssize_t;
|
|||||||
// TODO _FILE_OFFSET_BITS
|
// TODO _FILE_OFFSET_BITS
|
||||||
typedef ssize_t off_t;
|
typedef ssize_t off_t;
|
||||||
|
|
||||||
|
// Some BSD extension used somewhere
|
||||||
|
typedef unsigned char u_char;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -265,6 +265,42 @@ unsafe extern "C" fn __freading(fp: *mut FILE) -> c_int {
|
|||||||
fp.reading() as c_int
|
fp.reading() as c_int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
unsafe extern "C" fn __freadable(fp: *mut FILE) -> c_int {
|
||||||
|
let fp = fp.ensure_mut();
|
||||||
|
fp.is_readable() as c_int
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
unsafe extern "C" fn __fwritable(fp: *mut FILE) -> c_int {
|
||||||
|
let fp = fp.ensure_mut();
|
||||||
|
fp.is_writeable() as c_int
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
unsafe extern "C" fn __fpending(fp: *mut FILE) -> usize {
|
||||||
|
let fp = fp.ensure_mut();
|
||||||
|
fp.pending_bytes()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
unsafe extern "C" fn __fbufsize(fp: *mut FILE) -> usize {
|
||||||
|
let fp = fp.ensure_mut();
|
||||||
|
fp.buffer_size()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
unsafe extern "C" fn __flbf(fp: *mut FILE) -> c_int {
|
||||||
|
let fp = fp.ensure_mut();
|
||||||
|
fp.is_line_buffered() as c_int
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
unsafe extern "C" fn __fwriting(fp: *mut FILE) -> c_int {
|
||||||
|
let fp = fp.ensure_mut();
|
||||||
|
fp.writing() as c_int
|
||||||
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
unsafe extern "C" fn __fseterr(_fp: *mut FILE) {
|
unsafe extern "C" fn __fseterr(_fp: *mut FILE) {
|
||||||
todo!("__fseterr()")
|
todo!("__fseterr()")
|
||||||
|
@ -145,3 +145,8 @@ unsafe extern "C" fn usleep(millis: c_uint) -> CIntZeroResult {
|
|||||||
process::sleep(duration).e_map_err(|_| Errno::EINTR)?;
|
process::sleep(duration).e_map_err(|_| Errno::EINTR)?;
|
||||||
CIntZeroResult::SUCCESS
|
CIntZeroResult::SUCCESS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
unsafe extern "C" fn getpagesize() -> usize {
|
||||||
|
4096
|
||||||
|
}
|
||||||
|
@ -26,6 +26,9 @@ pub struct ReadBuffer<'a> {
|
|||||||
// Write
|
// Write
|
||||||
|
|
||||||
pub trait FileWriter: Write {
|
pub trait FileWriter: Write {
|
||||||
|
fn is_line_buffered(&self) -> bool;
|
||||||
|
fn capacity(&self) -> usize;
|
||||||
|
fn pending_bytes(&self) -> usize;
|
||||||
fn reset(&mut self);
|
fn reset(&mut self);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,6 +132,18 @@ impl<W: Write> Write for UnbufferedWriter<W> {
|
|||||||
|
|
||||||
impl<W: Write> FileWriter for UnbufferedWriter<W> {
|
impl<W: Write> FileWriter for UnbufferedWriter<W> {
|
||||||
fn reset(&mut self) {}
|
fn reset(&mut self) {}
|
||||||
|
|
||||||
|
fn pending_bytes(&self) -> usize {
|
||||||
|
0
|
||||||
|
}
|
||||||
|
|
||||||
|
fn capacity(&self) -> usize {
|
||||||
|
0
|
||||||
|
}
|
||||||
|
|
||||||
|
fn is_line_buffered(&self) -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<W: Write> FullBufferedWriter<W> {
|
impl<W: Write> FullBufferedWriter<W> {
|
||||||
@ -180,6 +195,18 @@ impl<W: Write> FileWriter for FullBufferedWriter<W> {
|
|||||||
fn reset(&mut self) {
|
fn reset(&mut self) {
|
||||||
self.buffer.clear();
|
self.buffer.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn pending_bytes(&self) -> usize {
|
||||||
|
self.buffer.len()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn capacity(&self) -> usize {
|
||||||
|
self.buffer.capacity()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn is_line_buffered(&self) -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<W: Write> LineBufferedWriter<W> {
|
impl<W: Write> LineBufferedWriter<W> {
|
||||||
@ -226,4 +253,16 @@ impl<W: Write> FileWriter for LineBufferedWriter<W> {
|
|||||||
self.inner.reset();
|
self.inner.reset();
|
||||||
self.need_flush = false;
|
self.need_flush = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn pending_bytes(&self) -> usize {
|
||||||
|
self.inner.pending_bytes()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn capacity(&self) -> usize {
|
||||||
|
self.inner.capacity()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn is_line_buffered(&self) -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -294,13 +294,60 @@ impl FILE {
|
|||||||
self.lock.release();
|
self.lock.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn reading(&self) -> bool {
|
unsafe fn reading_locked(&self) -> bool {
|
||||||
!self.flags.contains(FileFlags::WRITE)
|
!self.flags.contains(FileFlags::WRITE)
|
||||||
|| self
|
|| self
|
||||||
.last_operation
|
.last_operation
|
||||||
.map_or(false, |op| op == Direction::Read)
|
.map_or(false, |op| op == Direction::Read)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn reading(&self) -> bool {
|
||||||
|
locked_op!(self, self.reading_locked())
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe fn writing_locked(&self) -> bool {
|
||||||
|
!self.flags.contains(FileFlags::WRITE)
|
||||||
|
|| self
|
||||||
|
.last_operation
|
||||||
|
.map_or(false, |op| op == Direction::Write)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn writing(&self) -> bool {
|
||||||
|
locked_op!(self, self.writing_locked())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn is_readable(&self) -> bool {
|
||||||
|
self.flags.contains(FileFlags::READ)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn is_writeable(&self) -> bool {
|
||||||
|
self.flags.contains(FileFlags::WRITE)
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe fn pending_bytes_locked(&self) -> usize {
|
||||||
|
self.write_buffer.pending_bytes()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn pending_bytes(&self) -> usize {
|
||||||
|
locked_op!(self, self.pending_bytes_locked())
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe fn buffer_size_locked(&self) -> usize {
|
||||||
|
self.write_buffer.capacity()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn buffer_size(&self) -> usize {
|
||||||
|
locked_op!(self, self.buffer_size_locked())
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe fn is_line_buffered_locked(&self) -> bool {
|
||||||
|
self.write_buffer.is_line_buffered()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn is_line_buffered(&self) -> bool {
|
||||||
|
locked_op!(self, self.is_line_buffered_locked())
|
||||||
|
}
|
||||||
|
|
||||||
// pub fn reset(&mut self) {
|
// pub fn reset(&mut self) {
|
||||||
// if let Some(read_buffer) = self.read_buffer.as_mut() {
|
// if let Some(read_buffer) = self.read_buffer.as_mut() {
|
||||||
// read_buffer.reset();
|
// read_buffer.reset();
|
||||||
|
@ -74,8 +74,6 @@ fn panic_handler(pi: &core::panic::PanicInfo) -> ! {
|
|||||||
|
|
||||||
use crate::{error::EResult, process, thread::Thread};
|
use crate::{error::EResult, process, thread::Thread};
|
||||||
|
|
||||||
yggdrasil_rt::debug_trace!(Error, "{:?}", pi);
|
|
||||||
|
|
||||||
match PANIC_COUNT.fetch_add(1, Ordering::Relaxed) {
|
match PANIC_COUNT.fetch_add(1, Ordering::Relaxed) {
|
||||||
0 => {
|
0 => {
|
||||||
let mut printer = PanicPrinter::new();
|
let mut printer = PanicPrinter::new();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user