]> rtime.felk.cvut.cz Git - sysless.git/commitdiff
Whitespace fixes
authorMichal Sojka <sojkam1@fel.cvut.cz>
Wed, 31 Jul 2013 13:56:29 +0000 (15:56 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Wed, 31 Jul 2013 13:56:29 +0000 (15:56 +0200)
libs4c/cmdproc/cmd_io.c
libs4c/cmdproc/cmd_io_line.c
libs4c/cmdproc/cmd_proc.c
libs4c/cmdproc/cmd_proc.h
libs4c/cmdproc/cmd_proc_priv.h
libs4c/cmdproc/cmd_proc_run.c
libs4c/cmdproc/cmdio_std.c
libs4c/cmdproc/cmdio_std_file.c
libs4c/cmdproc/cmdproc_test.c

index fe9f7ceae537f80053457d73b731e5d46b501ef3..b7b51f539f86fd0c9b96228e9da7eb365de18e38 100644 (file)
@@ -2,12 +2,12 @@
 #include <string.h>
 #include <stdint.h>
 
-/** 
+/**
  * Blocking call to print a string.
- * 
+ *
  * @param cmd_io cmd_io structure.
  * @param str Zero terminated string to print.
- * 
+ *
  * @return Upon successful completion, puts() shall return a
  * non-negative number. In case of error, negative number is returned.
  */
@@ -48,4 +48,3 @@ int cmd_io_read_bychar(cmd_io_t *cmd_io,void *buf,int count)
   }
   return cn;
 }
-
index 42ac41852897efcfab51e28624cc6014e2044008..a6631a9f13475dc553887f2d5c9d7af28e7ad78d 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************
   Components for embedded applications builded for
-  laboratory and medical instruments firmware  
+  laboratory and medical instruments firmware
+
   cmd_proc.h - text line command processor
                designed for instruments control and setup
               over RS-232 line
+
   Copyright (C) 2001 by Pavel Pisa pisa@cmp.felk.cvut.cz
             (C) 2002 by PiKRON Ltd. http://www.pikron.com
             (C) 2007 by Michal Sojka <sojkam1@fel.cvut.cz>
 
 /* cmd_io line editor */
 
-/** 
+/**
  * Adds new characters to an edit line buffer.
- * 
+ *
  * @param elb Edit line buffer.
  * @param ch character to add.
- * 
+ *
  * @return 1 in case of end of line, -1 if called at inaproprate time, 0 otherwise.
  */
 int cmd_ed_line_buf(ed_line_buf_t *elb, int ch)
@@ -47,11 +47,11 @@ int cmd_ed_line_buf(ed_line_buf_t *elb, int ch)
     elb->buf[elb->inbuf]=0;
     return 1;
   }
-  if(elb->inbuf>=elb->alloc-1){ 
+  if(elb->inbuf>=elb->alloc-1){
     /* try to reallocate buffer len not implemented */
     return 0;
   }
-  elb->buf[elb->inbuf++]=ch;  
+  elb->buf[elb->inbuf++]=ch;
   return 0;
 }
 
@@ -65,11 +65,11 @@ int cmd_io_line_out(cmd_io_t *cmd_io)
 {
   cmd_io_t* io_stack=cmd_io->priv.ed_line.io_stack;
   ed_line_buf_t* ed_line_out=cmd_io->priv.ed_line.out;
-  
+
   if(!ed_line_out->inbuf) return 0;
   if(!io_stack)
     return -1;
-  
+
   if(!(ed_line_out->flg&FL_ELB_INSEND)){
     ed_line_out->flg|=FL_ELB_INSEND;
     ed_line_out->lastch=0;
@@ -107,7 +107,7 @@ int cmd_io_line_in(cmd_io_t *cmd_io)
       }
       return 1;
     }
-    else 
+    else
       if(ed_line_in->flg&FL_ELB_ECHO) {
         while(cmd_io_putc(io_stack,ch)<0);
       }
index 0b255f5f4ed3b0ff67249467c1d66deff0c3a2d5..f76a546af33c54c408560bef122c46846363d18e 100644 (file)
@@ -1,12 +1,12 @@
 /*******************************************************************
   Components for embedded applications builded for
-  laboratory and medical instruments firmware  
+  laboratory and medical instruments firmware
+
   cmd_proc.c - text command processor
                enables to define multilevel tables of commands
               which can be received from more inputs and send reply
               to respective I/O stream output
+
   Copyright (C) 2001-2009 by Pavel Pisa pisa@cmp.felk.cvut.cz
             (C) 2002-2009 by PiKRON Ltd. http://www.pikron.com
             (C) 2007 by Michal Sojka <sojkam1@fel.cvut.cz>
@@ -54,7 +54,7 @@ int proc_cmd_line(cmd_io_t *cmd_io, cmd_des_t const **des_arr, char *line)
   int arr_stack_sp=0;
   char *param[10];
   short cmd_len;
-  int res, i, parcnt; 
+  int res, i, parcnt;
   param[0]=p=skip_white(p);
   if(!*p) return 0;
   /* Determine the name of the command */
