[cs631apue] Question about the strmode

Patrick Murray pmurray1 at stevens.edu
Fri Oct 7 11:20:48 EDT 2016


Can you verify that all object files are deleted prior to running make?
Including `bsd/string.h` should have resolved the issue, although without
more
background the debugging I can do is limited. Please let me know if this
issue
persists!

On Thu, Oct 6, 2016 at 10:39 PM, bzhang41 <bzhang41 at stevens.edu> wrote:

> 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`)
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.stevens.edu/pipermail/cs631apue/attachments/20161007/30907cc2/attachment.html>


More information about the cs631apue mailing list