News for hackers. Stuff that matters.
Re:Bored? How about trying a Linux speed run? by 29athrowaway on Sunday April 12, 2020 @04:02AM (#22846686)
You get all this functionality from the kernel for free.

http://man7.org/linux/man-pages/man2/syscalls.2.html

Re:Bored? How about trying a Linux speed run? by jml7c5 on Sunday April 12, 2020 @04:22AM (#22846743)
Does the kernel provide a TCP stack? Either way, you still need to write an editor with which to write programs that utilize those syscalls.
Re:Bored? How about trying a Linux speed run? by navaati on Sunday April 12, 2020 @04:47AM (#22846837)
Re:Bored? How about trying a Linux speed run? by input_sh on Sunday April 12, 2020 @04:33AM (#22846784)

    echo "line" >> file
I really don't get the need for an editor.
Re:Bored? How about trying a Linux speed run? by anthk on Sunday April 12, 2020 @05:27AM (#22846997)
If you have echo and the source code having an ed clone would be very convenient as it would double as a pager. Also, it would be much faster to edit the files.
Re:Bored? How about trying a Linux speed run? by pests on Sunday April 12, 2020 @04:49AM (#22846845)
This amuses me too. We had to bootstrap from nothing originally too. I think many have never learned the history or started from first principals.
Re:Bored? How about trying a Linux speed run? by tom_mellior on Sunday April 12, 2020 @06:55AM (#22847324)
> We had to bootstrap from nothing originally too.

I doubt that the original Unix was written without an editor, using only cat. Of course some earlier interactive system at one point did have to come up without an interactive editor... but still I'd think it's much more likely that the editor was written off-line and fed into the system on punched cards or tape rather than cat'ed from the terminal.

The original post only mentions the network and implicitly the keyboard as possible inputs, but of course the challenge would be much easier if you allowed a DVD, CD, or even floppy drive with drivers (which are part of the kernel). I think pretty much any historical bootstrapping of an interactive OS is much closer to this setting.

Re:Bored? How about trying a Linux speed run? by lwh on Sunday April 12, 2020 @07:14AM (#22847442)
it had 'ed' the precursor to ex and vi editors. The terminal they used was paper so not quite ready for a visually oriented editor! (https://en.wikipedia.org/wiki/Teletype_Model_33) If you're stuck on a basic system or rescue shell, cat and echo are considerably more straightforward if you don't know how to use ed already.
Re:Bored? How about trying a Linux speed run? by tom_mellior on Sunday April 12, 2020 @09:53AM (#22848249)
I doubt they wrote ed in cat.
Re:Bored? How about trying a Linux speed run? by lwh on Sunday April 12, 2020 @12:07PM (#22849117)
sorry I was unclear. I assumed those who created ed knew how to use it - but regular people not familiar with ed would tend to use cat and echo when stuck in a broken / bare system.
Re:Bored? How about trying a Linux speed run? by tom_mellior on Sunday April 12, 2020 @12:33PM (#22849278)
Of course they knew how to use it. But I don't think they wrote the first lines of ed in ed-on-the-live-system. It is much much more likely that they wrote them offline and imported the code from punched cards or via tape or whatever from another system.

For whatever it's worth, Wikipedia (https://en.wikipedia.org/wiki/History_of_Unix) says: "In about a month's time, in August 1969, Thompson had implemented a self-hosting operating system with an assembler, editor and shell, using a GECOS machine for bootstrapping." I'm sure there are more details to be had somewhere.

Re:Bored? How about trying a Linux speed run? by 29athrowaway on Sunday April 12, 2020 @06:26AM (#22847200)
Yes.

Also accessible as a file, since everything is a file.

echo "foo" > /dev/tcp/host/port

Re:Bored? How about trying a Linux speed run? by zokier on Sunday April 12, 2020 @09:17AM (#22848049)
/dev/tcp is ugly hack in bash, not something provided by kernel. nc is arguably the more canonical way of doing networking in shell.
Re:Bored? How about trying a Linux speed run? by anthk on Sunday April 12, 2020 @09:51AM (#22848236)
If you have nc you just need to reimplement echo.c and the task is over, as you can fetch busybox in several ways.

Heck, a simple while loop over stdin would be enough.

From the K&R book:

    #include <stdio.h>

    int main(){

    int c;

    while((c =getchar()) != EOF){

    putchar(c);

    }

    }
Or just run nc from a < redirect, but, the shell could restrict that maybe.