Browse Source

Init with basic test

master
cancel 6 years ago
commit
1bf43eacb9
  1. 2
      .clang-format
  2. 46
      .gitignore
  3. 20
      Makefile
  4. 1
      README.md
  5. 23
      main.c

2
.clang-format

@ -0,0 +1,2 @@
BasedOnStyle: LLVM
PointerAlignment: Left

46
.gitignore

@ -0,0 +1,46 @@
# Prerequisites
*.d
# Object files
*.o
*.ko
*.obj
*.elf
# Linker output
*.ilk
*.map
*.exp
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
# Debug files
*.dSYM/
*.su
*.idb
*.pdb
# Default build dir
build/

20
Makefile

@ -0,0 +1,20 @@
basic_flags := -std=c99 -Wall -Wpedantic -Wextra
debug_flags := -DDEBUG -O0 -ggdb -feliminate-unused-debug-symbols
library_flags := -lncurses
source_files := main.c
all: debug
build:
mkdir $@
build/debug build/release: | build
mkdir $@
.PHONY: debug
debug: | build/debug
cc $(basic_flags) $(debug_flags) $(source_files) -o build/debug/acro $(library_flags)
.PHONY: clean
clean:
rm -rf build

1
README.md

@ -0,0 +1 @@
A basic starting point for an ncurses C99 program.

23
main.c

@ -0,0 +1,23 @@
#include <ncurses.h>
int main() {
initscr(); // Initialize ncurses
raw(); // Receive keyboard input immediately
noecho(); // Don't echo keyboard input
keypad(stdscr, TRUE); // Also receive arrow keys, etc.
curs_set(0); // Hide the terminal cursor
printw("Type any character to see it in bold\n");
refresh();
int ch = getch();
printw("Your character:\n");
attron(A_BOLD);
printw(" %c\n", ch);
attroff(A_BOLD);
printw("Press any key to exit");
attroff(A_BOLD);
refresh();
getch();
endwin();
return 0;
}
Loading…
Cancel
Save