Compiling help?

Links and other hanky panky that doesn't have to do with anything in particular.
Post Reply
User avatar
Mostess
Orwell
Posts: 809
Joined: Wed Sep 29, 2004 5:49 am
Instruments: Vocal, guitar, keyboard, clarinet
Recording Method: Ardour 5, JACK, Ubuntu
Submitting as: Hostess Mostess
Pronouns: He/him
Location: Ann Arbor, MI
Contact:

Compiling help?

Post by Mostess »

C programs written by a programmer 10x more skilled than I, but written over a decade ago. I need them, I love them, I had them for UNIX, DOS, Win2k. I got the source code for my Mac (OS 10.4); I compiled them using gcc 4.0.0. They work as they should.

But they use gets() which (apparently) is unsafe. How do I know? Because they warn me every time I use them. "Warning," they say, "this program uses gets() which is unsafe." They're command-line programs that I call from shells, often in loops. So any stderr output I might want to look at is swamped with lines upon lines of these annoying warnings. I get it. It's unsafe. Shut up!

Is there a gcc commandline option that compiles the programs so they won't warn me about gets()? I really don't care how unsafe it is. Another compiler? Any quick solution short of altering the source code (a can of worms I'd like to keep shut)?
"We don’t write songs about our own largely dull lives. We mostly rely on the time-tested gimmick of making shit up."
-John Linnell
HeuristicsInc
Ibárruri
Posts: 5351
Joined: Sat Sep 25, 2004 6:14 pm
Instruments: Synths
Recording Method: Windows computer, Acid, Synths etc.
Submitting as: Heuristics Inc. (duh) + collabs
Pronouns: he/him
Location: Maryland USA
Contact:

Post by HeuristicsInc »

if you just want to disable the warnings, -w claims to turn them all off.
(oh wait, it's printing this message when you run it, not compile it? bizarre)
-bill
Last edited by HeuristicsInc on Tue Oct 25, 2005 10:06 am, edited 1 time in total.
152612141617123326211316121416172329292119162316331829382412351416132117152332252921
http://heuristicsinc.com
Liner Notes
SF Lyric Ideas
HeuristicsInc
Ibárruri
Posts: 5351
Joined: Sat Sep 25, 2004 6:14 pm
Instruments: Synths
Recording Method: Windows computer, Acid, Synths etc.
Submitting as: Heuristics Inc. (duh) + collabs
Pronouns: he/him
Location: Maryland USA
Contact:

Post by HeuristicsInc »

ah, i see - gets() is deprecated because it has no limit to the number of characters read in. some source recommends replacing with:
fgets(string, num_characters_in_string, stdin);
-bill
152612141617123326211316121416172329292119162316331829382412351416132117152332252921
http://heuristicsinc.com
Liner Notes
SF Lyric Ideas
HeuristicsInc
Ibárruri
Posts: 5351
Joined: Sat Sep 25, 2004 6:14 pm
Instruments: Synths
Recording Method: Windows computer, Acid, Synths etc.
Submitting as: Heuristics Inc. (duh) + collabs
Pronouns: he/him
Location: Maryland USA
Contact:

Post by HeuristicsInc »

Third post in a row... some googling turned up this possibility:

Note You can disable the warning by setting the environment variable DISABLE_GETS_WARNING.

That might be OS-specific so it might not work on your system.
-bill
152612141617123326211316121416172329292119162316331829382412351416132117152332252921
http://heuristicsinc.com
Liner Notes
SF Lyric Ideas
Post Reply