Enable almost all old utilities

This commit is contained in:
Mark 2020-05-31 22:21:23 +03:00
parent 5ee8044d5e
commit 6e8b36f238
6 changed files with 18 additions and 18 deletions

View File

@ -23,6 +23,11 @@ STAGE_BIN=$(STAGE)/init \
$(STAGE)/bin/login \
$(STAGE)/bin/insmod \
$(STAGE)/bin/netctl \
$(STAGE)/bin/netdump \
$(STAGE)/bin/netmeow \
$(STAGE)/bin/reboot \
$(STAGE)/bin/ping \
$(STAGE)/bin/com \
$(STAGE)/test.ko
# TODO
@ -30,20 +35,12 @@ STAGE_BIN=$(STAGE)/init \
# newlib: port mount()/umount()
# newlib: port reboot()
# $(STAGE)/bin/reboot \
# $(STAGE)/bin/netmeow \
# $(STAGE)/bin/netdump \
# $(STAGE)/bin/ping \
# $(STAGE)/bin/mouse \
# $(STAGE)/bin/ase \
# $(STAGE)/bin/vsh
# $(STAGE)/bin/com \
# $(STAGE)/bin/su \
sh_OBJS=$(O)/sh/sh.o \
$(O)/sh/readline.o \
$(O)/sh/builtin.o \

View File

@ -3,6 +3,8 @@
#include <unistd.h>
#include <string.h>
#include <signal.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>

View File

@ -6,12 +6,10 @@
#define LINE_LENGTH 16
static void line_print(size_t off, const char *line, size_t len) {
printf("%08x: ", off);
printf("%08lx: ", off);
for (size_t i = 0; i < LINE_LENGTH; ++i) {
// XXX: This is needed because I didn't implement h/hh modifiers in printf
uint64_t byte = (uint64_t) line[i] & 0xFF;
if (i < len) {
printf("%02x", byte);
printf("%02hhx", line[i] & 0xFF);
} else {
printf(" ");
}
@ -77,7 +75,7 @@ int main(int argc, char **argv) {
}
if (res > 0) {
ssize_t len = recvfrom(fd, buf, sizeof(buf), &sa, &salen);
ssize_t len = recvfrom(fd, buf, sizeof(buf), 0, &sa, &salen);
if (len < 0) {
perror("recvfrom()");

View File

@ -1,6 +1,7 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <stdio.h>
int main(int argc, char **argv) {
@ -24,7 +25,7 @@ int main(int argc, char **argv) {
}
while (1) {
ssize_t d = recvfrom(fd, buf, sizeof(buf), (struct sockaddr *) &sa, &salen);
ssize_t d = recvfrom(fd, buf, sizeof(buf), 0, (struct sockaddr *) &sa, &salen);
if (d < 0) {
perror("recvfrom()");
break;

View File

@ -1,5 +1,6 @@
#include <sys/socket.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <stdio.h>
int main(int argc, char **argv) {

View File

@ -1,3 +1,4 @@
#include <ygg/reboot.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
@ -28,6 +29,6 @@ int main(int argc, char **argv) {
}
while (1) {
usleep(1000000);
// TODO: bring usleep() back
}
}