From: Michal Sojka Date: Wed, 31 Jul 2013 13:56:29 +0000 (+0200) Subject: Whitespace fixes X-Git-Url: http://rtime.felk.cvut.cz/gitweb/sysless.git/commitdiff_plain/ce8e0f720b66d9fc78bd6cabfac21c3713edbed4 Whitespace fixes --- diff --git a/libs4c/cmdproc/cmd_io.c b/libs4c/cmdproc/cmd_io.c index fe9f7ce..b7b51f5 100644 --- a/libs4c/cmdproc/cmd_io.c +++ b/libs4c/cmdproc/cmd_io.c @@ -2,12 +2,12 @@ #include #include -/** +/** * 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; } - diff --git a/libs4c/cmdproc/cmd_io_line.c b/libs4c/cmdproc/cmd_io_line.c index 42ac418..a6631a9 100644 --- a/libs4c/cmdproc/cmd_io_line.c +++ b/libs4c/cmdproc/cmd_io_line.c @@ -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 @@ -23,12 +23,12 @@ /* 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); } diff --git a/libs4c/cmdproc/cmd_proc.c b/libs4c/cmdproc/cmd_proc.c index 0b255f5..f76a546 100644 --- a/libs4c/cmdproc/cmd_proc.c +++ b/libs4c/cmdproc/cmd_proc.c @@ -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 @@ -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; diff --git a/libs4c/cmdproc/cmd_proc.h b/libs4c/cmdproc/cmd_proc.h index a9b62d5..1f0cf00 100644 --- a/libs4c/cmdproc/cmd_proc.h +++ b/libs4c/cmdproc/cmd_proc.h @@ -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 diff --git a/libs4c/cmdproc/cmd_proc_priv.h b/libs4c/cmdproc/cmd_proc_priv.h index 699c127..7f93e50 100644 --- a/libs4c/cmdproc/cmd_proc_priv.h +++ b/libs4c/cmdproc/cmd_proc_priv.h @@ -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); diff --git a/libs4c/cmdproc/cmd_proc_run.c b/libs4c/cmdproc/cmd_proc_run.c index da9b9f3..650528b 100644 --- a/libs4c/cmdproc/cmd_proc_run.c +++ b/libs4c/cmdproc/cmd_proc_run.c @@ -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 @@ -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. */ diff --git a/libs4c/cmdproc/cmdio_std.c b/libs4c/cmdproc/cmdio_std.c index e1c2b52..94de831 100644 --- a/libs4c/cmdproc/cmdio_std.c +++ b/libs4c/cmdproc/cmdio_std.c @@ -1,16 +1,16 @@ /* Definitions of IOs */ -#include +#include #include #include -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 }; - diff --git a/libs4c/cmdproc/cmdio_std_file.c b/libs4c/cmdproc/cmdio_std_file.c index 70408dc..2075ad6 100644 --- a/libs4c/cmdproc/cmdio_std_file.c +++ b/libs4c/cmdproc/cmdio_std_file.c @@ -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 @@ -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