nwdigitalradio / rmsgw

Linux RMS Gateway
GNU General Public License v2.0
23 stars 12 forks source link

remove last 'bool' from source code #2

Closed dl8uf closed 6 years ago

dl8uf commented 6 years ago

While compiling rmsgw-2.4.0.182 I got an error:

/usr/local/src/ax25/rmsgw-2.4.0-181/librms/../include/rmslib.h:241:8:` error: unknown type name 'bool'
extern bool file_exists(const char `*filename);

The source of the problem is located in include/rmslib.h:

#ifndef TRUE
typedef int   bool;           /* boolean flag */
#define TRUE  1
#define FALSE 0
#endif

If TRUE was already defined by some other header files, the typedef will never be executed. Beside some possible constructions to solve this, there is a much easier way: bool is only used one time in cmslogin.c and one time in _fileexists.c.

So I think it would be more consequent to replace bool by what it is: int

Change include/rmslib.h to:

#ifndef TRUE
#define TRUE  1
#define FALSE 0
#endif

and

extern bool file_exists(const char *filename);

to

extern int file_exists(const char *filename);

Change cmslogin.c:

bool running = TRUE;

to

int running = TRUE;

And finally change _fileexists.c:

bool file_exists(const char *filename);

to

int file_exists(const char *filename);

With these changes the code will compile, even when TRUE was already defined by some other header files. I will try to open an new branch, change the code and submit a pull request, but it may take some time, because I'm a newbie to Github (this is my vy first touch ).

73 de Uwe, DL8UF

dl8uf commented 6 years ago

Downloaded newest source from here -> already fixed. Sorry!