jovanbulck / jsh

A basic UNIX shell implementation in C
GNU General Public License v3.0
31 stars 10 forks source link

Mac OS X compile issues #54

Closed Wanimatrix closed 9 years ago

Wanimatrix commented 10 years ago
jovanbulck commented 10 years ago

Could it be you didn't push the sed commit. I see the branch, but I don't see any additional commits?

About the inline: I found this on the gcc [doc page]() :

If you are writing a header file to be included in ISO C90 programs, write inline instead of inline. See Alternate Keywords.

Maybe to change this in in the jsh-common.h header? The problem is then that we depend on gcc specific features. We could also drop the inline keyword or use a macro with a result pointer argument or so

I'll look for the standard portable way of declaring function inline...

jovanbulck commented 10 years ago

Compiling the fix on Linux fails with

sed -e 's/@VERSION/1.1.0/' -e 's/@DATE/08 Nov 2014/' \ -e '/@BEGIN_COMMENT/,/END_COMMENT/c\ '$'\n''.\" jsh manpage auto generated by jsh Makefile' \ < jsh-man.1 > jsh.1 sed: -e expression #3, char 35: unknown command: `.'

Any idea the fix with $$'\n' uses BSD/Mac specific sed syntax, as opposed to GNU sed on Linux?

If so, we should put an if BSD sed clause in the Makefile. Better would be to find a portable sed expression which works on all sed implementations, if possible (maybe the syntax should only slightly be altered, but I have got no idea of what it means ;-) ).

jovanbulck commented 10 years ago

@Wouter92 Just pushed a fix for the inline function to master. Should work now normally?

jovanbulck commented 9 years ago

@Wouter92 Is mac working now? I guess we need to put your fix for sed with an if in the Makefile

Also, do you you compile with clang now? Does it work?

Wanimatrix commented 9 years ago

Ok, I can compile with clang without errors (my gcc is still broken).

I only get the following warning:

jsh.c:413:27: warning: expression which evaluates to zero treated as a null pointer constant of type 'char *' [-Wnon-literal-null-conversion]
        char *expansion = '\0';

This can be solved by changing line

char *expansion = '\0';

to

char *expansion;
*expansion = '\0';
jovanbulck commented 9 years ago

Thanks!

I think char *expansion = ""; should work. checkout the latest master

jovanbulck commented 9 years ago

clang is now also supported in TravisCI :-)

Wanimatrix commented 9 years ago

Nice, no more warnings!