[cs631apue] Question about the strmode

bzhang41 bzhang41 at stevens.edu
Thu Oct 6 22:39:18 EDT 2016


Dear Patrick:

Thanks for you comments for my snap shot.

I took your suggestions to use strmode(3), but I can't pass the cc -Wall 
compile,
it shows the following error:

/tmp/ccxcP9Dh.o: In function `lfdisplay':
ls.c:(.text+0xea5): undefined reference to `strmode'
collect2: ld returned 1 exit status

I check the man, and I it says this function should #include 
<bsd/string.h>
So I did it, but I still get the above error message.
How can I fix it ?

Thanks
Bo
------------------------------------------------

- Source code readability could use some work (i.e. move comments from 
header
   files to source files, indentations & brackets)

`myfun.h`
- No comments.

`myfun.c`
- 30:32 - closedir(3) may fail
- 149 - atoi(3) is not recommended (i.e. setting `bs` as `BACON`) will 
cause
   atoi(3) to fail); rather, I would recommend strtol(3) then casting the 
`long`
   down to an `int` (after checking for overflow and MAX_INT).
- 277:358 - strmode(3) accomplishes filemode too
- 427:499 - please note that some flags may override others
   (i.e. `ls -t -u` == `ls -u`)

`nooptions.c`
- No include. I do not believe this file is being used yet.

`oneopton.c`
- No include. I do not believe this file is being used yet.

`ls.c`
- C source code should not be included; rather, the C files are passed 
to the
   compiler (i.e. `gcc ls.c nooptions.c oneoption.c`)


More information about the cs631apue mailing list