changeset 28:0cd8025eebee

[/trunk] Changeset 44 by mikael * Some more fixes. * We can now build with GNU99 gcc extensions.
author mikael
date Mon, 28 Mar 2005 10:36:47 +0000
parents 77e6bd2ccde6
children 86837ff0554c
files mcabber/src/Makefile mcabber/src/lang.c mcabber/src/list.h mcabber/src/main.c mcabber/src/parsecfg.c mcabber/src/screen.c mcabber/src/server.c mcabber/src/socket.c
diffstat 8 files changed, 26 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/src/Makefile	Mon Mar 28 09:18:01 2005 +0000
+++ b/mcabber/src/Makefile	Mon Mar 28 10:36:47 2005 +0000
@@ -11,6 +11,8 @@
 #			default = pentium
 #	DEBUG=1		disable optimizations and build for debug
 #			default = no
+#	GNU99=1		use GNU99 extensions
+#			default = no
 #
 #    Targets:
 #	all:		build executable
@@ -26,10 +28,11 @@
 
 CPU ?= i386
 JCLIENT = mcabber
-
+ifndef CC
 CC = gcc
+endif
 CFLAGS = -Wall -W -pedantic
-LD = gcc
+LD = $(CC)
 LDLIBS = -lncurses -lpanel
 
 ifeq ($(DEBUG),1)
@@ -39,6 +42,10 @@
 LDFLAGS = -s
 endif
 
+ifeq ($(GNU99),1)
+CFLAGS += -std=gnu99 -D_GNU_SOURCE
+endif
+
 CP = cp -f
 
 SOURCES = \
@@ -72,7 +79,7 @@
 	-$(RM) $(JCLIENT)
 
 install: all
-	$(CP) $(JCLIENT) /usr/bin/$(JCLIENT)
+	$(CP) $(JCLIENT) /usr/local/bin/$(JCLIENT)
 
 #dep: $(SOURCES)
 #	makedepend -f- -Ylydialog -- $(CFLAGS) -- $(SOURCES) > depend
--- a/mcabber/src/lang.c	Mon Mar 28 09:18:01 2005 +0000
+++ b/mcabber/src/lang.c	Mon Mar 28 10:36:47 2005 +0000
@@ -4,7 +4,6 @@
 #include <string.h>
 #include <ctype.h>
 
-
 #include "utils.h"
 
 char Lang[100];
--- a/mcabber/src/list.h	Mon Mar 28 09:18:01 2005 +0000
+++ b/mcabber/src/list.h	Mon Mar 28 10:36:47 2005 +0000
@@ -84,7 +84,8 @@
 /**
  * list_del - deletes entry from list.
  * @entry: the element to delete from the list.
- * Note: list_empty on entry does not return true after this, the entry is in an undefined state.
+ * Note: list_empty on entry does not return true after this, the entry is
+ *       in an undefined state.
  */
 static inline void list_del(struct list_head *entry)
 {
@@ -128,7 +129,7 @@
 }
 
 /**
- * list_empty - tests whether a list is empty
+ * list_empty - test whether a list is empty
  * @head: the list to test.
  */
 static inline int list_empty(struct list_head *head)
@@ -188,7 +189,7 @@
 	((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
 
 /**
- * list_for_each_safe	-	iterate over a list safe against removal of list entry
+ * list_for_each_safe - iterate over a list safe against removal of list entry
  * @pos:	the &struct list_head to use as a loop counter.
  * @n:		another &struct list_head to use as temporary storage
  * @head:	the head for your list.
@@ -198,7 +199,8 @@
 		pos = n, n = pos->next)
 
 /**
- * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
+ * list_for_each_entry_safe - iterate over list of given type safe against
+ *                            removal of list entry
  * @pos:	the type * to use as a loop counter.
  * @n:		another type * to use as temporary storage
  * @head:	the head for your list.
--- a/mcabber/src/main.c	Mon Mar 28 09:18:01 2005 +0000
+++ b/mcabber/src/main.c	Mon Mar 28 10:36:47 2005 +0000
@@ -4,6 +4,7 @@
 #include <string.h>
 #include <signal.h>
 #include <termios.h>
+#include <getopt.h>
 
 #include "utils.h"
 #include "screen.h"
@@ -42,18 +43,18 @@
   int nread;
 
   /* Turn echoing off and fail if we can't. */
-  if (tcgetattr(fileno (stdin), &orig) != 0)
+  if (tcgetattr(fileno(stdin), &orig) != 0)
       return -1;
   new = orig;
   new.c_lflag &= ~ECHO;
-  if (tcsetattr(fileno (stdin), TCSAFLUSH, &new) != 0)
+  if (tcsetattr(fileno(stdin), TCSAFLUSH, &new) != 0)
       return -1;
 
   /* Read the password. */
   nread = getline(passstr, n, stdin);
 
   /* Restore terminal. */
-  (void) tcsetattr(fileno (stdin), TCSAFLUSH, &orig);
+  (void) tcsetattr(fileno(stdin), TCSAFLUSH, &orig);
 
   return (ssize_t)nread;
 }
--- a/mcabber/src/parsecfg.c	Mon Mar 28 09:18:01 2005 +0000
+++ b/mcabber/src/parsecfg.c	Mon Mar 28 10:36:47 2005 +0000
@@ -4,10 +4,8 @@
 #include <ctype.h>
 #include <string.h>
 
-
 #include "list.h"
 
-/* Definicion de tipos */
 #define MAX_LENGHT_INPUT 1024
 #define cfg_entry(n) list_entry(n, cfg_entry_t, list)
 
--- a/mcabber/src/screen.c	Mon Mar 28 09:18:01 2005 +0000
+++ b/mcabber/src/screen.c	Mon Mar 28 10:36:47 2005 +0000
@@ -15,7 +15,6 @@
 #include "server.h"
 #include "list.h"
 
-/* Definicion de tipos */
 #define window_entry(n) list_entry(n, window_entry_t, list)
 
 LIST_HEAD(window_list);
--- a/mcabber/src/server.c	Mon Mar 28 09:18:01 2005 +0000
+++ b/mcabber/src/server.c	Mon Mar 28 10:36:47 2005 +0000
@@ -4,6 +4,9 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/poll.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/select.h>
 
 #include "list.h"
 #include "parsecfg.h"
@@ -17,7 +20,6 @@
 
 #define JABBERPORT 5222
 
-
 /* Desc: poll data from server
  * 
  * In  : socket
--- a/mcabber/src/socket.c	Mon Mar 28 09:18:01 2005 +0000
+++ b/mcabber/src/socket.c	Mon Mar 28 10:36:47 2005 +0000
@@ -3,12 +3,11 @@
 #include <string.h>
 #include <sys/socket.h>
 #include <unistd.h>
-#include "utils.h"
-
-#include "socket.h"
 #include <signal.h>
 
-#include "screen.h" // FIXME to be removed
+#include "utils.h"
+#include "socket.h"
+#include "screen.h"
 
 /* Desc: create socket connection
  *