Skip to content
Browse files

-check arg

git-svn-id: https://erlyaws.svn.sourceforge.net/svnroot/erlyaws/trunk/yaws@291 9fbdc01b-0d2c-0410-bfb7-fb27d70d8b52
  • Loading branch information...
1 parent 8da2b3a commit 2f51c682cc8ad37f48b8e59658d71457f6cc7b0b @klacke committed Nov 20, 2002
Showing with 34 additions and 1 deletion.
  1. +7 −0 scripts/yaws.ss
  2. +6 −1 src/yaws_compile.erl
  3. +21 −0 src/yaws_ctl.erl
View
7 scripts/yaws.ss
@@ -82,6 +82,13 @@ do
shift;;
-heart)
heart=" -heart ";;
+ -check)
+ out=`exec $erl -noshell -pa ${yawsdir}/ebin -s yaws_ctl check $1`
+ if [ "$out" = "ok" ]; then
+ exit 0
+ fi
+ echo $out
+ exit 1;;
*)
help
esac
View
7 src/yaws_compile.erl
@@ -210,7 +210,12 @@ is_exported(Fun, A, Mod) ->
%% this will generate 9 lines
new_out_file(Line, C, GC) ->
- Mnum = gen_server:call(yaws_server, mnum),
+ Mnum = case catch gen_server:call(yaws_server, mnum) of
+ {'EXIT', _} ->
+ 1;
+ Other ->
+ Other
+ end,
Module = [$m | integer_to_list(Mnum)],
OutFile = lists:flatten(
io_lib:format(
View
21 src/yaws_ctl.erl
@@ -13,6 +13,10 @@
-compile(export_all).
-include_lib("kernel/include/file.hrl").
+-include_lib("yaws/include/yaws.hrl").
+-include_lib("yaws/include/yaws_api.hrl").
+
+
-define(F, "/tmp/yaws.ctl").
@@ -155,6 +159,23 @@ stop() ->
status() ->
actl(status, uid()).
+check([File| IncludeDirs]) ->
+ GC = yaws_config:make_default_gconf(false),
+ GC2 = GC#gconf{include_dir = lists:map(fun(X) -> atom_to_list(X) end,
+ IncludeDirs)},
+ SC = #sconf{},
+ case yaws_compile:compile_file(atom_to_list(File), GC2, SC) of
+ {ok, [{errors, 0}| Spec]} ->
+ io:format("ok~n",[]),
+ init:stop();
+ Other ->
+ io:format("Other = ~p~n", [Other]),
+ io:format("Errors in ~p~n", [File]),
+ init:stop()
+ end.
+
+
+

0 comments on commit 2f51c68

Please sign in to comment.
Something went wrong with that request. Please try again.