[comp.lang.c] ????? HELP!!! what is wrong with this code? ???????

debra@alice.UUCP (Paul De Bra) (10/07/88)

In article <456@mrsvr.UUCP> ssa@mrsvr.UUCP (6607) writes:
>
>	For the life of me I can't figure out what is wrong with the following
>	code!!!!...
>	when I compile it I get a message:
>
>"test.c", line 7: warning: illegal combination of pointer and integer, op =
>

(Please let's not flame this beginner, and let's not start a long discussion
about what's wrong with this code)

Your code is just fine. The problem is that you named your program "test".
There is a standard utility "test" in /bin, and if that comes before your
current directory in your $PATH, you actually execute /bin/test instead
of your own program. When you run "dbx test" or something, you give "test"
as argument, and that is not subject to PATH-search, so dbx will run your
"test" instead of /bin/test. That's all.

Paul.
|--------------------------------------------------------------------------
|Paul De Bra              | I am completely surrounded by giant bugs !    |
|debra@research.att.com   | There's millions of them, all over this code! |
|uunet!research!debra     | Beam me up quickly...Please...                |
|--------------------------------------------------------------------------

gwyn@smoke.ARPA (Doug Gwyn ) (10/07/88)

In article <8271@alice.UUCP> debra@alice.UUCP () writes:
>>"test.c", line 7: warning: illegal combination of pointer and integer, op =
>(Please let's not flame this beginner, and let's not start a long discussion
>about what's wrong with this code)

How about flaming incorrect answers?  Is that okay?

>Your code is just fine. The problem is that you named your program "test".

All that is worth warning people about, but it has nothing to do
with the fellow's problem.

amos@taux02.UUCP (Amos Shapir) (10/07/88)

In article <8271@alice.UUCP> debra@alice.UUCP () writes:
>Your code is just fine. The problem is that you named your program "test".
>There is a standard utility "test" in /bin, and if that comes before your
>current directory in your $PATH, you actually execute /bin/test instead
>of your own program.

More likely, 'test' is a shell built-in command so it gets executed
before anything on PATH (/bin seldom precedes '.' in $PATH of regular
users).
-- 
	Amos Shapir				amos@nsc.com
National Semiconductor (Israel) P.O.B. 3007, Herzlia 46104, Israel
Tel. +972 52 522261  TWX: 33691, fax: +972-52-558322
34 48 E / 32 10 N			(My other cpu is a NS32532)

limes@ouroborous (Greg Limes) (10/08/88)

In article <456@mrsvr.UUCP> ssa@mrsvr.UUCP (6607) writes:
>"test.c", line 7: warning: illegal combination of pointer and integer, op =

In article <8271@alice.UUCP>, debra@alice (Paul De Bra) writes:
>There is a standard utility "test" in /bin ...

"test" may also be built into your shell. Try executing the program by 
typing "./test", and see if that gets you what you are looking for.
-- 
Greg Limes [limes@sun.com]		semper ubi, sub ubi

tcjones@watdragon.waterloo.edu (terry jones) (10/08/88)

In article <192@taux02.UUCP+ amos@taux02.UUCP (Amos Shapir) writes:
+In article <8271@alice.UUCP+ debra@alice.UUCP () writes:
++Your code is just fine. The problem is that you named your program "test".
++There is a standard utility "test" in /bin, and if that comes before your
++current directory in your $PATH, you actually execute /bin/test instead
++of your own program.
+
+More likely, 'test' is a shell built-in command so it gets executed
+before anything on PATH (/bin seldom precedes '.' in $PATH of regular
+users).
+-- 
+	Amos Shapir				amos@nsc.com
+National Semiconductor (Israel) P.O.B. 3007, Herzlia 46104, Israel
+Tel. +972 52 522261  TWX: 33691, fax: +972-52-558322
+34 48 E / 32 10 N			(My other cpu is a NS32532)


Here we go............

edward@esosun.UUCP (Edward Tharp) (10/15/88)

  Normally, I don't get into these flame wars, but let's set things
straight.  If you haven't gathered it by now, the original poster
had *two* problems:
	1) Why was he getting a warning about strok, and
	2) Why did work in dbx, but not at the shell prompt
People have been responding the with correct (albeit incomplete) answers:
	1) Differences between <string.h> and <strings.h>, and
	2) Use of program called test within sh.
I'm sure that the original poster corrected these errors and has moved
on to greater things.  So, let this discussion (?!?) die.

Ed Tharp

pnessutt@nis.mn.org (Robert A. Monio) (10/15/88)

In article <8650@smoke.ARPA> gwyn@brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>) writes:
>In article <8271@alice.UUCP> debra@alice.UUCP () writes:
>>>"test.c", line 7: warning: illegal combination of pointer and integer, op =
>>(Please let's not flame this beginner, and let's not start a long discussion
>>about what's wrong with this code)
>
>How about flaming incorrect answers?  Is that okay?

Flaming incorrect answers is okay only if the attitude presented is
not offensive.  I didn't view your response as offensive. The original
answer provided had no real correlation to the question asked other
than to point out a potential problem with his usage of 'test' program
names.

>>Your code is just fine. The problem is that you named your program "test".
>
>All that is worth warning people about, but it has nothing to do
>with the fellow's problem.

Indeed.  Thanks for providing the correct answer, Doug.

-- 
"Goooooooooood                                                 Robert A. Monio
     Moooooooorning                         National Information Systems, Inc.
         Discovery!!"                                      pnessutt@nis.mn.org
              -- Robin Williams            ..uunet!rosevax!bungia!nis!pnessutt