about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--.gitignore7
-rw-r--r--README1
-rw-r--r--profanity.c84
3 files changed, 92 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..4441bd40
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,7 @@
+# git ls-files --others --exclude-from=.git/info/exclude
+# Lines that start with '#' are comments.
+# For a project mostly in C, the following would be a good set of
+# exclude patterns (uncomment them if you want to use them):
+# *.[oa]
+# *~
+profanity
diff --git a/README b/README
new file mode 100644
index 00000000..fb1a70f9
--- /dev/null
+++ b/README
@@ -0,0 +1 @@
+Curses based jabber client
diff --git a/profanity.c b/profanity.c
new file mode 100644
index 00000000..c93b7a81
--- /dev/null
+++ b/profanity.c
@@ -0,0 +1,84 @@
+#include <ncurses.h>
+#include <string.h>
+
+void init()
+{
+    initscr();
+    raw();
+    keypad(stdscr, TRUE);
+    start_color();
+
+    init_color(COLOR_WHITE, 1000, 1000, 1000);
+    init_pair(1, COLOR_WHITE, COLOR_BLACK);
+    init_pair(2, COLOR_GREEN, COLOR_BLACK);
+
+    init_color(COLOR_BLUE, 0, 0, 250);
+    init_pair(3, COLOR_WHITE, COLOR_BLUE);
+
+    attron(A_BOLD);
+    attron(COLOR_PAIR(1));
+}
+
+void print_title()
+{
+    int rows, cols;
+    char *title = "PROFANITY";
+
+    getmaxyx(stdscr, rows, cols);
+    
+    attron(COLOR_PAIR(3));
+    mvprintw(1, (cols - strlen(title))/2, title);
+    attroff(COLOR_PAIR(3));
+}
+
+void close()
+{
+    int rows, cols;
+    char *exit_msg = "< HIT ANY KEY TO EXIT >";
+
+    getmaxyx(stdscr, rows, cols);
+    
+    attron(A_BLINK);
+    curs_set(0);
+    mvprintw(rows-10, (cols - strlen(exit_msg))/2, exit_msg);
+    
+    refresh();
+    getch();
+    endwin();
+}
+
+void get_name(char *name)
+{
+}
+
+void show_name(char *name)
+{
+}
+
+int main()
+{   
+    int ypos = 2;
+    int xpos = 2;
+    int ch;
+    char *name;
+
+    init();
+
+    print_title();
+    ypos += 2;
+    mvprintw(ypos, xpos, "Enter your name: ");
+    echo();
+    getstr(name);
+    noecho();
+    
+    ypos += 2;
+    mvprintw(ypos, xpos, "Shit, ");
+    attron(COLOR_PAIR(2));
+    printw("%s", name);
+    attroff(COLOR_PAIR(2));
+
+    printw("\n");
+    close();
+
+    return 0;
+}