mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-22 17:28:25 +01:00
Merge branch 'master' of github.com:processone/ejabberd
This commit is contained in:
commit
b970c88941
@ -149,7 +149,7 @@ define DEP_VERSION_template
|
|||||||
DEP_$(1)_VERSION:=$(shell $(SED) -e '/vsn/!d;s/.*, *"/$(1)-/;s/".*//' $(2) 2>/dev/null)
|
DEP_$(1)_VERSION:=$(shell $(SED) -e '/vsn/!d;s/.*, *"/$(1)-/;s/".*//' $(2) 2>/dev/null)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
DELETE_TARGET_SO=$(if $(subst X.soX,,X$(suffix $(1))X),,rm $(call TO_DEST,$(1));)
|
DELETE_TARGET_SO=$(if $(subst X.soX,,X$(suffix $(1))X),,rm -f $(call TO_DEST,$(1));)
|
||||||
|
|
||||||
$(foreach DEP,$(DEPS),$(eval $(call DEP_VERSION_template,$(DEP),deps/$(DEP)/ebin/$(DEP).app)))
|
$(foreach DEP,$(DEPS),$(eval $(call DEP_VERSION_template,$(DEP),deps/$(DEP)/ebin/$(DEP).app)))
|
||||||
$(eval $(call DEP_VERSION_template,ejabberd,ebin/ejabberd.app))
|
$(eval $(call DEP_VERSION_template,ejabberd,ebin/ejabberd.app))
|
||||||
@ -159,7 +159,7 @@ $(call TO_DEST,$(1)): $(1) $(call TO_DEST,$(dir $(1))) ; $(call DELETE_TARGET_SO
|
|||||||
endef
|
endef
|
||||||
|
|
||||||
define COPY_BINARY_template
|
define COPY_BINARY_template
|
||||||
$(call TO_DEST,$(1)): $(1) $(call TO_DEST,$(dir $(1))) ; rm $(call TO_DEST,$(1)); $$(INSTALL) -m 755 $$(O_USER) $(1) $(call TO_DEST,$(1))
|
$(call TO_DEST,$(1)): $(1) $(call TO_DEST,$(dir $(1))) ; rm -f $(call TO_DEST,$(1)); $$(INSTALL) -m 755 $$(O_USER) $(1) $(call TO_DEST,$(1))
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(foreach file,$(DEPS_FILES_FILTERED) $(MAIN_FILES),$(eval $(call COPY_template,$(file))))
|
$(foreach file,$(DEPS_FILES_FILTERED) $(MAIN_FILES),$(eval $(call COPY_template,$(file))))
|
||||||
|
@ -85,11 +85,65 @@ greplace(String, Regexp, New) ->
|
|||||||
A -> A
|
A -> A
|
||||||
end.
|
end.
|
||||||
|
|
||||||
-spec sh_to_awk(binary()) -> binary().
|
|
||||||
|
|
||||||
sh_to_awk(ShRegExp) ->
|
%% This code was copied and adapted from xmerl_regexp.erl
|
||||||
case exec({xmerl_regexp, sh_to_awk, [binary_to_list(ShRegExp)]},
|
|
||||||
{regexp, sh_to_awk, [binary_to_list(ShRegExp)]})
|
-spec sh_to_awk(binary()) -> binary().
|
||||||
of
|
sh_to_awk(Sh) ->
|
||||||
A -> iolist_to_binary(A)
|
iolist_to_binary([<<"^(">>, sh_to_awk_1(Sh)]). %Fix the beginning
|
||||||
end.
|
|
||||||
|
sh_to_awk_1(<<"*", Sh/binary>>) -> %This matches any string
|
||||||
|
[<<".*">>, sh_to_awk_1(Sh)];
|
||||||
|
sh_to_awk_1(<<"?", Sh/binary>>) -> %This matches any character
|
||||||
|
[$., sh_to_awk_1(Sh)];
|
||||||
|
sh_to_awk_1(<<"[^]", Sh/binary>>) -> %This takes careful handling
|
||||||
|
[<<"\\^">>, sh_to_awk_1(Sh)];
|
||||||
|
%% Must move '^' to end.
|
||||||
|
sh_to_awk_1(<<"[^", Sh/binary>>) ->
|
||||||
|
[$[, sh_to_awk_2(Sh, true)];
|
||||||
|
sh_to_awk_1(<<"[!", Sh/binary>>) ->
|
||||||
|
[<<"[^">>, sh_to_awk_2(Sh, false)];
|
||||||
|
sh_to_awk_1(<<"[", Sh/binary>>) ->
|
||||||
|
[$[, sh_to_awk_2(Sh, false)];
|
||||||
|
sh_to_awk_1(<<C:8, Sh/binary>>) -> %% Unspecialise everything else which is not an escape character.
|
||||||
|
case sh_special_char(C) of
|
||||||
|
true -> [$\\,C|sh_to_awk_1(Sh)];
|
||||||
|
false -> [C|sh_to_awk_1(Sh)]
|
||||||
|
end;
|
||||||
|
sh_to_awk_1(<<>>) ->
|
||||||
|
<<")$">>. %Fix the end
|
||||||
|
|
||||||
|
sh_to_awk_2(<<"]", Sh/binary>>, UpArrow) ->
|
||||||
|
[$]|sh_to_awk_3(Sh, UpArrow)];
|
||||||
|
sh_to_awk_2(Sh, UpArrow) ->
|
||||||
|
sh_to_awk_3(Sh, UpArrow).
|
||||||
|
|
||||||
|
sh_to_awk_3(<<"]", Sh/binary>>, true) ->
|
||||||
|
[<<"^]">>, sh_to_awk_1(Sh)];
|
||||||
|
sh_to_awk_3(<<"]", Sh/binary>>, false) ->
|
||||||
|
[$]|sh_to_awk_1(Sh)];
|
||||||
|
sh_to_awk_3(<<C:8, Sh/binary>>, UpArrow) ->
|
||||||
|
[C|sh_to_awk_3(Sh, UpArrow)];
|
||||||
|
sh_to_awk_3(<<>>, true) ->
|
||||||
|
[$^|sh_to_awk_1([])];
|
||||||
|
sh_to_awk_3(<<>>, false) ->
|
||||||
|
sh_to_awk_1([]).
|
||||||
|
|
||||||
|
%% -type sh_special_char(char()) -> bool().
|
||||||
|
%% Test if a character is a special character.
|
||||||
|
|
||||||
|
sh_special_char($|) -> true;
|
||||||
|
sh_special_char($*) -> true;
|
||||||
|
sh_special_char($+) -> true;
|
||||||
|
sh_special_char($?) -> true;
|
||||||
|
sh_special_char($() -> true;
|
||||||
|
sh_special_char($)) -> true;
|
||||||
|
sh_special_char($\\) -> true;
|
||||||
|
sh_special_char($^) -> true;
|
||||||
|
sh_special_char($$) -> true;
|
||||||
|
sh_special_char($.) -> true;
|
||||||
|
sh_special_char($[) -> true;
|
||||||
|
sh_special_char($]) -> true;
|
||||||
|
sh_special_char($") -> true;
|
||||||
|
sh_special_char(_C) -> false.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user