aliasing gcc so it doesn't scrobble source code

aliasing gcc so it doesn't scrobble source code

Post by Brianna Merchan » Fri, 21 Feb 2003 10:05:22



More than once I have been stupid enough to issue the command

gcc myprogram.c -o myprogram.c

thus scrobbling my source code. (I saw someone else here recently who had
done the same). Can someone suggest an alias for gcc so I may safely type
this and get a warning instead?

The logic would be: if there is an "-o", and if the argument following the
"-o" ends in ".c", do not proceed as normal, but instead issue a warning.

thanks to anyone who can help --brianna

 
 
 

aliasing gcc so it doesn't scrobble source code

Post by j.. » Fri, 21 Feb 2003 13:38:10



> More than once I have been stupid enough to issue the command

> gcc myprogram.c -o myprogram.c

> thus scrobbling my source code. (I saw someone else here recently
> who had done the same). Can someone suggest an alias for gcc so I
> may safely type this and get a warning instead?

No alias needed, just type

gcc myprogram.c

Then run a.out

If you want or need more than that I think it's better to write a
makefile and then type

make

 
 
 

aliasing gcc so it doesn't scrobble source code

Post by Tim Cargi » Fri, 21 Feb 2003 20:44:39



> More than once I have been stupid enough to issue the command

Not stupid.  Ignorant.  Cannot you write a simple shell script
to do your compiles?  It's all of two lines and it is not exactly
'C' (read as 'rocket') science:

#!/bin/sh
gcc myprogram.c -o myprogram
./myprogram                    #Added this gratuitous 3rd line to
                               #assist you not running the wrong
program
                               #You can add the exit value test for
'gcc'

Quote:

> gcc myprogram.c -o myprogram.c

Uh, uh.  This is bad!  It has been known to 'scrobble' source code.
:-)

Quote:> thus scrobbling my source code.

You invented a new word!  I could only find 'scribbling' and
'scrabbling'
in my dictionary.  I must complement you on the 'sniglet'.  It does
seem to match the situation.

Quote:>(I saw someone else here recently who had done the same).

Probably the same thread where I lost it.  I also submitted
a simple makefile to the poor bloke as a peace offering.
Here's the thread:

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=8b67aef5.0...

You may want to look at the makefile here, although the (above) shell
snippet should keep you out of trouble:

http://groups.google.com/groups?q=group:comp.unix.programmer+author:t...

Quote:> Can someone suggest an alias for gcc so I may safely type
> this and get a warning instead?

Well ... I can suggest a name for such a contrivance ... 'noscrobble'!

Quote:

> The logic would be: if there is an "-o", and if the argument following the
> "-o" ends in ".c", do not proceed as normal, but instead issue a warning.

How about instead of addressing symptoms we address the problem
and you learn how to write simple shell snippets BEFORE you learn
how to do whatever you're doing in 'C'.

Quote:

> thanks to anyone who can help --brianna

Tim - PITA
 
 
 

aliasing gcc so it doesn't scrobble source code

Post by Villy Kru » Fri, 21 Feb 2003 22:28:38


On Thu, 20 Feb 2003 04:38:10 GMT,

Quote:

>If you want or need more than that I think it's better to write a
>makefile and then type

>make

You can also do

$ make myprogram

and in the absense of a Makefile it will use builtin rules to make
the program from C source.

Villy

 
 
 

aliasing gcc so it doesn't scrobble source code

Post by Brianna Merchan » Sat, 22 Feb 2003 00:21:37




>> thus scrobbling my source code.

> You invented a new word!  I could only find 'scribbling' and
> 'scrabbling' in my dictionary.  I must complement you on the
> 'sniglet'.  It does seem to match the situation.

ha, I think it's English slang. But maybe it's just in my family.  Mum
would warn my brothers and me "mind you don't get scrobbled" if we had to
go somewhere dark or dangerous. It's kind of a cute word, for something
that's actually quite *.

by the way you meant "compliment" in the above quote.

yeah ok a simple script to execute the compile is better than an alias to
catch a slip-up and potential scrobble. thanks --bri

 
 
 

1. gethostbyname() on alias doesn't give other entries with same alias?

So, I have an /etc/hosts that looks like this:

1.2.3.4    primary_name_1  foo
1.2.4.4    primary_name_2  foo

When I do gethostbyname("foo"), I expected to get both address
in the hostent structure.  Instead, I only got the first one.

When I changed the /etc/hosts so that the primary names were the same:

1.2.3.4   bar  primary_name_1  foo
1.2.4.4   bar  primary_name_2  foo

it worked okay; I got both addresses from gethostbyname("foo").

This happened on Solaris and HP-UX.

Is this the expected behaviour?  It doesn't seem good to me.

--

2. Help with Xwindows

3. source code for 'init' and 'login'?

4. Problem installing openssh port

5. How do I get 'routed' and 'gated' (source code)?

6. Test

7. Slackware 2.2's GCC doesn't link X libs

8. C Shell $cwd quirk?

9. source code of the 'ps' command needed.

10. GCC can't find cpp -FAQ doesn't help

11. Where can I find the source code for the 'top' utility

12. WANTED: unix source code for command 'date'

13. Build failed after modify gcc source code.