[Pkg-erlang-commits] r1383 - yaws/trunk/debian/patches

sgolovan at alioth.debian.org sgolovan at alioth.debian.org
Fri Dec 23 13:27:00 UTC 2011


Author: sgolovan
Date: 2011-12-23 13:26:59 +0000 (Fri, 23 Dec 2011)
New Revision: 1383

Added:
   yaws/trunk/debian/patches/mailr15.diff
   yaws/trunk/debian/patches/wikir15.diff
Removed:
   yaws/trunk/debian/patches/mailr15.patch
   yaws/trunk/debian/patches/wikir15.patch
Log:
[yaws]
  * Renamed patches in line with the others.


Copied: yaws/trunk/debian/patches/mailr15.diff (from rev 1382, yaws/trunk/debian/patches/mailr15.patch)
===================================================================
--- yaws/trunk/debian/patches/mailr15.diff	                        (rev 0)
+++ yaws/trunk/debian/patches/mailr15.diff	2011-12-23 13:26:59 UTC (rev 1383)
@@ -0,0 +1,111 @@
+Patch fixes incompatibilities with Erlang R15B in mail example application.
+
+--- yaws-1.91.orig/applications/mail/src/smtp.erl
++++ yaws-1.91/applications/mail/src/smtp.erl
+@@ -256,7 +256,7 @@
+ e(X) when X >= 52, X < 62 -> X + $0 - 52;
+ e(62) -> $+;
+ e(63) -> $/;
+-e(X) -> erlang:fault({badchar,X}).
++e(X) -> erlang:error({badchar,X}).
+ 
+ 
+ %%
+--- yaws-1.91.orig/applications/mail/src/mail.erl
++++ yaws-1.91/applications/mail/src/mail.erl
+@@ -716,7 +716,7 @@
+     end.
+ 
+ 
+-sort_href(Sort, Cur, Text) when atom(Cur) ->
++sort_href(Sort, Cur, Text) when is_atom(Cur) ->
+     sort_href(Sort, atom_to_list(Cur), Text);
+ sort_href(Sort, Sort, Text) ->
+     [{a, [{href,"mail.yaws?sort=rev_"++Sort}], Text},
+@@ -1756,7 +1756,7 @@
+     dot_unescape(Rest, false, Acc);
+ dot_unescape([$\n|Rest], _, Acc) ->
+     dot_unescape(Rest, true, [$\n|Acc]);
+-dot_unescape([L|Rest], NL, Acc) when list(L) ->
++dot_unescape([L|Rest], NL, Acc) when is_list(L) ->
+     {NL2, L2} = dot_unescape(L, NL, []),
+     dot_unescape(Rest, NL2, [L2|Acc]);
+ dot_unescape([C|Rest], _, Acc) ->
+@@ -1947,7 +1947,7 @@
+ e(X) when X >= 52, X < 62 -> X + $0 - 52;
+ e(62) -> $+;
+ e(63) -> $/;
+-e(X) -> erlang:fault({badchar,X}).
++e(X) -> erlang:error({badchar,X}).
+ 
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ 
+@@ -2026,9 +2026,9 @@
+ 
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ 
+-to_string(Atom) when atom(Atom) ->
++to_string(Atom) when is_atom(Atom) ->
+     atom_to_list(Atom);
+-to_string(Integer) when integer(Integer) ->
++to_string(Integer) when is_integer(Integer) ->
+     integer_to_list(Integer);
+ to_string(List) -> List.
+ 
+@@ -2328,7 +2328,7 @@
+ 
+ include_quote([], Acc, Prefix, State) ->
+     {Acc, State};
+-include_quote([L|Text], Acc, Prefix, State) when list(L) ->
++include_quote([L|Text], Acc, Prefix, State) when is_list(L) ->
+     {Acc1, State1} = include_quote(L, Acc, Prefix, State),
+     include_quote(Text, Acc1, Prefix, State1);
+ include_quote(Text, Acc, Prefix, nl) ->
+@@ -2509,10 +2509,10 @@
+ wrap_text([], Cont, Unwrapped, Space, Col, Max, Acc) ->
+     wrap_text(Cont, [], Unwrapped, Space, Col, Max, Acc);
+ 
+-wrap_text([L|Rest], [], Unwrapped, Space, Col, Max, Acc) when list(L) ->
++wrap_text([L|Rest], [], Unwrapped, Space, Col, Max, Acc) when is_list(L) ->
+     wrap_text(L, Rest, Unwrapped, Space, Col, Max, Acc);
+ 
+-wrap_text([L|Rest], Cont, Unwrapped, Space, Col, Max, Acc) when list(L) ->
++wrap_text([L|Rest], Cont, Unwrapped, Space, Col, Max, Acc) when is_list(L) ->
+     wrap_text(L, [Rest|Cont], Unwrapped, Space, Col, Max, Acc);
+ 
+ wrap_text([C|Rest], Cont, Unwrapped, Space, Col, Max, Acc) when Col < Max ->
+@@ -2645,9 +2645,9 @@
+ parse_date(Date) ->
+     D = parse_date(Date, #date{}),
+     if
+-        integer(D#date.year),integer(D#date.month),
+-        integer(D#date.day),integer(D#date.hours),
+-        integer(D#date.minutes),integer(D#date.seconds) ->
++        is_integer(D#date.year),is_integer(D#date.month),
++        is_integer(D#date.day),is_integer(D#date.hours),
++        is_integer(D#date.minutes),is_integer(D#date.seconds) ->
+             {{D#date.year, D#date.month, D#date.day},
+              {D#date.hours, D#date.minutes, D#date.seconds}};
+         true -> error
+@@ -2739,9 +2739,9 @@
+                 {Hour, Minutes, Seconds, R3}
+         end,
+     case catch F() of
+-        {Hour, Minutes, Seconds, Rest} when integer(Hour),
+-                                      integer(Minutes),
+-                                      integer(Seconds) ->
++        {Hour, Minutes, Seconds, Rest} when is_integer(Hour),
++                                      is_integer(Minutes),
++                                      is_integer(Seconds) ->
+             {Hour, Minutes, Seconds, Rest};
+         _ -> error
+     end.
+@@ -2750,7 +2750,7 @@
+     M = enc_month(Month),
+     io_lib:format("~2..0w ~s ~4..0w ~2..0w:~2..0w:~2..0w",
+                   [Day, M, Year, Hour, Minutes, Seconds]);
+-format_date(Seconds) when integer(Seconds) ->
++format_date(Seconds) when is_integer(Seconds) ->
+     Zero = calendar:datetime_to_gregorian_seconds({{1970,1,1},{0,0,0}}),
+     Time = Zero + Seconds,
+     Date = calendar:gregorian_seconds_to_datetime(Time),

Deleted: yaws/trunk/debian/patches/mailr15.patch
===================================================================
--- yaws/trunk/debian/patches/mailr15.patch	2011-12-23 13:20:47 UTC (rev 1382)
+++ yaws/trunk/debian/patches/mailr15.patch	2011-12-23 13:26:59 UTC (rev 1383)
@@ -1,111 +0,0 @@
-Patch fixes incompatibilities with Erlang R15B in mail example application.
-
---- yaws-1.91.orig/applications/mail/src/smtp.erl
-+++ yaws-1.91/applications/mail/src/smtp.erl
-@@ -256,7 +256,7 @@
- e(X) when X >= 52, X < 62 -> X + $0 - 52;
- e(62) -> $+;
- e(63) -> $/;
--e(X) -> erlang:fault({badchar,X}).
-+e(X) -> erlang:error({badchar,X}).
- 
- 
- %%
---- yaws-1.91.orig/applications/mail/src/mail.erl
-+++ yaws-1.91/applications/mail/src/mail.erl
-@@ -716,7 +716,7 @@
-     end.
- 
- 
--sort_href(Sort, Cur, Text) when atom(Cur) ->
-+sort_href(Sort, Cur, Text) when is_atom(Cur) ->
-     sort_href(Sort, atom_to_list(Cur), Text);
- sort_href(Sort, Sort, Text) ->
-     [{a, [{href,"mail.yaws?sort=rev_"++Sort}], Text},
-@@ -1756,7 +1756,7 @@
-     dot_unescape(Rest, false, Acc);
- dot_unescape([$\n|Rest], _, Acc) ->
-     dot_unescape(Rest, true, [$\n|Acc]);
--dot_unescape([L|Rest], NL, Acc) when list(L) ->
-+dot_unescape([L|Rest], NL, Acc) when is_list(L) ->
-     {NL2, L2} = dot_unescape(L, NL, []),
-     dot_unescape(Rest, NL2, [L2|Acc]);
- dot_unescape([C|Rest], _, Acc) ->
-@@ -1947,7 +1947,7 @@
- e(X) when X >= 52, X < 62 -> X + $0 - 52;
- e(62) -> $+;
- e(63) -> $/;
--e(X) -> erlang:fault({badchar,X}).
-+e(X) -> erlang:error({badchar,X}).
- 
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- 
-@@ -2026,9 +2026,9 @@
- 
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- 
--to_string(Atom) when atom(Atom) ->
-+to_string(Atom) when is_atom(Atom) ->
-     atom_to_list(Atom);
--to_string(Integer) when integer(Integer) ->
-+to_string(Integer) when is_integer(Integer) ->
-     integer_to_list(Integer);
- to_string(List) -> List.
- 
-@@ -2328,7 +2328,7 @@
- 
- include_quote([], Acc, Prefix, State) ->
-     {Acc, State};
--include_quote([L|Text], Acc, Prefix, State) when list(L) ->
-+include_quote([L|Text], Acc, Prefix, State) when is_list(L) ->
-     {Acc1, State1} = include_quote(L, Acc, Prefix, State),
-     include_quote(Text, Acc1, Prefix, State1);
- include_quote(Text, Acc, Prefix, nl) ->
-@@ -2509,10 +2509,10 @@
- wrap_text([], Cont, Unwrapped, Space, Col, Max, Acc) ->
-     wrap_text(Cont, [], Unwrapped, Space, Col, Max, Acc);
- 
--wrap_text([L|Rest], [], Unwrapped, Space, Col, Max, Acc) when list(L) ->
-+wrap_text([L|Rest], [], Unwrapped, Space, Col, Max, Acc) when is_list(L) ->
-     wrap_text(L, Rest, Unwrapped, Space, Col, Max, Acc);
- 
--wrap_text([L|Rest], Cont, Unwrapped, Space, Col, Max, Acc) when list(L) ->
-+wrap_text([L|Rest], Cont, Unwrapped, Space, Col, Max, Acc) when is_list(L) ->
-     wrap_text(L, [Rest|Cont], Unwrapped, Space, Col, Max, Acc);
- 
- wrap_text([C|Rest], Cont, Unwrapped, Space, Col, Max, Acc) when Col < Max ->
-@@ -2645,9 +2645,9 @@
- parse_date(Date) ->
-     D = parse_date(Date, #date{}),
-     if
--        integer(D#date.year),integer(D#date.month),
--        integer(D#date.day),integer(D#date.hours),
--        integer(D#date.minutes),integer(D#date.seconds) ->
-+        is_integer(D#date.year),is_integer(D#date.month),
-+        is_integer(D#date.day),is_integer(D#date.hours),
-+        is_integer(D#date.minutes),is_integer(D#date.seconds) ->
-             {{D#date.year, D#date.month, D#date.day},
-              {D#date.hours, D#date.minutes, D#date.seconds}};
-         true -> error
-@@ -2739,9 +2739,9 @@
-                 {Hour, Minutes, Seconds, R3}
-         end,
-     case catch F() of
--        {Hour, Minutes, Seconds, Rest} when integer(Hour),
--                                      integer(Minutes),
--                                      integer(Seconds) ->
-+        {Hour, Minutes, Seconds, Rest} when is_integer(Hour),
-+                                      is_integer(Minutes),
-+                                      is_integer(Seconds) ->
-             {Hour, Minutes, Seconds, Rest};
-         _ -> error
-     end.
-@@ -2750,7 +2750,7 @@
-     M = enc_month(Month),
-     io_lib:format("~2..0w ~s ~4..0w ~2..0w:~2..0w:~2..0w",
-                   [Day, M, Year, Hour, Minutes, Seconds]);
--format_date(Seconds) when integer(Seconds) ->
-+format_date(Seconds) when is_integer(Seconds) ->
-     Zero = calendar:datetime_to_gregorian_seconds({{1970,1,1},{0,0,0}}),
-     Time = Zero + Seconds,
-     Date = calendar:gregorian_seconds_to_datetime(Time),

Copied: yaws/trunk/debian/patches/wikir15.diff (from rev 1382, yaws/trunk/debian/patches/wikir15.patch)
===================================================================
--- yaws/trunk/debian/patches/wikir15.diff	                        (rev 0)
+++ yaws/trunk/debian/patches/wikir15.diff	2011-12-23 13:26:59 UTC (rev 1383)
@@ -0,0 +1,267 @@
+Patch fixes incompatibilities with Erlang R15B for wiki example application.
+
+--- yaws-1.91.orig/applications/wiki/src/wiki_format_txt.erl
++++ yaws-1.91/applications/wiki/src/wiki_format_txt.erl
+@@ -300,7 +300,7 @@
+ 
+ parse_date([], D) ->
+     Entries = tl(tuple_to_list(D)),
+-    AllDone = lists:all(fun(X) -> if integer(X) -> true;
++    AllDone = lists:all(fun(X) -> if is_integer(X) -> true;
+                                      true -> false
+                                   end
+                         end, Entries),
+@@ -408,9 +408,9 @@
+                 {Hour, Minutes, Seconds, R3}
+         end,
+     case catch F() of
+-        {Hour, Minutes, Seconds, Rest} when integer(Hour),
+-                                      integer(Minutes),
+-                                      integer(Seconds) ->
++        {Hour, Minutes, Seconds, Rest} when is_integer(Hour),
++                                      is_integer(Minutes),
++                                      is_integer(Seconds) ->
+             {Hour, Minutes, Seconds, Rest};
+         _ -> error
+     end.
+--- yaws-1.91.orig/applications/wiki/src/wiki_yaws.erl
++++ yaws-1.91/applications/wiki/src/wiki_yaws.erl
+@@ -47,7 +47,7 @@
+ parse_post([{Name, Value}|Rest], Acc) ->
+     parse_post(Rest, [{to_string(Name), Value, []}|Acc]).
+ 
+-to_string(Atom) when atom(Atom) ->
++to_string(Atom) when is_atom(Atom) ->
+     atom_to_list(Atom);
+ to_string(String) ->
+     String.
+--- yaws-1.91.orig/applications/wiki/src/wiki.erl
++++ yaws-1.91/applications/wiki/src/wiki.erl
+@@ -55,7 +55,7 @@
+     Page = getopt("node", Params),
+     if
+         Page == undefined ->
+-            error(invalid_request);
++            html_error(invalid_request);
+         true ->
+             {WobFile, FileDir} = page2filename(Page, Root),
+             case file:read_file(WobFile) of
+@@ -105,7 +105,7 @@
+     Pict = getopt("pict", Params),
+     if
+         Page == undefined ->
+-            error(invalid_request);
++            html_error(invalid_request);
+         true ->
+             {WobFile, FileDir} = page2filename(Page, Root),
+             ThumbName = thumb_name(Pict),
+@@ -125,7 +125,7 @@
+     Pict = getopt("pict", Params),
+     if
+         Page == undefined ->
+-            error(invalid_request);
++            html_error(invalid_request);
+         true ->
+             {WobFile, FileDir} = page2filename(Page, Root),
+             Extension = filename:extension(Pict),
+@@ -170,7 +170,7 @@
+     Page = getopt("node", Params),
+     if
+         Page == undefined ->
+-            error(invalid_request);
++            html_error(invalid_request);
+         true ->
+             importFiles(Page, Root, Prefix)
+     end.
+@@ -182,7 +182,7 @@
+             {wik002, Pwd,Email,Time,Who,TxtStr,Files,Patches} =
+                 bin_to_wik002(Root,FileDir,Bin),
+ 
+-            CurFiles = files(Root++"/"++FileDir, "*"),
++            CurFiles = files(Root++"/"++FileDir, "^"),
+ 
+             CurFileNames = [basename(CF) || CF <- CurFiles,
+                                             string:str(CF,"_wiki_thb")==0,
+@@ -215,7 +215,7 @@
+             {wik002, Pwd, Email, Time, Who, TxtStr, Files, Patches} =
+                 bin_to_wik002(Bin),
+ 
+-            CurFiles = files(FileDir, "*"),
++            CurFiles = files(FileDir, "^"),
+ 
+             CurFileNames = [basename(CF) || CF <- CurFiles],
+ 
+@@ -854,7 +854,7 @@
+     CpList = [input("hidden", "cp_"++Name, Name) ||
+                  {file, Name, _, _} <- CpFiles],
+ 
+-    PageFiles = sort(files(Root, "*.wob")),
++    PageFiles = sort(files(Root, "\\.wob$")),
+     Pages = [filename:basename(P,".wob") || P <- PageFiles, P /= File],
+ 
+     if
+@@ -1005,7 +1005,7 @@
+      i2s(Hour),":",i2s(Min),":",i2s(Sec)].
+ 
+ allPages(_, Root, Prefix) ->
+-    Files = sort(files(Root, "*.wob")),
++    Files = sort(files(Root, "\\.wob$")),
+     template2(Root, "All Pages", "All Pages",
+              [p("This is a list of all pages known to the system."),
+               lists:map(fun(I) ->
+@@ -1016,7 +1016,7 @@
+                         Files)], false).
+ 
+ lastEdited(_, Root, Prefix) ->
+-    Files = sort(files(Root, "*.wob")),
++    Files = sort(files(Root, "\\.wob$")),
+     S = lists:flatten(lists:map(fun(I) ->
+                                   "~" ++ filename:basename(I, ".wob") ++"\n\n"
+                           end, Files)),
+@@ -1155,7 +1155,7 @@
+     {File,FileDir} = page2filename(Page, Root),
+     case file:delete(File) of
+         ok ->
+-            Files = files(Root++"/"++FileDir, "*"),
++            Files = files(Root++"/"++FileDir, "^"),
+             [file:delete(F) || F <- Files],
+             file:del_dir(Root++"/"++FileDir),
+             redirect({node, "home"}, Prefix);
+@@ -1533,19 +1533,19 @@
+         {undefined, undefined, _} ->
+             Index = case catch list_to_integer(AutoArg) of
+                         {'EXIT', Reason} -> 1;
+-                        Num when integer(Num) -> Num
++                        Num when is_integer(Num) -> Num
+                     end,
+             nextSlide(Index, auto, Page, Root, Prefix);
+         {undefined, _, undefined} ->
+             Index = case catch list_to_integer(PrevArg) of
+                         {'EXIT', Reason} -> 1;
+-                        Num when integer(Num) -> Num
++                        Num when is_integer(Num) -> Num
+                     end,
+             nextSlide(Index, prev, Page, Root, Prefix);
+         {_, undefined, undefined} ->
+             Index = case catch list_to_integer(NextArg) of
+                         {'EXIT', Reason} -> 1;
+-                        Num when integer(Num) -> Num
++                        Num when is_integer(Num) -> Num
+                     end,
+             nextSlide(Index, next, Page, Root, Prefix)
+     end.
+@@ -1968,7 +1968,7 @@
+ 
+ 
+ ls(Root) ->
+-    Files = files(Root, "*.wob"),
++    Files = files(Root, "\\.wob$"),
+     lists:map(fun(I) -> filename:basename(I, ".wob") end, Files).
+ 
+ %%
+@@ -1979,7 +1979,7 @@
+ 
+ %%
+ 
+-error(invalid_request) ->
++html_error(invalid_request) ->
+     {html, "invalid request"}.
+ 
+ %%
+@@ -2008,7 +2008,7 @@
+ 
+ get_wiki_files(Root, FileDir) ->
+     Dir = Root ++ "/" ++ FileDir,
+-    files(Dir, "*").
++    files(Dir, "^").
+ 
+ %%
+ 
+@@ -2278,8 +2278,12 @@
+ %% MR: Is this really necessary ?
+ %%     We can now use filelib:fold_files/5
+ files(Dir, Re) ->
+-    Re1 = regexp:sh_to_awk(Re),
+-    find_files(Dir, Re1, []).
++    case re:compile(Re) of
++	{ok, Re1} ->
++	    find_files(Dir, Re1, []);
++	_ ->
++	    []
++    end.
+ 
+ find_files(Dir, Re, L) ->
+     case file:list_dir(Dir) of
+@@ -2291,8 +2295,8 @@
+     FullName = Dir ++  [$/|File],
+     case file_type(FullName) of
+         regular ->
+-            case regexp:match(FullName, Re) of
+-                {match, _, _}  ->
++            case re:run(FullName, Re) of
++                {match, _}  ->
+                     find_files(T, Dir, Re, [FullName|L]);
+                 _ ->
+                     find_files(T, Dir, Re, L)
+@@ -2380,7 +2384,7 @@
+             end
+     end.
+ 
+-getopt_options(Key, KeyList) when atom(Key) ->
++getopt_options(Key, KeyList) when is_atom(Key) ->
+     getopt_options(atom_to_list(Key), KeyList);
+ getopt_options(Key, KeyList) ->
+     case lists:keysearch(Key, 1, KeyList) of
+@@ -2419,7 +2423,7 @@
+ 
+ %%
+ 
+-tostring(A) when atom(A) ->
++tostring(A) when is_atom(A) ->
+     atom_to_list(A);
+ tostring(S) ->
+     S.
+@@ -2443,7 +2447,7 @@
+         {"search", undefined, []} ->
+             [];
+         {"search", Search, []} ->
+-            case regexp:parse(Search) of
++            case re:compile(Search) of
+                 {ok, RE} ->
+                     Search;
+                 {error, Error} ->
+@@ -2476,7 +2480,7 @@
+                           [Error]))],
+                       false);
+         Search ->
+-            Files = sort(files(Root, "*.wob")),
++            Files = sort(files(Root, "\\.wob$")),
+             {Sres, _S} = lists:mapfoldl(fun(F, S) ->
+                                                 {searchPage(F, S), S} end,
+                                         Search, Files),
+@@ -2501,7 +2505,7 @@
+         {ok, Bin} ->
+             {wik002,_Pwd,_Email,_Time,_Who,Txt,_Files,_Patches} =
+                 bin_to_wik002(Bin),
+-            {match, Matches} = regexp:matches(Txt, Search),
++            {match, Matches} = re:run(Txt, Search),
+             {length(Matches), File};
+         _ ->
+             io:format("Error - failed to open ~s\n", [File]),
+--- yaws-1.91.orig/applications/wiki/src/utils.erl
++++ yaws-1.91/applications/wiki/src/utils.erl
+@@ -51,11 +51,11 @@
+ %% Wrapper for the original fold_files/5 behaviour.
+ 
+ fold_files(Dir, RegExp, Recursive, Fun, InitialAcc) ->
+-    {ok, CompiledRegExp} = regexp:parse(RegExp),
++    {ok, CompiledRegExp} = re:compile(RegExp),
+     Wrapper = fun
+                   (FullName, false, Acc) ->
+-                      NewAcc = case regexp:match(FullName, CompiledRegExp) of
+-                                   {match, _, _}  ->
++                      NewAcc = case re:run(FullName, CompiledRegExp) of
++                                   {match, _}  ->
+                                        Fun(FullName, Acc);
+                                    _ ->
+                                        Acc

Deleted: yaws/trunk/debian/patches/wikir15.patch
===================================================================
--- yaws/trunk/debian/patches/wikir15.patch	2011-12-23 13:20:47 UTC (rev 1382)
+++ yaws/trunk/debian/patches/wikir15.patch	2011-12-23 13:26:59 UTC (rev 1383)
@@ -1,267 +0,0 @@
-Patch fixes incompatibilities with Erlang R15B for wiki example application.
-
---- yaws-1.91.orig/applications/wiki/src/wiki_format_txt.erl
-+++ yaws-1.91/applications/wiki/src/wiki_format_txt.erl
-@@ -300,7 +300,7 @@
- 
- parse_date([], D) ->
-     Entries = tl(tuple_to_list(D)),
--    AllDone = lists:all(fun(X) -> if integer(X) -> true;
-+    AllDone = lists:all(fun(X) -> if is_integer(X) -> true;
-                                      true -> false
-                                   end
-                         end, Entries),
-@@ -408,9 +408,9 @@
-                 {Hour, Minutes, Seconds, R3}
-         end,
-     case catch F() of
--        {Hour, Minutes, Seconds, Rest} when integer(Hour),
--                                      integer(Minutes),
--                                      integer(Seconds) ->
-+        {Hour, Minutes, Seconds, Rest} when is_integer(Hour),
-+                                      is_integer(Minutes),
-+                                      is_integer(Seconds) ->
-             {Hour, Minutes, Seconds, Rest};
-         _ -> error
-     end.
---- yaws-1.91.orig/applications/wiki/src/wiki_yaws.erl
-+++ yaws-1.91/applications/wiki/src/wiki_yaws.erl
-@@ -47,7 +47,7 @@
- parse_post([{Name, Value}|Rest], Acc) ->
-     parse_post(Rest, [{to_string(Name), Value, []}|Acc]).
- 
--to_string(Atom) when atom(Atom) ->
-+to_string(Atom) when is_atom(Atom) ->
-     atom_to_list(Atom);
- to_string(String) ->
-     String.
---- yaws-1.91.orig/applications/wiki/src/wiki.erl
-+++ yaws-1.91/applications/wiki/src/wiki.erl
-@@ -55,7 +55,7 @@
-     Page = getopt("node", Params),
-     if
-         Page == undefined ->
--            error(invalid_request);
-+            html_error(invalid_request);
-         true ->
-             {WobFile, FileDir} = page2filename(Page, Root),
-             case file:read_file(WobFile) of
-@@ -105,7 +105,7 @@
-     Pict = getopt("pict", Params),
-     if
-         Page == undefined ->
--            error(invalid_request);
-+            html_error(invalid_request);
-         true ->
-             {WobFile, FileDir} = page2filename(Page, Root),
-             ThumbName = thumb_name(Pict),
-@@ -125,7 +125,7 @@
-     Pict = getopt("pict", Params),
-     if
-         Page == undefined ->
--            error(invalid_request);
-+            html_error(invalid_request);
-         true ->
-             {WobFile, FileDir} = page2filename(Page, Root),
-             Extension = filename:extension(Pict),
-@@ -170,7 +170,7 @@
-     Page = getopt("node", Params),
-     if
-         Page == undefined ->
--            error(invalid_request);
-+            html_error(invalid_request);
-         true ->
-             importFiles(Page, Root, Prefix)
-     end.
-@@ -182,7 +182,7 @@
-             {wik002, Pwd,Email,Time,Who,TxtStr,Files,Patches} =
-                 bin_to_wik002(Root,FileDir,Bin),
- 
--            CurFiles = files(Root++"/"++FileDir, "*"),
-+            CurFiles = files(Root++"/"++FileDir, "^"),
- 
-             CurFileNames = [basename(CF) || CF <- CurFiles,
-                                             string:str(CF,"_wiki_thb")==0,
-@@ -215,7 +215,7 @@
-             {wik002, Pwd, Email, Time, Who, TxtStr, Files, Patches} =
-                 bin_to_wik002(Bin),
- 
--            CurFiles = files(FileDir, "*"),
-+            CurFiles = files(FileDir, "^"),
- 
-             CurFileNames = [basename(CF) || CF <- CurFiles],
- 
-@@ -854,7 +854,7 @@
-     CpList = [input("hidden", "cp_"++Name, Name) ||
-                  {file, Name, _, _} <- CpFiles],
- 
--    PageFiles = sort(files(Root, "*.wob")),
-+    PageFiles = sort(files(Root, "\\.wob$")),
-     Pages = [filename:basename(P,".wob") || P <- PageFiles, P /= File],
- 
-     if
-@@ -1005,7 +1005,7 @@
-      i2s(Hour),":",i2s(Min),":",i2s(Sec)].
- 
- allPages(_, Root, Prefix) ->
--    Files = sort(files(Root, "*.wob")),
-+    Files = sort(files(Root, "\\.wob$")),
-     template2(Root, "All Pages", "All Pages",
-              [p("This is a list of all pages known to the system."),
-               lists:map(fun(I) ->
-@@ -1016,7 +1016,7 @@
-                         Files)], false).
- 
- lastEdited(_, Root, Prefix) ->
--    Files = sort(files(Root, "*.wob")),
-+    Files = sort(files(Root, "\\.wob$")),
-     S = lists:flatten(lists:map(fun(I) ->
-                                   "~" ++ filename:basename(I, ".wob") ++"\n\n"
-                           end, Files)),
-@@ -1155,7 +1155,7 @@
-     {File,FileDir} = page2filename(Page, Root),
-     case file:delete(File) of
-         ok ->
--            Files = files(Root++"/"++FileDir, "*"),
-+            Files = files(Root++"/"++FileDir, "^"),
-             [file:delete(F) || F <- Files],
-             file:del_dir(Root++"/"++FileDir),
-             redirect({node, "home"}, Prefix);
-@@ -1533,19 +1533,19 @@
-         {undefined, undefined, _} ->
-             Index = case catch list_to_integer(AutoArg) of
-                         {'EXIT', Reason} -> 1;
--                        Num when integer(Num) -> Num
-+                        Num when is_integer(Num) -> Num
-                     end,
-             nextSlide(Index, auto, Page, Root, Prefix);
-         {undefined, _, undefined} ->
-             Index = case catch list_to_integer(PrevArg) of
-                         {'EXIT', Reason} -> 1;
--                        Num when integer(Num) -> Num
-+                        Num when is_integer(Num) -> Num
-                     end,
-             nextSlide(Index, prev, Page, Root, Prefix);
-         {_, undefined, undefined} ->
-             Index = case catch list_to_integer(NextArg) of
-                         {'EXIT', Reason} -> 1;
--                        Num when integer(Num) -> Num
-+                        Num when is_integer(Num) -> Num
-                     end,
-             nextSlide(Index, next, Page, Root, Prefix)
-     end.
-@@ -1968,7 +1968,7 @@
- 
- 
- ls(Root) ->
--    Files = files(Root, "*.wob"),
-+    Files = files(Root, "\\.wob$"),
-     lists:map(fun(I) -> filename:basename(I, ".wob") end, Files).
- 
- %%
-@@ -1979,7 +1979,7 @@
- 
- %%
- 
--error(invalid_request) ->
-+html_error(invalid_request) ->
-     {html, "invalid request"}.
- 
- %%
-@@ -2008,7 +2008,7 @@
- 
- get_wiki_files(Root, FileDir) ->
-     Dir = Root ++ "/" ++ FileDir,
--    files(Dir, "*").
-+    files(Dir, "^").
- 
- %%
- 
-@@ -2278,8 +2278,12 @@
- %% MR: Is this really necessary ?
- %%     We can now use filelib:fold_files/5
- files(Dir, Re) ->
--    Re1 = regexp:sh_to_awk(Re),
--    find_files(Dir, Re1, []).
-+    case re:compile(Re) of
-+	{ok, Re1} ->
-+	    find_files(Dir, Re1, []);
-+	_ ->
-+	    []
-+    end.
- 
- find_files(Dir, Re, L) ->
-     case file:list_dir(Dir) of
-@@ -2291,8 +2295,8 @@
-     FullName = Dir ++  [$/|File],
-     case file_type(FullName) of
-         regular ->
--            case regexp:match(FullName, Re) of
--                {match, _, _}  ->
-+            case re:run(FullName, Re) of
-+                {match, _}  ->
-                     find_files(T, Dir, Re, [FullName|L]);
-                 _ ->
-                     find_files(T, Dir, Re, L)
-@@ -2380,7 +2384,7 @@
-             end
-     end.
- 
--getopt_options(Key, KeyList) when atom(Key) ->
-+getopt_options(Key, KeyList) when is_atom(Key) ->
-     getopt_options(atom_to_list(Key), KeyList);
- getopt_options(Key, KeyList) ->
-     case lists:keysearch(Key, 1, KeyList) of
-@@ -2419,7 +2423,7 @@
- 
- %%
- 
--tostring(A) when atom(A) ->
-+tostring(A) when is_atom(A) ->
-     atom_to_list(A);
- tostring(S) ->
-     S.
-@@ -2443,7 +2447,7 @@
-         {"search", undefined, []} ->
-             [];
-         {"search", Search, []} ->
--            case regexp:parse(Search) of
-+            case re:compile(Search) of
-                 {ok, RE} ->
-                     Search;
-                 {error, Error} ->
-@@ -2476,7 +2480,7 @@
-                           [Error]))],
-                       false);
-         Search ->
--            Files = sort(files(Root, "*.wob")),
-+            Files = sort(files(Root, "\\.wob$")),
-             {Sres, _S} = lists:mapfoldl(fun(F, S) ->
-                                                 {searchPage(F, S), S} end,
-                                         Search, Files),
-@@ -2501,7 +2505,7 @@
-         {ok, Bin} ->
-             {wik002,_Pwd,_Email,_Time,_Who,Txt,_Files,_Patches} =
-                 bin_to_wik002(Bin),
--            {match, Matches} = regexp:matches(Txt, Search),
-+            {match, Matches} = re:run(Txt, Search),
-             {length(Matches), File};
-         _ ->
-             io:format("Error - failed to open ~s\n", [File]),
---- yaws-1.91.orig/applications/wiki/src/utils.erl
-+++ yaws-1.91/applications/wiki/src/utils.erl
-@@ -51,11 +51,11 @@
- %% Wrapper for the original fold_files/5 behaviour.
- 
- fold_files(Dir, RegExp, Recursive, Fun, InitialAcc) ->
--    {ok, CompiledRegExp} = regexp:parse(RegExp),
-+    {ok, CompiledRegExp} = re:compile(RegExp),
-     Wrapper = fun
-                   (FullName, false, Acc) ->
--                      NewAcc = case regexp:match(FullName, CompiledRegExp) of
--                                   {match, _, _}  ->
-+                      NewAcc = case re:run(FullName, CompiledRegExp) of
-+                                   {match, _}  ->
-                                        Fun(FullName, Acc);
-                                    _ ->
-                                        Acc




More information about the Pkg-erlang-commits mailing list