Skip to contentSkip to conversation

Patch to get iw building on Fedora 8

PATCH Ben Greear 4 participants 10 messages Sep 21, 2010 – Sep 24, 2010

lore
Share & tools
lore

Ben Greear

author
#0 lore raw

I need this in order to get iw to build on Fedora 8.

[greearb@fs2 iw]$ git diff

bitrate.c +2 -0
index 8de8839..9b6defc 100644
@@ -1,4 +1,6 @@
 #include <errno.h>
+#define  __USE_ISOC99
+#include <stdlib.h>
 
 #include "nl80211.h"
 #include "iw.h"
Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com
#1 lore raw

bitrate.c line 3

Quoted 11 lines · Ben Greear

I need this in order to get iw to build on Fedora 8.

[greearb@fs2 iw]$ git diff

bitrate.c +2 -0
index 8de8839..9b6defc 100644
@@ -1,4 +1,6 @@
  #include <errno.h>
+#define  __USE_ISOC99
+#include <stdlib.h>

had to add #ifndef guards, but applied it.

johannes

author
#2 lore raw

I notice that you added some code to try to get this working:

#ifndef _ISOC99_SOURCE
#define _ISOC99_SOURCE
#endif

However, it still will not build for me on Fedora 8. In case I'm doing something else strange..were you able to build it on FC8 by any chance?

I can easily carry the fix in my own tree, but thought you might want to know...

Thanks,
Ben

Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com
#3 lore raw
Quoted 7 lines · Ben Greear

I notice that you added some code to try to get this working:

#ifndef _ISOC99_SOURCE
#define _ISOC99_SOURCE
#endif

Quoted 5 lines

However, it still will not build for me on Fedora 8. In case I'm doing something else strange..were you able to build it on FC8 by any chance?

I can easily carry the fix in my own tree, but thought you might want to know...

No, I don't have FC8 anywhere ... Does it build for you with -std=c99? But that gives me a lot of warnings due to a libnl header file bug ("extern inline").

johannes

author
#4 lore raw
Quoted 11 lines · Johannes Berg
Quoted 10 lines · Ben Greear

I notice that you added some code to try to get this working:

#ifndef _ISOC99_SOURCE
#define _ISOC99_SOURCE
#endif

However, it still will not build for me on Fedora 8. In case I'm doing something else strange..were you able to build it on FC8 by any chance?

Quoted 6 lines
Quoted 2 lines

I can easily carry the fix in my own tree, but thought you might want to know...

No, I don't have FC8 anywhere ... Does it build for you with -std=c99? But that gives me a lot of warnings due to a libnl header file bug ("extern inline").

Any problem with just changing it to 'strtod' ?

That compiles back at least as far as FC5.

Ben

Quoted 2 lines

johannes

Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com
#5 lore raw
Quoted 12 lines · Ben Greear
Quoted 11 lines · Johannes Berg
Quoted 10 lines · Ben Greear

I notice that you added some code to try to get this working:

#ifndef _ISOC99_SOURCE
#define _ISOC99_SOURCE
#endif

However, it still will not build for me on Fedora 8. In case I'm doing something else strange..were you able to build it on FC8 by any chance?

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

I can easily carry the fix in my own tree, but thought you might want to know...

No, I don't have FC8 anywhere ... Does it build for you with -std=c99? But that gives me a lot of warnings due to a libnl header file bug ("extern inline").

Any problem with just changing it to 'strtod' ?

I did that earlier today.

johannes

#6 lore raw
In reply to Ben Greear

bitrate.c line 2

Quoted 10 lines · Ben Greear

I need this in order to get iw to build on Fedora 8.

[greearb@fs2 iw]$ git diff

bitrate.c +1 -0
index 8de8839..9b6defc 100644
@@ -1,4 +1,6 @@
 #include <errno.h>
+#define  __USE_ISOC99

This is wrong. You must never define internal glibc macros.

Andreas.

Signature · 3 lines
Andreas Schwab, [email protected]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
author
#7 lore raw
Quoted 4 lines · Andreas Schwab
Quoted 2 lines · Ben Greear

I need this in order to get iw to build on Fedora 8.

Quoted 10 lines

bitrate.c line 2

Quoted 8 lines

[greearb@fs2 iw]$ git diff

bitrate.c +1 -0
index 8de8839..9b6defc 100644
@@ -1,4 +1,6 @@
  #include<errno.h>
+#define  __USE_ISOC99

This is wrong. You must never define internal glibc macros.

How about this then?

bitrate.c +1 -1
index 8de8839..f0d513f 100644
@@ -70,7 +70,7 @@ static int handle_bitrates(struct nl80211_state *state,
 #endif
                else switch (parser_state) {
                case S_LEGACY:
-                       tmpf = strtof(argv[i], &end);
+                       tmpf = strtod(argv[i], &end);
                        if (*end != '\0')
                                return 1;
                        if (tmpf < 1 || tmpf > 255 * 2)

Seems you don't have to do anything clever to get strtod to work, and I assume it should cast just fine.

Thanks,
Ben

Quoted 3 lines

Andreas.

Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com
#8 lore raw
Quoted 5 lines · Ben Greear
Quoted 4 lines · Andreas Schwab
Quoted 2 lines · Ben Greear

I need this in order to get iw to build on Fedora 8.

...

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

+#define __USE_ISOC99

This is wrong. You must never define internal glibc macros.

How about this then?

...

Quoted 2 lines
bitrate.c +1 -1
-                       tmpf = strtof(argv[i], &end);
+                       tmpf = strtod(argv[i], &end);

...

Quoted 2 lines

Seems you don't have to do anything clever to get strtod to work, and I assume it should cast just fine.

I think to use C99 features like strtof() you need to either add -std=c99 to CFLAGS, or #define _ISOC99_SOURCE (see /usr/include/features.h).

HTH,
Johannes

author
#9 lore raw
Quoted 15 lines · Johannes Stezenbach
Quoted 5 lines · Ben Greear
Quoted 4 lines · Andreas Schwab
Quoted 2 lines · Ben Greear

I need this in order to get iw to build on Fedora 8.

...

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

+#define __USE_ISOC99

This is wrong. You must never define internal glibc macros.

How about this then?

...

Review

Quoted 2 lines
(quoted diff) +1 -1
-                       tmpf = strtof(argv[i],&end);
+                       tmpf = strtod(argv[i],&end);
Quoted 7 lines

...

Quoted 2 lines

Seems you don't have to do anything clever to get strtod to work, and I assume it should cast just fine.

I think to use C99 features like strtof() you need to either add -std=c99 to CFLAGS, or #define _ISOC99_SOURCE (see /usr/include/features.h).

It seems using strtod would be simpler all around, and might work on more compilers and even more ancient systems.

Thanks,
Ben

Quoted 3 lines

HTH,
Johannes

Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com