changeset 2:f362b20de51e

Remove trailing whitespaces.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sun, 22 Feb 2015 18:03:26 +0100
parents 05c8e0aef77d
children 61bb81a9a440
files Makefile XML.c configure ds.c ds.h dspad.c restartOp.c restartOp.h service.c uinput.c uinput.h
diffstat 11 files changed, 69 insertions(+), 69 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile
+++ b/Makefile
@@ -20,7 +20,7 @@ FILESdspad_server=ds.c \
 	uinput.c \
 	XML.c
 
-LDFLAGSdspad_server=$(LDFLAGS) 
+LDFLAGSdspad_server=$(LDFLAGS)
 
 OBJECTSdspad_server=$(FILESdspad_server:.c=.o)
 
@@ -38,7 +38,7 @@ dspad_server : $(OBJECTSdspad_server)
 .c.o :
 	$(CCC) $(CCFLAGS) -c $< \
 		-o $*.o
- 
+
 dep :
 	@echo "======== Mise a jour des dependances : .depend ========"
 	@rm -f .depend
@@ -51,10 +51,10 @@ dep :
 	echo  >> .depend ; \
 	done
 	@rm -f .tmpdepend
- 
+
 CLEANING=rm -f *.o core a.out $(TARGET) .depend
 CONSEIL=echo Penser a faire : make -f Makefile dep
- 
+
 clear :
 	@$(CLEANING)
 	@echo