@@ -66,7 +66,7 @@ int proc_cmd_line(cmd_io_t *cmd_io, cmd_des_t const **des_arr, char *line)
     cmd_len=p-param[0];
   }
   param[1]=param[2]=skip_white(p);
-  
+
   /* Find the command in des_arr */
   while(1){
     des=*(des_arr++);
@@ -112,7 +112,7 @@ int proc_cmd_line(cmd_io_t *cmd_io, cmd_des_t const **des_arr, char *line)
        break;
       }
       i=1;                     /* Signal no match */
-      break;      
+      break;
     }
     if(i!=0) continue; /* Try next command */
     /* Setup parameters */
@@ -161,7 +161,7 @@ int proc_cmd_line(cmd_io_t *cmd_io, cmd_des_t const **des_arr, char *line)
  * if the opchar is not ':' or '?'.
  */
 int cmd_opchar_check(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
-{ 
+{
   int opchar=*param[2];
   if(opchar==':'){
     if(!(des->mode&CDESM_WR)){
@@ -193,7 +193,7 @@ int cmd_num_suffix(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[], u
     p++;
   }while(*p && !strchr(" :?=",*p));
   *pval=val;
-  return 0;  
+  return 0;
 }
 
 
@@ -203,7 +203,7 @@ int cmd_do_stamp(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
   cmd_io_write(cmd_io,param[0],param[2]-param[0]);
   cmd_io_putc(cmd_io,'=');
   cmd_io_write(cmd_io,param[3],strlen(param[3]));
-  return 0; 
+  return 0;
 }
 
 /**
@@ -223,7 +223,7 @@ int cmd_do_rw_short(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
   }else{
     return cmd_opchar_replong(cmd_io, param, (long)*ptr, 0, 0);
   }
-  return 0; 
+  return 0;
 }
 
 /**
@@ -243,7 +243,7 @@ int cmd_do_rw_int(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
   }else{
     return cmd_opchar_replong(cmd_io, param, (long)*ptr, 0, 0);
   }
-  return 0; 
+  return 0;
 }
 
 
@@ -264,7 +264,7 @@ int cmd_do_rw_long(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
   }else{
     return cmd_opchar_replong(cmd_io, param, (long)*ptr, 0, 0);
   }
-  return 0; 
+  return 0;
 }
 
 /**
@@ -302,7 +302,7 @@ int cmd_do_rw_bitflag(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]
     cmd_io_putc(cmd_io,'=');
     cmd_io_putc(cmd_io,*pval&mask?'1':'0');
   }
-  
+
   return 0;
 }
 
@@ -322,7 +322,7 @@ int cmd_do_help(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
   /* FIXME: This should not be there unconditional */
   if (cmd_io->priv.ed_line.io_stack)
     cmd_io = cmd_io->priv.ed_line.io_stack;
-  
+
   if(filt) {
     filt=skip_white(filt);
     if(!*filt) filt=NULL;
index a9b62d5b1ccce6245afe60538e09238e7dc27843..1f0cf00194cf7fb03d06039fafe260cffeb60140 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************
   Components for embedded applications builded for
-  laboratory and medical instruments firmware  
+  laboratory and medical instruments firmware
+
   cmd_proc.h - text line command processor
                designed for instruments control and setup
               over RS-232 line
+
   Copyright (C) 2001-2009 by Pavel Pisa pisa@cmp.felk.cvut.cz
             (C) 2002-2009 by PiKRON Ltd. http://www.pikron.com
             (C) 2007 by Michal Sojka <sojkam1@fel.cvut.cz>
index 699c127c13e8d5bdee1a812f85b68167c29901fb..7f93e509ecce3e7dfcdf36ee2ea9632f64e6f127 100644 (file)
@@ -2,7 +2,7 @@
 #define CMD_PROC_PRIV_H
 
 /* The maximal depth of command arrays nesting (see CMD_DES_INCLUDE_SUBLIST). */
-#define CMD_ARR_STACK_SIZE 4    
+#define CMD_ARR_STACK_SIZE 4
 
 char *skip_white(char *p);
 int cmd_io_line_out(cmd_io_t *cmd_io);
index da9b9f3d836bd764334710118b97eaa2e83ab13f..650528b9e0f737d3ca6a48f577af112b5ea8dbe7 100644 (file)
@@ -1,12 +1,12 @@
 /*******************************************************************
   Components for embedded applications builded for
-  laboratory and medical instruments firmware  
+  laboratory and medical instruments firmware
+
   cmd_proc.c - text command processor
                enables to define multilevel tables of commands
               which can be received from more inputs and send reply
               to respective I/O stream output
+
   Copyright (C) 2001-2009 by Pavel Pisa pisa@cmp.felk.cvut.cz
             (C) 2002-2009 by PiKRON Ltd. http://www.pikron.com
             (C) 2007 by Michal Sojka <sojkam1@fel.cvut.cz>
@@ -31,7 +31,7 @@ int cmd_processor_run(cmd_io_t *cmd_io, cmd_des_t const **commands)
 
   if(cmd_io_line_out(cmd_io))
     return 1; /* Not all the output has been sent. */
-       
+
   if(cmd_io_line_in(cmd_io)<=0)
     return 0; /* Input line not finished or error. */
 
index e1c2b52763b68a222fa6143b61fbc2d34e224c4f..94de8316680acbd3e50f09fa6c1a7babc056c2c0 100644 (file)
@@ -1,16 +1,16 @@
 /* Definitions of IOs */
-#include <unistd.h> 
+#include <unistd.h>
 #include <cmd_proc.h>
 #include <stdio.h>
 
-static int std_putc(cmd_io_t *cmd_io, int ch) { 
+static int std_putc(cmd_io_t *cmd_io, int ch) {
     int r=putchar(ch);
     fflush(stdout);
     return r;
 }
 
 //int _getkey_nb(void);
-static int std_getc(cmd_io_t *cmd_io) { 
+static int std_getc(cmd_io_t *cmd_io) {
     return getchar();           /* On UNIX, we don't use non-blocking
                                  * variant. */
     //return _getkey_nb();
@@ -19,7 +19,7 @@ static int std_write(cmd_io_t *cmd_io, const void *buf, int count) {
     return write(1, buf, count);
 }
 static int std_read(cmd_io_t *cmd_io, void *buf, int count) {
-    return read(0, buf, count); 
+    return read(0, buf, count);
 }
 
 cmd_io_t cmd_io_std={
@@ -28,4 +28,3 @@ cmd_io_t cmd_io_std={
     write:std_write,
     read:std_read
 };
-
index 70408dc5f63087145c1ac44053e8974ff2e05366..2075ad64032c7f7cd2bbdcb19a0ff0c4d73fd667 100644 (file)
@@ -1,10 +1,10 @@
 /*******************************************************************
   Components for embedded applications builded for
-  laboratory and medical instruments firmware  
+  laboratory and medical instruments firmware
+
   cmdio_std_file.c - interconnection of text command processor
                   with generic file interface
+
   Copyright (C) 2001-2009 by Pavel Pisa pisa@cmp.felk.cvut.cz
             (C) 2002-2009 by PiKRON Ltd. http://www.pikron.com
             (C) 2007 by Michal Sojka <sojkam1@fel.cvut.cz>
@@ -54,7 +54,7 @@ static  int cmd_io_read_forfile(struct cmd_io *cmd_io,void *buf,int count)
 int cmd_proc_forfile(FILE * in,FILE * out, cmd_des_t const **des_arr, char *line)
 {
   cmd_io_t cmd_io;
-  
+
   cmd_io.putc=cmd_io_putc_forfile;
   cmd_io.getc=cmd_io_getc_forfile;
   cmd_io.write=cmd_io_write_forfile;
@@ -71,20 +71,20 @@ int cmd_proc_forshell (int argc, char **argv)
   int res;
   size_t len;
   char *line, *p;
-  
+
   if(argc<2){
     cmd_proc_forfile(stdin, stdout, cmd_forshell, "help");
     printf("\n");
     return 1;
   }
-  
+
   for(len=0, i=1; i<argc; i++)
     len+=strlen(argv[i])+1;
 
   line=malloc(len);
   if(!line)
     return 3;
-  
+
   for(p=line, i=1; i<argc; i++) {
     len=strlen(argv[i]);
     memcpy(p,argv[i],len);
@@ -100,9 +100,9 @@ int cmd_proc_forshell (int argc, char **argv)
     printf("cmdproc \"%s\" failed with error %d\n",line,res);
     res=2;
   } else res=0;
-  
+
   free(line);
-  
+
   return res;
 
 }
index ea85d0c9f3f6c6ffdb2a937774986aff11d44ace..170cd5464aa5ab14fb52bfd3f865a30cf57dd799 100644 (file)
@@ -14,7 +14,7 @@ int cmd_do_testopchar(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]
       "param[1]=%s\n"
       "param[2]=%s\n"
       "param[3]=%s\n"
-      "opchar=%c\n", 
+      "opchar=%c\n",
       param[0], param[1], param[2], param[3], opchar);
 
   return 0;