remove spurious spaces & tabs at end of lines

This commit is contained in:
Philippe Teuwen 2019-03-09 08:59:13 +01:00
commit 60f292b18e
249 changed files with 8481 additions and 8481 deletions

View file

@ -114,7 +114,7 @@ enum
#define ARG_LOG(x) \
do { if (ARG_ENABLE_LOG) dbg_printf x; } while (0)
#endif
#endif
extern void dbg_printf(const char *fmt, ...);
@ -1465,7 +1465,7 @@ static int arg_dbl_scanfn(struct arg_dbl *parent, const char *argval)
static int arg_dbl_checkfn(struct arg_dbl *parent)
{
int errorcode = (parent->count < parent->hdr.mincount) ? EMINCOUNT : 0;
ARG_TRACE(("%s:checkfn(%p) returns %d\n", __FILE__, parent, errorcode));
return errorcode;
}
@ -1575,7 +1575,7 @@ struct arg_dbl * arg_dbln(
result->count = 0;
}
ARG_TRACE(("arg_dbln() returns %p\n", result));
return result;
}
@ -1655,7 +1655,7 @@ static void arg_end_errorfn(
fprintf(fp, "invalid option \"-%c\"", error);
break;
}
fputc('\n', fp);
}
@ -1851,7 +1851,7 @@ static int arg_file_scanfn(struct arg_file *parent, const char *argval)
static int arg_file_checkfn(struct arg_file *parent)
{
int errorcode = (parent->count < parent->hdr.mincount) ? EMINCOUNT : 0;
ARG_TRACE(("%s:checkfn(%p) returns %d\n", __FILE__, parent, errorcode));
return errorcode;
}
@ -1962,7 +1962,7 @@ struct arg_file * arg_filen(
result->extension[i] = "";
}
}
ARG_TRACE(("arg_filen() returns %p\n", result));
return result;
}
@ -2325,7 +2325,7 @@ struct arg_int * arg_intn(
result->ival = (int *)(result + 1);
result->count = 0;
}
ARG_TRACE(("arg_intn() returns %p\n", result));
return result;
}
@ -2473,7 +2473,7 @@ struct arg_lit * arg_litn(
/* init local variables */
result->count = 0;
}
ARG_TRACE(("arg_litn() returns %p\n", result));
return result;
}
@ -3609,7 +3609,7 @@ static int arg_str_scanfn(struct arg_str *parent, const char *argval)
static int arg_str_checkfn(struct arg_str *parent)
{
int errorcode = (parent->count < parent->hdr.mincount) ? EMINCOUNT : 0;
ARG_TRACE(("%s:checkfn(%p) returns %d\n", __FILE__, parent, errorcode));
return errorcode;
}
@ -3711,7 +3711,7 @@ struct arg_str * arg_strn(
for (i = 0; i < maxcount; i++)
result->sval[i] = "";
}
ARG_TRACE(("arg_strn() returns %p\n", result));
return result;
}
@ -4252,7 +4252,7 @@ int arg_parse(int argc, char * *argv, void * *argtable)
argvcopy[i] = argv[i];
argvcopy[argc] = NULL;
/* parse the command line (local copy) for tagged options */
arg_parse_tagged(argc, argvcopy, table, endtable);

View file