--- a/XML.c
+++ b/XML.c
@@ -62,11 +62,11 @@ char* TagContent(char* tag,char** mark){
     char* b;
     char* tagd;
     char* tagf;
-    
+
     tagd=(char*)malloc((strlen(tag)+3)*sizeof(char));
     tagf=(char*)malloc((strlen(tag)+4)*sizeof(char));
     if (tagd==NULL || tagf==NULL) {return NULL;}
-    
+
     strcpy(tagd,"<");    strcat(tagd,tag);    strcat(tagd,">");
     strcpy(tagf,"</");    strcat(tagf,tag);    strcat(tagf,">");
 
--- a/configure
+++ b/configure
@@ -29,7 +29,7 @@ LDFLAGS='-Wl,-woff,15,-woff,84,-woff,85'
 DEPOPT='-M'
 
 CCC='cc'
- 
+
 elif test $systeme = "Linux"
 then
 
@@ -47,7 +47,7 @@ CCC='cc'
 else echo "System $systeme inconnu"
      exit 1
 fi
- 
+
 #----------------- L'option -e de echo existe ?  ----------------
 
 recho=`echo -e`
@@ -144,7 +144,7 @@ do
      do
         if test $j = `basename $j $extension`
         then echo "Attention, dans FILES$i, $j est ignore (!= $extension)... "
-        else 
+        else
              if test -z "$realFileList"
              then realFileList=$j
              else realFileList=$realFileList" "$j
@@ -152,7 +152,7 @@ do
         fi
      done
      if test -z "$realFileList"
-     then 
+     then
           echo "... Donc , FILES$i est vide => FILES$i=$i$extension"
           realFileList="$i$extension"
      fi
@@ -272,7 +272,7 @@ cat << !                                
 .c.o :
 	\$(CCC) \$(CCFLAGS) -c \$< \\
 		-o \$*.o
- 
+
 dep :
 	@echo "======== Mise a jour des dependances : .depend ========"
 	@rm -f .depend
@@ -286,10 +286,10 @@ dep :
 	echo  >> .depend ; \\
 	done
 	@rm -f .tmpdepend
- 
+
 CLEANING=rm -f *.o core a.out \$(TARGET) .depend
 CONSEIL=echo Penser a faire : make -f $makefile dep
- 
+
 clear :
 	@\$(CLEANING)
 	@echo
--- a/ds.c
+++ b/ds.c
@@ -67,14 +67,14 @@ void ds_process_evt(ds_t* ds, int uinput
 
 
     /* DIRECTIONS */
-    
+
     if(previous.aX != ds->aX)
         do_uinput(uinput_fd, ABS_X, ds->aX, EV_ABS);
-    
+
     if(previous.aY != ds->aY)
         do_uinput(uinput_fd, ABS_Y, ds->aY, EV_ABS);
-        
+
     memcpy(&previous, ds, sizeof(ds_t));
-    
+
     return;
 }
--- a/ds.h
+++ b/ds.h
@@ -13,13 +13,13 @@ typedef struct ds_s{
     uint8_t L:1;
     uint8_t R:1;
     uint8_t Start:1;
-    uint8_t Select:1;   
+    uint8_t Select:1;
     uint8_t aX;
     uint8_t aY;
 } __attribute__((packed)) ds_t;
 
 
-/* 
+/*
     Throws events according to ds keys status
 */
 extern void ds_process_evt(ds_t* ds, int uinput_fd);
--- a/dspad.c
+++ b/dspad.c
@@ -7,7 +7,7 @@
 
 #include "ds.h"
 #include "uinput.h"
-#include "service.h" 
+#include "service.h"
 #include "restartOp.h"
 #include "XML.h"
 
@@ -31,13 +31,13 @@ int dspad_process_xml(void* elem, char* 
 
     if(tag != NULL && content != NULL){
         if(strcmp(content, "")){
-        
+
             /* process atom: */
             if(!strcmp(tag, "base_port")){
                 base_port = atoi(content);
                 return 1;
             }
-            
+
             else if(!strcmp(tag, "uinput_dev")){
                 if(uinput_dev != NULL) free(uinput_dev);
                 uinput_dev = (char*)malloc(strlen(content)+1);
@@ -49,11 +49,11 @@ int dspad_process_xml(void* elem, char* 
                 nbdev = atoi(content);
                 return 1;
             }
-    
+
             return ReadXML(elem, dspad_process_xml, content);
         }
     }
-    
+
     /* Should not happend... (compiler warning) */
     return 0;
 }
@@ -68,7 +68,7 @@ int dspad_process_xml(void* elem, char* 
 int config_read(char* path){
     int ok = 0;
     char* text = NULL;
-    
+
     text = LoadFile(path);
     if(text){
         ok = ReadXML(NULL, dspad_process_xml, text);
@@ -91,13 +91,13 @@ int main(int argc, char** argv){
     (void)argc;
     (void)argv;
     /* --------------------------------- */
-    
+
     curdev = 0;
 
     fprintf(stdout, "\n--- Starting DSPad Server v0.2 ---\n");
-    
+
     pid_t pid = 0;
-    
+
     if(argc == 3 && !strcmp("-f", argv[1])){
         fprintf(stderr, "Loading \"%s\"\n", argv[2]);
         config_read(argv[2]);
@@ -106,9 +106,9 @@ int main(int argc, char** argv){
         fprintf(stderr, "Loading \"%s\"\n", DEFAULT_PATH);
         config_read(DEFAULT_PATH);
     }
-    
-        
-    
+
+
+
     /* fork servers */
     while(curdev < nbdev){
         pid = fork_rs();
@@ -131,8 +131,8 @@ int main(int argc, char** argv){
                 exit(EXIT_SUCCESS);
                 break;
         } /* switch */
-    }    
-    
+    }
+
     return 0;
 }
 
--- a/restartOp.c
+++ b/restartOp.c
@@ -36,7 +36,7 @@ pid_t wait_rs(int *status)
  do {
       endPid=wait(status);
  } while ((endPid==-1) && (errno==EINTR));
- 
+
  return endPid;
 }
 */
@@ -48,7 +48,7 @@ pid_t waitpid_rs(pid_t pid, int *status,
  do {
       endPid=waitpid(pid,status,options);
  } while ((endPid==-1) && (errno==EINTR));
- 
+
  return endPid;
 }
 */
@@ -56,19 +56,19 @@ pid_t waitpid_rs(pid_t pid, int *status,
 /********************************************************/
 /*                         sleep                        */
 /********************************************************/
- 
+
 unsigned int sleep_rs(unsigned int seconds)
 {
  int nbSecondsElapsed = 0;
- 
+
  do {
- 
+
      seconds = seconds -  nbSecondsElapsed;
- 
+
      nbSecondsElapsed = sleep(seconds);
- 
+
  } while (nbSecondsElapsed!=0);
- 
+
  return 0;       //  Zero  if  the requested time has elapsed
 }
 
@@ -160,15 +160,15 @@ int semop_rs(int semid, struct sembuf *s
 /********************************************************/
 /*                      msgsnd, msgrcv                  */
 /********************************************************/
-/* 
+/*
 int msgsnd_rs(int msqid, void *msgp, int msgsz, int msgflg)
 {
  int returnValue = 0;
 
  do {
       returnValue = msgsnd(msqid,msgp,msgsz,msgflg);
- } while ((returnValue==-1) && (errno==EINTR)); 
- 
+ } while ((returnValue==-1) && (errno==EINTR));
+
  return returnValue;
 }
 */
@@ -179,8 +179,8 @@ int msgrcv_rs(int msqid, void *msgp, int
 
  do {
       returnValue = msgrcv(msqid,msgp,msgsz,msgtyp,msgflg);
- } while ((returnValue==-1) && (errno==EINTR)); 
- 
+ } while ((returnValue==-1) && (errno==EINTR));
+
  return returnValue;
 }
 */
--- a/restartOp.h
+++ b/restartOp.h
@@ -27,7 +27,7 @@ extern pid_t fork_rs(void);
 /********************************************************/
 /*                         sleep                        */
 /********************************************************/
- 
+
 extern unsigned int sleep_rs(unsigned int seconds);
 
 /********************************************************/
--- a/service.c
+++ b/service.c
@@ -67,9 +67,9 @@ int create_socket(unsigned short *port, 
 ssize_t receive_ds_info(int socket, ds_t* ds){
 	struct sockaddr_in add;
 	socklen_t l = sizeof(struct sockaddr_in);
-	
+
 	ssize_t result;
-	
+
  	result = recvfrom_rs(socket, ds, sizeof(ds_t), 0, (struct sockaddr*)&add, &l);
  	if(result == -1) perror("recvfrom_rs");
  	return result;
@@ -84,7 +84,7 @@ void start_service(void){
     int uinput_fd;
     int sock_fd;
     uint16_t udp_port = base_port + curdev;
-    
+
     ds_t ds;
     ssize_t result;
 
@@ -98,7 +98,7 @@ void start_service(void){
         exit(EXIT_FAILURE);
     }
     fprintf(stdout, " [%d]  Joystick device OK\n", curdev);
-    
+
 
     // Create udp socket
     sock_fd = create_socket(&udp_port, SOCK_DGRAM);
@@ -108,7 +108,7 @@ void start_service(void){
     }
     fprintf(stdout, " [%d]  Socket on port %d OK\n", curdev, udp_port);
 
-    
+
     // Device and Socket are ok :-D
     fprintf(stdout, " [%d] Creation of service: OK\n", curdev);
 
@@ -120,7 +120,7 @@ void start_service(void){
     while(1){
         result = receive_ds_info(sock_fd, &ds);
         if(result == -1){
-            fprintf(stderr, " [%d]  DS Info receive failed\n", curdev);            
+            fprintf(stderr, " [%d]  DS Info receive failed\n", curdev);
         }
         if(result > 0){
             ds_process_evt(&ds, uinput_fd);
--- a/uinput.c
+++ b/uinput.c
@@ -19,7 +19,7 @@
 
 
 
-/* 
+/*
     Create a new uinput device
     Returns: file descriptor (-1 if error)
  */
@@ -29,21 +29,21 @@ int init_uinput_device(void){
 
     if(uinput_dev == NULL){
         fd = open("/dev/uinput", O_RDWR);
-         
+
         if(fd < 0)
             fd = open("/dev/misc/uinput", O_RDWR);
-            
+
         if(fd < 0)
             fd = open("/dev/input/uinput", O_RDWR);
     }
     else fd = open(uinput_dev, O_RDWR); //from xml
-    
+
     if(fd < 0){
         fprintf(stderr, " [%d]  Unable to open uinput device ; hint: 'modprobe uinput' ?!\n", curdev);
         return -1;
     }
-    
-    
+
+
 
     memset(&dev, 0, sizeof(dev));
     strncpy(dev.name, DS_NAME, UINPUT_MAX_NAME_SIZE);
@@ -55,8 +55,8 @@ int init_uinput_device(void){
     dev.absmax[ABS_X]  = DS_MAX_X;
     dev.absmin[ABS_X]  = DS_MIN_X;
     dev.absfuzz[ABS_X] = 4;
-    dev.absflat[ABS_X] = 2;    
-    
+    dev.absflat[ABS_X] = 2;
+
     dev.absmax[ABS_Y]  = DS_MAX_Y;
     dev.absmin[ABS_Y]  = DS_MIN_Y;
     dev.absfuzz[ABS_X] = 4;
@@ -67,9 +67,9 @@ int init_uinput_device(void){
         fprintf(stderr, " [%d]  Registering device at uinput failed\n", curdev);
         return -1;
     }
-    
+
     /* Keys [01] (found in <linux/input.h>) */
-    if( ioctl(fd, UI_SET_EVBIT,  EV_KEY)    ) return -1; 
+    if( ioctl(fd, UI_SET_EVBIT,  EV_KEY)    ) return -1;
     if( ioctl(fd, UI_SET_KEYBIT, BTN_A)     ) return -1;
     if( ioctl(fd, UI_SET_KEYBIT, BTN_B)     ) return -1;
     if( ioctl(fd, UI_SET_KEYBIT, BTN_X)     ) return -1;
@@ -78,7 +78,7 @@ int init_uinput_device(void){
     if( ioctl(fd, UI_SET_KEYBIT, BTN_TR)    ) return -1;
     if( ioctl(fd, UI_SET_KEYBIT, BTN_START) ) return -1;
     if( ioctl(fd, UI_SET_KEYBIT, BTN_SELECT)) return -1;
-    
+
     /* D-Pad [-0xFFFF - 0xFFFF] */
     if( ioctl(fd, UI_SET_EVBIT,  EV_ABS)    ) return -1;
     if( ioctl(fd, UI_SET_ABSBIT, ABS_X)     ) return -1;
@@ -87,7 +87,7 @@ int init_uinput_device(void){
 
     /* Register device */
     if( ioctl(fd, UI_DEV_CREATE)            ) return -1;
-       
+
     return fd;
 }
 
@@ -99,11 +99,11 @@ int init_uinput_device(void){
 int do_uinput(int fd, unsigned short key, int pressed, unsigned short event_type){
     struct input_event event;
     memset(&event, 0 , sizeof(event));
-	
+
     event.type = event_type;
     event.code = key;
     event.value = pressed;
-	
+
     if(write(fd,&event,sizeof(event)) != sizeof(event)){
         fprintf(stderr, "  [%d] Writing event to uinput driver failed ; Aborting\n", curdev);
         return false;
@@ -118,7 +118,7 @@ int do_uinput(int fd, unsigned short key
 void flush_uinput(int fd){
     struct input_event event;
     memset(&event, 0 , sizeof(event));
-    
+
     event.type = EV_SYN;
     event.code = SYN_REPORT;
 
--- a/uinput.h
+++ b/uinput.h
@@ -11,7 +11,7 @@
 #define DS_MAX_Y    191
 
 
-/* 
+/*
     Create a new uinput device
     Returns: device descriptor
  */