update: userprog (tee, tsh, sleep, hex2bin)

This commit is contained in:
2026-01-01 04:22:30 +00:00
parent cf722d75ff
commit 79f46aa971
22 changed files with 1196 additions and 47 deletions
+15
View File
@@ -0,0 +1,15 @@
TARGET = hex2bin
SRCS = hex2bin.c
CC = gcc
CFLAGS = -static -Wall
OUT_BIN ?= $(TARGET)
all: $(OUT_BIN)
$(OUT_BIN): $(SRCS)
@echo " [CC] Compiling to $(OUT_BIN)..."
$(CC) $(CFLAGS) -o $@ $^
clean:
rm -f $(TARGET)
+13
View File
@@ -0,0 +1,13 @@
#include <stdio.h>
// 사용법: echo "41 42 43" | hex2bin
int main() {
int byte;
// 16진수(%x)로 정수를 읽어서
while (scanf("%x", &byte) == 1) {
// char(바이트) 형태로 stdout에 씀
unsigned char c = (unsigned char)byte;
fwrite(&c, 1, 1, stdout);
}
return 0;
}