[packages] multimedia/ushare: Add a UCI aware init script + config file
[openwrt/svn-archive/archive.git] / lang / luaposix / patches / 200-crypt.patch
1 --- a/lposix.c
2 +++ b/lposix.c
3 @@ -1016,6 +1016,29 @@
4 }
5 #endif
6
7 +/*
8 + * XXX: GNU and BSD handle the forward declaration of crypt() in different
9 + * and annoying ways (especially GNU). Declare it here just to make sure
10 + * that it's there
11 + */
12 +char *crypt(const char *, const char *);
13 +
14 +static int Pcrypt(lua_State *L)
15 +{
16 + const char *str, *salt;
17 + char *res;
18 +
19 + str = luaL_checkstring(L, 1);
20 + salt = luaL_checkstring(L, 2);
21 + if (strlen(salt) < 2)
22 + luaL_error(L, "not enough salt");
23 +
24 + res = crypt(str, salt);
25 + lua_pushstring(L, res);
26 +
27 + return 1;
28 +}
29 +
30 static const luaL_reg R[] =
31 {
32 {"access", Paccess},
33 @@ -1023,6 +1046,7 @@
34 {"chdir", Pchdir},
35 {"chmod", Pchmod},
36 {"chown", Pchown},
37 + {"crypt", Pcrypt},
38 {"ctermid", Pctermid},
39 {"dirname", Pdirname},
40 {"dir", Pdir},
41 --- a/Makefile
42 +++ b/Makefile
43 @@ -37,8 +37,10 @@
44 OS=$(shell uname)
45 ifeq ($(OS),Darwin)
46 LDFLAGS_SHARED=-bundle -undefined dynamic_lookup
47 + LIBS=
48 else
49 LDFLAGS_SHARED=-shared
50 + LIBS=-lcrypt
51 endif
52
53 # targets
54 @@ -50,7 +52,7 @@
55 $(LUA) test.lua
56
57 $T: $(OBJS)
58 - $(CC) $(LDFLAGS) -o $@ $(LDFLAGS_SHARED) $(OBJS)
59 + $(CC) $(LDFLAGS) -o $@ $(LDFLAGS_SHARED) $(OBJS) $(LIBS)
60
61 $(OBJS): modemuncher.c
62