Skip to content

Instantly share code, notes, and snippets.

@master-q master-q/cat.c
Last active Feb 1, 2019

Embed
What would you like to do?
C2RustにBSDなcatをかけてみた
/* $OpenBSD: cat.c,v 1.26 2016/10/19 18:20:25 schwarze Exp $ */
/* $NetBSD: cat.c,v 1.11 1995/09/07 06:12:54 jtc Exp $ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Kevin Fall.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <ctype.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
extern char *__progname;
int bflag, eflag, nflag, sflag, tflag, vflag;
int rval;
char *filename;
void cook_args(char **argv);
void cook_buf(FILE *);
void raw_args(char **argv);
void raw_cat(int);
int
main()
{
int argc;
char **argv;
int ch;
#if 0
if (pledge("stdio rpath", NULL) == -1)
err(1, "pledge");
#endif
while ((ch = getopt(argc, argv, "benstuv")) != -1)
switch (ch) {
case 'b':
bflag = nflag = 1; /* -b implies -n */
break;
case 'e':
eflag = vflag = 1; /* -e implies -v */
break;
case 'n':
nflag = 1;
break;
case 's':
sflag = 1;
break;
case 't':
tflag = vflag = 1; /* -t implies -v */
break;
case 'u':
setvbuf(stdout, NULL, _IONBF, 0);
break;
case 'v':
vflag = 1;
break;
default:
(void)fprintf(stderr,
"usage: %s [-benstuv] [file ...]\n", __progname);
return 1;
}
argv += optind;
if (bflag || eflag || nflag || sflag || tflag || vflag)
cook_args(argv);
else
raw_args(argv);
if (fclose(stdout))
err(1, "stdout");
return rval;
}
void
cook_args(char **argv)
{
FILE *fp;
fp = stdin;
filename = "stdin";
do {
if (*argv) {
if (!strcmp(*argv, "-"))
fp = stdin;
else if ((fp = fopen(*argv, "r")) == NULL) {
warn("%s", *argv);
rval = 1;
++argv;
continue;
}
filename = *argv++;
}
cook_buf(fp);
if (fp == stdin)
clearerr(fp);
else
(void)fclose(fp);
} while (*argv);
}
void
cook_buf(FILE *fp)
{
int ch, gobble, line, prev;
line = gobble = 0;
for (prev = '\n'; (ch = getc(fp)) != EOF; prev = ch) {
if (prev == '\n') {
if (sflag) {
if (ch == '\n') {
if (gobble)
continue;
gobble = 1;
} else
gobble = 0;
}
if (nflag) {
if (!bflag || ch != '\n') {
(void)fprintf(stdout, "%6d\t", ++line);
if (ferror(stdout))
break;
} else if (eflag) {
(void)fprintf(stdout, "%6s\t", "");
if (ferror(stdout))
break;
}
}
}
if (ch == '\n') {
if (eflag && putchar('$') == EOF)
break;
} else if (ch == '\t') {
if (tflag) {
if (putchar('^') == EOF || putchar('I') == EOF)
break;
continue;
}
} else if (vflag) {
if (!isascii(ch)) {
if (putchar('M') == EOF || putchar('-') == EOF)
break;
ch = toascii(ch);
}
if (iscntrl(ch)) {
if (putchar('^') == EOF ||
putchar(ch == '\177' ? '?' :
ch | 0100) == EOF)
break;
continue;
}
}
if (putchar(ch) == EOF)
break;
}
if (ferror(fp)) {
warn("%s", filename);
rval = 1;
clearerr(fp);
}
if (ferror(stdout))
err(1, "stdout");
}
void
raw_args(char **argv)
{
int fd;
fd = fileno(stdin);
filename = "stdin";
do {
if (*argv) {
if (!strcmp(*argv, "-"))
fd = fileno(stdin);
else if ((fd = open(*argv, O_RDONLY, 0)) < 0) {
warn("%s", *argv);
rval = 1;
++argv;
continue;
}
filename = *argv++;
}
raw_cat(fd);
if (fd != fileno(stdin))
(void)close(fd);
} while (*argv);
}
void
raw_cat(int rfd)
{
int wfd;
ssize_t nr, nw, off;
static size_t bsize;
static char *buf = NULL;
struct stat sbuf;
wfd = fileno(stdout);
if (buf == NULL) {
if (fstat(wfd, &sbuf))
err(1, "stdout");
bsize = MAXIMUM(sbuf.st_blksize, BUFSIZ);
if ((buf = malloc(bsize)) == NULL)
err(1, "malloc");
}
while ((nr = read(rfd, buf, bsize)) != -1 && nr != 0)
for (off = 0; nr; nr -= nw, off += nw)
if ((nw = write(wfd, buf + off, (size_t)nr)) == 0 ||
nw == -1)
err(1, "stdout");
if (nr < 0) {
warn("%s", filename);
rval = 1;
}
}
#![allow(
dead_code,
mutable_transmutes,
non_camel_case_types,
non_snake_case,
non_upper_case_globals,
unused_mut
)]
#![feature(libc)]
extern crate libc;
extern "C" {
#[no_mangle]
fn fstat(__fd: libc::c_int, __buf: *mut stat) -> libc::c_int;
#[no_mangle]
fn __ctype_b_loc() -> *mut *const libc::c_ushort;
#[no_mangle]
fn warn(__format: *const libc::c_char, ...);
#[no_mangle]
fn err(__status: libc::c_int, __format: *const libc::c_char, ...) -> !;
#[no_mangle]
fn open(__file: *const libc::c_char, __oflag: libc::c_int, ...) -> libc::c_int;
#[no_mangle]
fn _IO_getc(__fp: *mut _IO_FILE) -> libc::c_int;
#[no_mangle]
static mut stdin: *mut _IO_FILE;
#[no_mangle]
static mut stdout: *mut _IO_FILE;
#[no_mangle]
static mut stderr: *mut _IO_FILE;
#[no_mangle]
fn fclose(__stream: *mut FILE) -> libc::c_int;
#[no_mangle]
fn fopen(__filename: *const libc::c_char, __modes: *const libc::c_char) -> *mut FILE;
#[no_mangle]
fn setvbuf(
__stream: *mut FILE,
__buf: *mut libc::c_char,
__modes: libc::c_int,
__n: size_t,
) -> libc::c_int;
#[no_mangle]
fn fprintf(_: *mut FILE, _: *const libc::c_char, ...) -> libc::c_int;
#[no_mangle]
fn putchar(__c: libc::c_int) -> libc::c_int;
#[no_mangle]
fn clearerr(__stream: *mut FILE);
#[no_mangle]
fn ferror(__stream: *mut FILE) -> libc::c_int;
#[no_mangle]
fn fileno(__stream: *mut FILE) -> libc::c_int;
#[no_mangle]
fn malloc(_: libc::c_ulong) -> *mut libc::c_void;
#[no_mangle]
fn strcmp(_: *const libc::c_char, _: *const libc::c_char) -> libc::c_int;
#[no_mangle]
fn close(__fd: libc::c_int) -> libc::c_int;
#[no_mangle]
fn read(__fd: libc::c_int, __buf: *mut libc::c_void, __nbytes: size_t) -> ssize_t;
#[no_mangle]
fn write(__fd: libc::c_int, __buf: *const libc::c_void, __n: size_t) -> ssize_t;
#[no_mangle]
static mut optind: libc::c_int;
#[no_mangle]
fn getopt(
___argc: libc::c_int,
___argv: *const *mut libc::c_char,
__shortopts: *const libc::c_char,
) -> libc::c_int;
/* $OpenBSD: cat.c,v 1.26 2016/10/19 18:20:25 schwarze Exp $ */
/* $NetBSD: cat.c,v 1.11 1995/09/07 06:12:54 jtc Exp $ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Kevin Fall.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#[no_mangle]
static mut __progname: *mut libc::c_char;
}
pub type __dev_t = libc::c_ulong;
pub type __uid_t = libc::c_uint;
pub type __gid_t = libc::c_uint;
pub type __ino_t = libc::c_ulong;
pub type __mode_t = libc::c_uint;
pub type __nlink_t = libc::c_ulong;
pub type __off_t = libc::c_long;
pub type __off64_t = libc::c_long;
pub type __time_t = libc::c_long;
pub type __blksize_t = libc::c_long;
pub type __blkcnt_t = libc::c_long;
pub type __ssize_t = libc::c_long;
pub type __syscall_slong_t = libc::c_long;
pub type ssize_t = __ssize_t;
pub type size_t = libc::c_ulong;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct timespec {
pub tv_sec: __time_t,
pub tv_nsec: __syscall_slong_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct stat {
pub st_dev: __dev_t,
pub st_ino: __ino_t,
pub st_nlink: __nlink_t,
pub st_mode: __mode_t,
pub st_uid: __uid_t,
pub st_gid: __gid_t,
pub __pad0: libc::c_int,
pub st_rdev: __dev_t,
pub st_size: __off_t,
pub st_blksize: __blksize_t,
pub st_blocks: __blkcnt_t,
pub st_atim: timespec,
pub st_mtim: timespec,
pub st_ctim: timespec,
pub __glibc_reserved: [__syscall_slong_t; 3],
}
pub type unnamed = libc::c_uint;
pub const _ISalnum: unnamed = 8;
pub const _ISpunct: unnamed = 4;
pub const _IScntrl: unnamed = 2;
pub const _ISblank: unnamed = 1;
pub const _ISgraph: unnamed = 32768;
pub const _ISprint: unnamed = 16384;
pub const _ISspace: unnamed = 8192;
pub const _ISxdigit: unnamed = 4096;
pub const _ISdigit: unnamed = 2048;
pub const _ISalpha: unnamed = 1024;
pub const _ISlower: unnamed = 512;
pub const _ISupper: unnamed = 256;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct _IO_FILE {
pub _flags: libc::c_int,
pub _IO_read_ptr: *mut libc::c_char,
pub _IO_read_end: *mut libc::c_char,
pub _IO_read_base: *mut libc::c_char,
pub _IO_write_base: *mut libc::c_char,
pub _IO_write_ptr: *mut libc::c_char,
pub _IO_write_end: *mut libc::c_char,
pub _IO_buf_base: *mut libc::c_char,
pub _IO_buf_end: *mut libc::c_char,
pub _IO_save_base: *mut libc::c_char,
pub _IO_backup_base: *mut libc::c_char,
pub _IO_save_end: *mut libc::c_char,
pub _markers: *mut _IO_marker,
pub _chain: *mut _IO_FILE,
pub _fileno: libc::c_int,
pub _flags2: libc::c_int,
pub _old_offset: __off_t,
pub _cur_column: libc::c_ushort,
pub _vtable_offset: libc::c_schar,
pub _shortbuf: [libc::c_char; 1],
pub _lock: *mut libc::c_void,
pub _offset: __off64_t,
pub __pad1: *mut libc::c_void,
pub __pad2: *mut libc::c_void,
pub __pad3: *mut libc::c_void,
pub __pad4: *mut libc::c_void,
pub __pad5: size_t,
pub _mode: libc::c_int,
pub _unused2: [libc::c_char; 20],
}
pub type _IO_lock_t = ();
#[derive(Copy, Clone)]
#[repr(C)]
pub struct _IO_marker {
pub _next: *mut _IO_marker,
pub _sbuf: *mut _IO_FILE,
pub _pos: libc::c_int,
}
pub type FILE = _IO_FILE;
#[no_mangle]
pub static mut bflag: libc::c_int = 0;
#[no_mangle]
pub static mut eflag: libc::c_int = 0;
#[no_mangle]
pub static mut nflag: libc::c_int = 0;
#[no_mangle]
pub static mut sflag: libc::c_int = 0;
#[no_mangle]
pub static mut tflag: libc::c_int = 0;
#[no_mangle]
pub static mut vflag: libc::c_int = 0;
#[no_mangle]
pub static mut rval: libc::c_int = 0;
#[no_mangle]
pub static mut filename: *mut libc::c_char = 0 as *const libc::c_char as *mut libc::c_char;
#[no_mangle]
pub unsafe extern "C" fn cook_args(mut argv: *mut *mut libc::c_char) {
let mut fp: *mut FILE = 0 as *mut FILE;
fp = stdin;
filename = b"stdin\x00" as *const u8 as *const libc::c_char as *mut libc::c_char;
let mut current_block_10: u64;
loop {
if !(*argv).is_null() {
if 0 == strcmp(*argv, b"-\x00" as *const u8 as *const libc::c_char) {
fp = stdin;
current_block_10 = 1394248824506584008;
} else {
fp = fopen(*argv, b"r\x00" as *const u8 as *const libc::c_char);
if fp.is_null() {
warn(b"%s\x00" as *const u8 as *const libc::c_char, *argv);
rval = 1i32;
argv = argv.offset(1isize);
current_block_10 = 14916268686031723178;
} else {
current_block_10 = 1394248824506584008;
}
}
match current_block_10 {
14916268686031723178 => {}
_ => {
let fresh0 = argv;
argv = argv.offset(1);
filename = *fresh0;
current_block_10 = 17965632435239708295;
}
}
} else {
current_block_10 = 17965632435239708295;
}
match current_block_10 {
17965632435239708295 => {
cook_buf(fp);
if fp == stdin {
clearerr(fp);
} else {
fclose(fp);
}
}
_ => {}
}
if (*argv).is_null() {
break;
}
}
}
#[no_mangle]
pub unsafe extern "C" fn cook_buf(mut fp: *mut FILE) {
let mut ch: libc::c_int = 0;
let mut gobble: libc::c_int = 0;
let mut line: libc::c_int = 0;
let mut prev: libc::c_int = 0;
gobble = 0i32;
line = gobble;
let mut current_block_6: u64;
prev = '\n' as i32;
loop {
ch = _IO_getc(fp);
if !(ch != -1i32) {
break;
}
if prev == '\n' as i32 {
if 0 != sflag {
if ch == '\n' as i32 {
if 0 != gobble {
current_block_6 = 8258075665625361029;
} else {
gobble = 1i32;
current_block_6 = 11812396948646013369;
}
} else {
gobble = 0i32;
current_block_6 = 11812396948646013369;
}
} else {
current_block_6 = 11812396948646013369;
}
match current_block_6 {
8258075665625361029 => {}
_ => {
if 0 != nflag {
if 0 == bflag || ch != '\n' as i32 {
line += 1;
fprintf(
stdout,
b"%6d\t\x00" as *const u8 as *const libc::c_char,
line,
);
if 0 != ferror(stdout) {
break;
}
} else if 0 != eflag {
fprintf(
stdout,
b"%6s\t\x00" as *const u8 as *const libc::c_char,
b"\x00" as *const u8 as *const libc::c_char,
);
if 0 != ferror(stdout) {
break;
}
}
current_block_6 = 12124785117276362961;
} else {
current_block_6 = 12124785117276362961;
}
}
}
} else {
current_block_6 = 12124785117276362961;
}
match current_block_6 {
12124785117276362961 => {
if ch == '\n' as i32 {
if 0 != eflag && putchar('$' as i32) == -1i32 {
break;
}
current_block_6 = 2873832966593178012;
} else if ch == '\t' as i32 {
if 0 != tflag {
if putchar('^' as i32) == -1i32 || putchar('I' as i32) == -1i32 {
break;
}
current_block_6 = 8258075665625361029;
} else {
current_block_6 = 2873832966593178012;
}
} else if 0 != vflag {
if !(ch & !0x7fi32 == 0i32) {
if putchar('M' as i32) == -1i32 || putchar('-' as i32) == -1i32 {
break;
}
ch = ch & 0x7fi32
}
if 0 != *(*__ctype_b_loc()).offset(ch as isize) as libc::c_int
& _IScntrl as libc::c_int as libc::c_ushort as libc::c_int
{
if putchar('^' as i32) == -1i32
|| putchar(if ch == '\u{7f}' as i32 {
'?' as i32
} else {
ch | 0o100i32
}) == -1i32
{
break;
}
current_block_6 = 8258075665625361029;
} else {
current_block_6 = 2873832966593178012;
}
} else {
current_block_6 = 2873832966593178012;
}
match current_block_6 {
8258075665625361029 => {}
_ => {
if putchar(ch) == -1i32 {
break;
}
}
}
}
_ => {}
}
prev = ch
}
if 0 != ferror(fp) {
warn(b"%s\x00" as *const u8 as *const libc::c_char, filename);
rval = 1i32;
clearerr(fp);
}
if 0 != ferror(stdout) {
err(1i32, b"stdout\x00" as *const u8 as *const libc::c_char);
};
}
#[no_mangle]
pub unsafe extern "C" fn raw_args(mut argv: *mut *mut libc::c_char) {
let mut fd: libc::c_int = 0;
fd = fileno(stdin);
filename = b"stdin\x00" as *const u8 as *const libc::c_char as *mut libc::c_char;
let mut current_block_9: u64;
loop {
if !(*argv).is_null() {
if 0 == strcmp(*argv, b"-\x00" as *const u8 as *const libc::c_char) {
fd = fileno(stdin);
current_block_9 = 1394248824506584008;
} else {
fd = open(*argv, 0i32, 0i32);
if fd < 0i32 {
warn(b"%s\x00" as *const u8 as *const libc::c_char, *argv);
rval = 1i32;
argv = argv.offset(1isize);
current_block_9 = 14916268686031723178;
} else {
current_block_9 = 1394248824506584008;
}
}
match current_block_9 {
14916268686031723178 => {}
_ => {
let fresh1 = argv;
argv = argv.offset(1);
filename = *fresh1;
current_block_9 = 17965632435239708295;
}
}
} else {
current_block_9 = 17965632435239708295;
}
match current_block_9 {
17965632435239708295 => {
raw_cat(fd);
if fd != fileno(stdin) {
close(fd);
}
}
_ => {}
}
if (*argv).is_null() {
break;
}
}
}
#[no_mangle]
pub unsafe extern "C" fn raw_cat(mut rfd: libc::c_int) {
let mut wfd: libc::c_int = 0;
let mut nr: ssize_t = 0;
let mut nw: ssize_t = 0;
let mut off: ssize_t = 0;
static mut bsize: size_t = 0;
static mut buf: *mut libc::c_char = 0 as *const libc::c_char as *mut libc::c_char;
let mut sbuf: stat = stat {
st_dev: 0,
st_ino: 0,
st_nlink: 0,
st_mode: 0,
st_uid: 0,
st_gid: 0,
__pad0: 0,
st_rdev: 0,
st_size: 0,
st_blksize: 0,
st_blocks: 0,
st_atim: timespec {
tv_sec: 0,
tv_nsec: 0,
},
st_mtim: timespec {
tv_sec: 0,
tv_nsec: 0,
},
st_ctim: timespec {
tv_sec: 0,
tv_nsec: 0,
},
__glibc_reserved: [0; 3],
};
wfd = fileno(stdout);
if buf.is_null() {
if 0 != fstat(wfd, &mut sbuf) {
err(1i32, b"stdout\x00" as *const u8 as *const libc::c_char);
}
bsize = (if sbuf.st_blksize > 8192i32 as libc::c_long {
sbuf.st_blksize
} else {
8192i32 as libc::c_long
}) as size_t;
buf = malloc(bsize) as *mut libc::c_char;
if buf.is_null() {
err(1i32, b"malloc\x00" as *const u8 as *const libc::c_char);
}
}
loop {
nr = read(rfd, buf as *mut libc::c_void, bsize);
if !(nr != -1i32 as libc::c_long && nr != 0i32 as libc::c_long) {
break;
}
off = 0i32 as ssize_t;
while 0 != nr {
nw = write(
wfd,
buf.offset(off as isize) as *const libc::c_void,
nr as size_t,
);
if nw == 0i32 as libc::c_long || nw == -1i32 as libc::c_long {
err(1i32, b"stdout\x00" as *const u8 as *const libc::c_char);
}
nr -= nw;
off += nw
}
}
if nr < 0i32 as libc::c_long {
warn(b"%s\x00" as *const u8 as *const libc::c_char, filename);
rval = 1i32
};
}
unsafe fn main_0() -> libc::c_int {
let mut argc: libc::c_int = 0;
let mut argv: *mut *mut libc::c_char = 0 as *mut *mut libc::c_char;
let mut ch: libc::c_int = 0;
loop {
ch = getopt(
argc,
argv,
b"benstuv\x00" as *const u8 as *const libc::c_char,
);
if !(ch != -1i32) {
break;
}
match ch {
98 => {
nflag = 1i32;
bflag = nflag
}
101 => {
vflag = 1i32;
eflag = vflag
}
110 => nflag = 1i32,
115 => sflag = 1i32,
116 => {
vflag = 1i32;
tflag = vflag
}
117 => {
setvbuf(stdout, 0 as *mut libc::c_char, 2i32, 0i32 as size_t);
}
118 => vflag = 1i32,
_ => {
fprintf(
stderr,
b"usage: %s [-benstuv] [file ...]\n\x00" as *const u8 as *const libc::c_char,
__progname,
);
return 1i32;
}
}
}
argv = argv.offset(optind as isize);
if 0 != bflag || 0 != eflag || 0 != nflag || 0 != sflag || 0 != tflag || 0 != vflag {
cook_args(argv);
} else {
raw_args(argv);
}
if 0 != fclose(stdout) {
err(1i32, b"stdout\x00" as *const u8 as *const libc::c_char);
}
return rval;
}
pub fn main() {
unsafe { ::std::process::exit(main_0() as i32) }
}
$ rustc --version
rustc 1.33.0-beta.5 (1045131c1 2019-01-31)
$ rustc cat.rs
error[E0554]: #![feature] may not be used on the beta release channel
--> cat.rs:9:1
|
9 | #![feature(libc)]
| ^^^^^^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:10:1
|
10 | extern crate libc;
| ^^^^^^^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:13:20
|
13 | fn fstat(__fd: libc::c_int, __buf: *mut stat) -> libc::c_int;
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:13:54
|
13 | fn fstat(__fd: libc::c_int, __buf: *mut stat) -> libc::c_int;
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:15:39
|
15 | fn __ctype_b_loc() -> *mut *const libc::c_ushort;
| ^^^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:17:30
|
17 | fn warn(__format: *const libc::c_char, ...);
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:19:22
|
19 | fn err(__status: libc::c_int, __format: *const libc::c_char, ...) -> !;
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:19:52
|
19 | fn err(__status: libc::c_int, __format: *const libc::c_char, ...) -> !;
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:21:28
|
21 | fn open(__file: *const libc::c_char, __oflag: libc::c_int, ...) -> libc::c_int;
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:21:51
|
21 | fn open(__file: *const libc::c_char, __oflag: libc::c_int, ...) -> libc::c_int;
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:21:72
|
21 | fn open(__file: *const libc::c_char, __oflag: libc::c_int, ...) -> libc::c_int;
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:23:41
|
23 | fn _IO_getc(__fp: *mut _IO_FILE) -> libc::c_int;
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:31:39
|
31 | fn fclose(__stream: *mut FILE) -> libc::c_int;
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:33:33
|
33 | fn fopen(__filename: *const libc::c_char, __modes: *const libc::c_char) -> *mut FILE;
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:33:63
|
33 | fn fopen(__filename: *const libc::c_char, __modes: *const libc::c_char) -> *mut FILE;
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:37:21
|
37 | __buf: *mut libc::c_char,
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:38:18
|
38 | __modes: libc::c_int,
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:40:10
|
40 | ) -> libc::c_int;
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:42:40
|
42 | fn fprintf(_: *mut FILE, _: *const libc::c_char, ...) -> libc::c_int;
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:42:62
|
42 | fn fprintf(_: *mut FILE, _: *const libc::c_char, ...) -> libc::c_int;
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:44:21
|
44 | fn putchar(__c: libc::c_int) -> libc::c_int;
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:44:37
|
44 | fn putchar(__c: libc::c_int) -> libc::c_int;
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:48:39
|
48 | fn ferror(__stream: *mut FILE) -> libc::c_int;
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:50:39
|
50 | fn fileno(__stream: *mut FILE) -> libc::c_int;
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:52:18
|
52 | fn malloc(_: libc::c_ulong) -> *mut libc::c_void;
| ^^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:54:25
|
54 | fn strcmp(_: *const libc::c_char, _: *const libc::c_char) -> libc::c_int;
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:54:49
|
54 | fn strcmp(_: *const libc::c_char, _: *const libc::c_char) -> libc::c_int;
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:54:66
|
54 | fn strcmp(_: *const libc::c_char, _: *const libc::c_char) -> libc::c_int;
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:56:20
|
56 | fn close(__fd: libc::c_int) -> libc::c_int;
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:56:36
|
56 | fn close(__fd: libc::c_int) -> libc::c_int;
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:58:19
|
58 | fn read(__fd: libc::c_int, __buf: *mut libc::c_void, __nbytes: size_t) -> ssize_t;
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:60:20
|
60 | fn write(__fd: libc::c_int, __buf: *const libc::c_void, __n: size_t) -> ssize_t;
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:62:24
|
62 | static mut optind: libc::c_int;
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:65:18
|
65 | ___argc: libc::c_int,
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:66:30
|
66 | ___argv: *const *mut libc::c_char,
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:67:29
|
67 | __shortopts: *const libc::c_char,
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:68:10
|
68 | ) -> libc::c_int;
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:103:33
|
103 | static mut __progname: *mut libc::c_char;
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:105:20
|
105 | pub type __dev_t = libc::c_ulong;
| ^^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:106:20
|
106 | pub type __uid_t = libc::c_uint;
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:107:20
|
107 | pub type __gid_t = libc::c_uint;
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:108:20
|
108 | pub type __ino_t = libc::c_ulong;
| ^^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:109:21
|
109 | pub type __mode_t = libc::c_uint;
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:110:22
|
110 | pub type __nlink_t = libc::c_ulong;
| ^^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:111:20
|
111 | pub type __off_t = libc::c_long;
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:112:22
|
112 | pub type __off64_t = libc::c_long;
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:113:21
|
113 | pub type __time_t = libc::c_long;
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:114:24
|
114 | pub type __blksize_t = libc::c_long;
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:115:23
|
115 | pub type __blkcnt_t = libc::c_long;
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:116:22
|
116 | pub type __ssize_t = libc::c_long;
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:117:30
|
117 | pub type __syscall_slong_t = libc::c_long;
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:119:19
|
119 | pub type size_t = libc::c_ulong;
| ^^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:145:20
|
145 | pub type unnamed = libc::c_uint;
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:201:23
|
201 | pub static mut bflag: libc::c_int = 0;
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:203:23
|
203 | pub static mut eflag: libc::c_int = 0;
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:205:23
|
205 | pub static mut nflag: libc::c_int = 0;
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:207:23
|
207 | pub static mut sflag: libc::c_int = 0;
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:209:23
|
209 | pub static mut tflag: libc::c_int = 0;
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:211:23
|
211 | pub static mut vflag: libc::c_int = 0;
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:213:22
|
213 | pub static mut rval: libc::c_int = 0;
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:215:31
|
215 | pub static mut filename: *mut libc::c_char = 0 as *const libc::c_char as *mut libc::c_char;
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:215:58
|
215 | pub static mut filename: *mut libc::c_char = 0 as *const libc::c_char as *mut libc::c_char;
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:215:79
|
215 | pub static mut filename: *mut libc::c_char = 0 as *const libc::c_char as *mut libc::c_char;
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:217:56
|
217 | pub unsafe extern "C" fn cook_args(mut argv: *mut *mut libc::c_char) {
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:220:52
|
220 | filename = b"stdin\x00" as *const u8 as *const libc::c_char as *mut libc::c_char;
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:220:73
|
220 | filename = b"stdin\x00" as *const u8 as *const libc::c_char as *mut libc::c_char;
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:224:67
|
224 | if 0 == strcmp(*argv, b"-\x00" as *const u8 as *const libc::c_char) {
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:228:67
|
228 | fp = fopen(*argv, b"r\x00" as *const u8 as *const libc::c_char);
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:230:59
|
230 | warn(b"%s\x00" as *const u8 as *const libc::c_char, *argv);
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:268:17
|
268 | let mut ch: libc::c_int = 0;
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:269:21
|
269 | let mut gobble: libc::c_int = 0;
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:270:19
|
270 | let mut line: libc::c_int = 0;
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:271:19
|
271 | let mut prev: libc::c_int = 0;
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:305:69
|
305 | b"%6d\t\x00" as *const u8 as *const libc::c_char,
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:314:69
|
314 | b"%6s\t\x00" as *const u8 as *const libc::c_char,
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:315:64
|
315 | b"\x00" as *const u8 as *const libc::c_char,
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:353:72
|
353 | if 0 != *(*__ctype_b_loc()).offset(ch as isize) as libc::c_int
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:354:39
|
354 | & _IScntrl as libc::c_int as libc::c_ushort as libc::c_int
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:354:54
|
354 | & _IScntrl as libc::c_int as libc::c_ushort as libc::c_int
| ^^^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:354:72
|
354 | & _IScntrl as libc::c_int as libc::c_ushort as libc::c_int
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:386:47
|
386 | warn(b"%s\x00" as *const u8 as *const libc::c_char, filename);
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:391:56
|
391 | err(1i32, b"stdout\x00" as *const u8 as *const libc::c_char);
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:395:55
|
395 | pub unsafe extern "C" fn raw_args(mut argv: *mut *mut libc::c_char) {
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:396:17
|
396 | let mut fd: libc::c_int = 0;
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:398:52
|
398 | filename = b"stdin\x00" as *const u8 as *const libc::c_char as *mut libc::c_char;
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:398:73
|
398 | filename = b"stdin\x00" as *const u8 as *const libc::c_char as *mut libc::c_char;
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:402:67
|
402 | if 0 == strcmp(*argv, b"-\x00" as *const u8 as *const libc::c_char) {
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:408:59
|
408 | warn(b"%s\x00" as *const u8 as *const libc::c_char, *argv);
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:443:43
|
443 | pub unsafe extern "C" fn raw_cat(mut rfd: libc::c_int) {
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:444:18
|
444 | let mut wfd: libc::c_int = 0;
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:479:60
|
479 | err(1i32, b"stdout\x00" as *const u8 as *const libc::c_char);
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:481:50
|
481 | bsize = (if sbuf.st_blksize > 8192i32 as libc::c_long {
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:484:24
|
484 | 8192i32 as libc::c_long
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:486:37
|
486 | buf = malloc(bsize) as *mut libc::c_char;
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:488:60
|
488 | err(1i32, b"malloc\x00" as *const u8 as *const libc::c_char);
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:493:29
|
493 | if !(nr != -1i32 as libc::c_long && nr != 0i32 as libc::c_long) {
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:493:59
|
493 | if !(nr != -1i32 as libc::c_long && nr != 0i32 as libc::c_long) {
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:503:30
|
503 | if nw == 0i32 as libc::c_long || nw == -1i32 as libc::c_long {
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:503:61
|
503 | if nw == 0i32 as libc::c_long || nw == -1i32 as libc::c_long {
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:504:64
|
504 | err(1i32, b"stdout\x00" as *const u8 as *const libc::c_char);
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:510:21
|
510 | if nr < 0i32 as libc::c_long {
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:511:47
|
511 | warn(b"%s\x00" as *const u8 as *const libc::c_char, filename);
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:449:26
|
449 | static mut buf: *mut libc::c_char = 0 as *const libc::c_char as *mut libc::c_char;
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:449:53
|
449 | static mut buf: *mut libc::c_char = 0 as *const libc::c_char as *mut libc::c_char;
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:449:74
|
449 | static mut buf: *mut libc::c_char = 0 as *const libc::c_char as *mut libc::c_char;
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:515:23
|
515 | unsafe fn main_0() -> libc::c_int {
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:516:19
|
516 | let mut argc: libc::c_int = 0;
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:517:59
|
517 | let mut argv: *mut *mut libc::c_char = 0 as *mut *mut libc::c_char;
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:517:29
|
517 | let mut argv: *mut *mut libc::c_char = 0 as *mut *mut libc::c_char;
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:518:17
|
518 | let mut ch: libc::c_int = 0;
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:523:51
|
523 | b"benstuv\x00" as *const u8 as *const libc::c_char,
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:544:43
|
544 | setvbuf(stdout, 0 as *mut libc::c_char, 2i32, 0i32 as size_t);
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:550:85
|
550 | b"usage: %s [-benstuv] [file ...]\n\x00" as *const u8 as *const libc::c_char,
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:564:56
|
564 | err(1i32, b"stdout\x00" as *const u8 as *const libc::c_char);
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:135:17
|
135 | pub __pad0: libc::c_int,
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:161:17
|
161 | pub _flags: libc::c_int,
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:162:28
|
162 | pub _IO_read_ptr: *mut libc::c_char,
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:163:28
|
163 | pub _IO_read_end: *mut libc::c_char,
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:164:29
|
164 | pub _IO_read_base: *mut libc::c_char,
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:165:30
|
165 | pub _IO_write_base: *mut libc::c_char,
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:166:29
|
166 | pub _IO_write_ptr: *mut libc::c_char,
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:167:29
|
167 | pub _IO_write_end: *mut libc::c_char,
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:168:28
|
168 | pub _IO_buf_base: *mut libc::c_char,
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:169:27
|
169 | pub _IO_buf_end: *mut libc::c_char,
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:170:29
|
170 | pub _IO_save_base: *mut libc::c_char,
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:171:31
|
171 | pub _IO_backup_base: *mut libc::c_char,
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:172:28
|
172 | pub _IO_save_end: *mut libc::c_char,
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:175:18
|
175 | pub _fileno: libc::c_int,
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:176:18
|
176 | pub _flags2: libc::c_int,
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:178:22
|
178 | pub _cur_column: libc::c_ushort,
| ^^^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:179:25
|
179 | pub _vtable_offset: libc::c_schar,
| ^^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:180:21
|
180 | pub _shortbuf: [libc::c_char; 1],
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:188:16
|
188 | pub _mode: libc::c_int,
| ^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:189:20
|
189 | pub _unused2: [libc::c_char; 20],
| ^^^^^^^^^^^^
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> cat.rs:197:15
|
197 | pub _pos: libc::c_int,
| ^^^^^^^^^^^
error: aborting due to 135 previous errors
Some errors occurred: E0554, E0658.
For more information about an error, try `rustc --explain E0554`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.