@ -39,7 +39,7 @@ extern "C" {
#endif
#define ARG_REX_ICASE 1
/* bit masks for arg_hdr.flag */
enum
{
@ -218,7 +218,7 @@ struct arg_str* arg_str0(const char* shortopts,
const char* datatype,
const char* glossary);
struct arg_str* arg_str1(const char* shortopts,
const char* longopts,
const char* longopts,
const char* datatype,
const char *glossary);
struct arg_str* arg_strn(const char* shortopts,

View file

@ -26,16 +26,16 @@ int CLIParserInit(char *vprogramName, char *vprogramHint, char *vprogramHelp) {
programHint = vprogramHint;
programHelp = vprogramHelp;
memset(buf, 0x00, 500);
return 0;
}
int CLIParserParseArg(int argc, char **argv, void* vargtable[], size_t vargtableLen, bool allowEmptyExec) {
int CLIParserParseArg(int argc, char **argv, void* vargtable[], size_t vargtableLen, bool allowEmptyExec) {
int nerrors;
argtable = vargtable;
argtableLen = vargtableLen;
/* verify the argtable[] entries were allocated sucessfully */
if (arg_nullcheck(argtable) != 0) {
/* NULL entries were detected, some allocations must have failed */
@ -44,9 +44,9 @@ int CLIParserParseArg(int argc, char **argv, void* vargtable[], size_t vargtable
}
/* Parse the command line as defined by argtable[] */
nerrors = arg_parse(argc, argv, argtable);
/* special case: '--help' takes precedence over error reporting */
if ((argc < 2 && !allowEmptyExec) ||((struct arg_lit *)argtable[0])->count > 0) { // help must be the first record
if ((argc < 2 && !allowEmptyExec) ||((struct arg_lit *)argtable[0])->count > 0) { // help must be the first record
printf("Usage: %s", programName);
arg_print_syntaxv(stdout, argtable, "\n");
if (programHint)
@ -55,7 +55,7 @@ int CLIParserParseArg(int argc, char **argv, void* vargtable[], size_t vargtable
printf("\n");
if (programHelp)
printf("%s \n", programHelp);
return 1;
}
@ -64,10 +64,10 @@ int CLIParserParseArg(int argc, char **argv, void* vargtable[], size_t vargtable
/* Display the error details contained in the arg_end struct.*/
arg_print_errors(stdout, ((struct arg_end *)argtable[vargtableLen - 1]), programName);
printf("Try '%s --help' for more information.\n", programName);
return 3;
}
}
return 0;
}
@ -86,19 +86,19 @@ int CLIParserParseString(const char* str, void* vargtable[], size_t vargtableLen
int CLIParserParseStringEx(const char* str, void* vargtable[], size_t vargtableLen, bool allowEmptyExec, bool clueData) {
int argc = 0;
char *argv[200] = {NULL};
int len = strlen(str);
char *bufptr = buf;
char *spaceptr = NULL;
enum ParserState state = PS_FIRST;
argv[argc++] = bufptr;
argv[argc++] = bufptr;
// param0 = program name
memcpy(buf, programName, strlen(programName) + 1); // with 0x00
bufptr += strlen(programName) + 1;
if (len)
argv[argc++] = bufptr;
argv[argc++] = bufptr;
// parse params
for (int i = 0; i < len; i++) {
switch(state){
@ -110,7 +110,7 @@ int CLIParserParseStringEx(const char* str, void* vargtable[], size_t vargtableL
bufptr = spaceptr;
*bufptr = 0x00;
bufptr++;
argv[argc++] = bufptr;
argv[argc++] = bufptr;
}
}
spaceptr = NULL;
@ -130,10 +130,10 @@ int CLIParserParseStringEx(const char* str, void* vargtable[], size_t vargtableL
*bufptr = 0x00;
bufptr++;
argv[argc++] = bufptr;
argv[argc++] = bufptr;
break;
}
*bufptr = str[i];
bufptr++;
break;
@ -146,20 +146,20 @@ int CLIParserParseStringEx(const char* str, void* vargtable[], size_t vargtableL
void CLIParserFree() {
arg_freetable(argtable, argtableLen);
argtable = NULL;
return;
}
// convertors
int CLIParamHexToBuf(struct arg_str *argstr, uint8_t *data, int maxdatalen, int *datalen) {
*datalen = 0;
int ibuf = 0;
uint8_t buf[256] = {0};
int res = CLIParamStrToBuf(argstr, buf, maxdatalen * 2, &ibuf); // *2 because here HEX
if (res || !ibuf)
return res;
switch(param_gethex_to_eol((char *)buf, 0, data, maxdatalen, datalen)) {
case 1:
printf("Parameter error: Invalid HEX value.\n");
@ -171,7 +171,7 @@ int CLIParamHexToBuf(struct arg_str *argstr, uint8_t *data, int maxdatalen, int
printf("Parameter error: Hex string must have even number of digits.\n");
return 3;
}
return 0;
}
@ -179,26 +179,26 @@ int CLIParamStrToBuf(struct arg_str *argstr, uint8_t *data, int maxdatalen, int
*datalen = 0;
if (!argstr->count)
return 0;
uint8_t buf[256] = {0};
int ibuf = 0;
for (int i = 0; i < argstr->count; i++) {
int len = strlen(argstr->sval[i]);
memcpy(&buf[ibuf], argstr->sval[i], len);
ibuf += len;
}
buf[ibuf] = 0;
if (!ibuf)
return 0;
if (ibuf > maxdatalen)
return 2;
memcpy(data, buf, ibuf);
*datalen = ibuf;
return 0;
}

View file

@ -76,5 +76,5 @@ extern int optind, opterr, optopt;
extern int optreset; /* getopt(3) external variable */
#endif
__END_DECLS
#endif /* !_GETOPT_H_ */