mirror of https://github.com/ecmwf/eccodes.git
Print usage on error
This commit is contained in:
parent
7db2c172e4
commit
bdbb473418
|
@ -340,6 +340,8 @@ int main(int argc, char *argv[])
|
|||
const char* prog = argv[0];
|
||||
char* infile_name = NULL;
|
||||
char* outfile_name = NULL;
|
||||
|
||||
if (argc==1 || argc >8) usage(prog);
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i],"-p")==0) {
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright 2005-2018 ECMWF.
|
||||
*
|
||||
* This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Common tigge functions
|
||||
*/
|
||||
|
||||
#include "tigge_tools.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
#include <stdio.h>
|
||||
|
||||
extern void validate(const char* path);
|
||||
|
||||
void scan(const char* name)
|
||||
{
|
||||
DIR *dir;
|
||||
if((dir = opendir(name)) != NULL)
|
||||
{
|
||||
struct dirent* e;
|
||||
char tmp[1024];
|
||||
while( (e = readdir(dir)) != NULL)
|
||||
{
|
||||
if(e->d_name[0] == '.') continue;
|
||||
sprintf(tmp,"%s/%s",name,e->d_name);
|
||||
scan(tmp);
|
||||
}
|
||||
|
||||
closedir(dir);
|
||||
}
|
||||
else {
|
||||
validate(name);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* Copyright 2005-2018 ECMWF.
|
||||
*
|
||||
* This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
*/
|
||||
|
||||
#ifndef TIGGE_TOOLS_H
|
||||
#define TIGGE_TOOLS_H
|
||||
|
||||
void scan(const char* name);
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue