From 4d05f757165f00ce8557857ad5ce7d8a4f29b4e5 Mon Sep 17 00:00:00 2001 From: Amber Date: Tue, 15 Jul 2025 12:16:51 -0400 Subject: [PATCH] standardize on c99 --- Makefile | 5 +++-- README.md | 2 ++ bbs.c | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 3e5d900..7864dd0 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,12 @@ CC=gcc -CFLAGS=-lncursesw +CFLAGS=-std=c99 -pedantic -Wall -Wextra +LIBS=-lncursesw EXECUTABLE=bbs all: make make: - $(CC) $(CFLAGS) bbs.c -o $(EXECUTABLE) + $(CC) $(CFLAGS) $(LIBS) bbs.c -o $(EXECUTABLE) run: ./$(EXECUTABLE) diff --git a/README.md b/README.md index 591a41c..9dbb299 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ This is a simple bbs program written in c. The way it is meant to work is that a The only dependency is `ncurses`. The makefile asks for `-lncursesw` but unicode is not yet used, so `-lncurses` should be fine. `ncurses` is almost guaranteed preinstalled on your system. +The program is standardized on c99. It should run fine on c89, but there will be warnings. You'll have to edit the makefile to request c89 from `gcc`. + To build, run `make`. It will drop an executable named `bbs` in the current folder. The makefile has the additional command `make run`, which just launches the program after compilation. diff --git a/bbs.c b/bbs.c index 659a634..9815e24 100644 --- a/bbs.c +++ b/bbs.c @@ -46,7 +46,7 @@ void draw_screen (struct Screen *screen) { box(screen->win, 0, 0); mvwprintw(screen->win, 0, 1, " %s ", screen->name); -}; +} int main() { @@ -69,7 +69,7 @@ int main() { getmaxyx(stdscr, terminal_height, terminal_width); - int screen_before_error = HOME; + unsigned int screen_before_error = HOME; enum ActiveScreen active_screen = HOME; struct Screen home = {