mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-25 12:04:47 +00:00
Remove mg_log_set_callback. Use MG_PUTCHAR macro instead
This commit is contained in:
1 parent
7c17c806ad
commit
7e2ca72310
15 files changed
+124
-188
No files matched your search
@@ -10,19 +10,19 @@ MINGW ?= $(DOCKER) mdashnet/mingw
|
||||
all: $(PROG)
|
||||
$(RUN) ./$(PROG)
|
||||
|
||||
$(PROG):
|
||||
$(PROG): $(SOURCES) $(FILES_TO_EMBED)
|
||||
$(CC) ../../test/pack.c -o pack
|
||||
./pack $(FILES_TO_EMBED) > packed_fs.c
|
||||
$(CC) -W -Wall -Wextra -O0 -g3 $(CFLAGS) -o $(PROG) $(SOURCES)
|
||||
|
||||
|
||||
mingw:
|
||||
mingw: $(SOURCES) $(FILES_TO_EMBED)
|
||||
$(MINGW) i686-w64-mingw32-gcc $(CFLAGS) ../../test/pack.c -o pack.exe
|
||||
$(MINGW) wine cmd /c 'pack.exe $(FILES_TO_EMBED) > packed_fs.c'
|
||||
$(MINGW) i686-w64-mingw32-gcc $(CFLAGS) $(SOURCES) -lws2_32 -o $(PROG).exe
|
||||
$(MINGW) wine $(PROG).exe
|
||||
|
||||
vc98:
|
||||
vc98: $(SOURCES) $(FILES_TO_EMBED)
|
||||
$(VC98) cl.exe /nologo $(CFLAGS) ../../test/pack.c /Fepack.exe
|
||||
$(VC98) cmd /c 'pack.exe $(FILES_TO_EMBED) > packed_fs.c'
|
||||
$(VC98) cl.exe /nologo /O2 $(CFLAGS) $(SOURCES) /Fe$(PROG).exe
|
||||
|
||||
@@ -639,11 +639,18 @@ static const unsigned char v2[] = {
|
||||
105, 103, 93, 32, 61, 32, 117, 115, 101, 83, 116, 97, // ig] = useSta
|
||||
116, 101, 40, 123, 125, 41, 59, 10, 10, 32, 32, 99, // te({});.. c
|
||||
111, 110, 115, 116, 32, 114, 101, 102, 114, 101, 115, 104, // onst refresh
|
||||
32, 61, 32, 40, 41, 32, 61, 62, 10, 32, 32, 32, // = () =>.
|
||||
32, 32, 32, 102, 101, 116, 99, 104, 40, 39, 47, 97, // fetch('/a
|
||||
112, 105, 47, 99, 111, 110, 102, 105, 103, 47, 103, 101, // pi/config/ge
|
||||
116, 39, 41, 46, 116, 104, 101, 110, 40, 114, 32, 61, // t').then(r =
|
||||
62, 32, 114, 46, 106, 115, 111, 110, 40, 41, 41, 46, // > r.json()).
|
||||
32, 61, 32, 40, 41, 32, 61, 62, 32, 102, 101, 116, // = () => fet
|
||||
99, 104, 40, 39, 47, 97, 112, 105, 47, 99, 111, 110, // ch('/api/con
|
||||
102, 105, 103, 47, 103, 101, 116, 39, 44, 32, 123, 104, // fig/get', {h
|
||||
101, 97, 100, 101, 114, 115, 58, 32, 123, 65, 117, 116, // eaders: {Aut
|
||||
104, 111, 114, 105, 122, 97, 116, 105, 111, 110, 58, 32, // horization:
|
||||
39, 39, 125, 125, 41, 10, 32, 32, 32, 32, 32, 32, // ''}}).
|
||||
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, //
|
||||
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 46, 116, // .t
|
||||
104, 101, 110, 40, 114, 32, 61, 62, 32, 114, 46, 106, // hen(r => r.j
|
||||
115, 111, 110, 40, 41, 41, 10, 32, 32, 32, 32, 32, // son()).
|
||||
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, //
|
||||
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 46, // .
|
||||
116, 104, 101, 110, 40, 114, 32, 61, 62, 32, 115, 101, // then(r => se
|
||||
116, 67, 111, 110, 102, 105, 103, 40, 114, 41, 41, 59, // tConfig(r));
|
||||
10, 10, 32, 32, 99, 111, 110, 115, 116, 32, 108, 111, // .. const lo
|
||||
@@ -709,80 +716,85 @@ static const unsigned char v2[] = {
|
||||
32, 32, 32, 32, 32, 125, 41, 59, 10, 32, 32, 32, // });.
|
||||
32, 125, 59, 10, 32, 32, 32, 32, 102, 101, 116, 99, // };. fetc
|
||||
104, 40, 39, 47, 97, 112, 105, 47, 119, 97, 116, 99, // h('/api/watc
|
||||
104, 39, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, // h').
|
||||
46, 116, 104, 101, 110, 40, 114, 32, 61, 62, 32, 114, // .then(r => r
|
||||
46, 98, 111, 100, 121, 46, 103, 101, 116, 82, 101, 97, // .body.getRea
|
||||
100, 101, 114, 40, 41, 41, 10, 32, 32, 32, 32, 32, // der()).
|
||||
32, 32, 32, 46, 116, 104, 101, 110, 40, 102, 41, 10, // .then(f).
|
||||
32, 32, 32, 32, 32, 32, 32, 32, 46, 99, 97, 116, // .cat
|
||||
99, 104, 40, 101, 32, 61, 62, 32, 115, 101, 116, 84, // ch(e => setT
|
||||
105, 109, 101, 111, 117, 116, 40, 119, 97, 116, 99, 104, // imeout(watch
|
||||
44, 32, 49, 48, 48, 48, 41, 41, 59, 10, 32, 32, // , 1000));.
|
||||
125, 59, 10, 10, 32, 32, 117, 115, 101, 69, 102, 102, // };.. useEff
|
||||
101, 99, 116, 40, 40, 41, 32, 61, 62, 32, 123, 10, // ect(() => {.
|
||||
32, 32, 32, 32, 102, 101, 116, 99, 104, 40, 39, 47, // fetch('/
|
||||
97, 112, 105, 47, 108, 111, 103, 105, 110, 39, 41, 10, // api/login').
|
||||
104, 39, 44, 32, 123, 104, 101, 97, 100, 101, 114, 115, // h', {headers
|
||||
58, 32, 123, 65, 117, 116, 104, 111, 114, 105, 122, 97, // : {Authoriza
|
||||
116, 105, 111, 110, 58, 32, 39, 39, 125, 125, 41, 10, // tion: ''}}).
|
||||
32, 32, 32, 32, 32, 32, 32, 32, 46, 116, 104, 101, // .the
|
||||
110, 40, 114, 32, 61, 62, 32, 114, 46, 106, 115, 111, // n(r => r.jso
|
||||
110, 40, 41, 41, 10, 32, 32, 32, 32, 32, 32, 32, // n()).
|
||||
32, 46, 116, 104, 101, 110, 40, 114, 32, 61, 62, 32, // .then(r =>
|
||||
108, 111, 103, 105, 110, 40, 114, 41, 41, 10, 32, 32, // login(r)).
|
||||
32, 32, 32, 32, 32, 32, 46, 99, 97, 116, 99, 104, // .catch
|
||||
40, 101, 114, 114, 32, 61, 62, 32, 115, 101, 116, 85, // (err => setU
|
||||
115, 101, 114, 40, 39, 39, 41, 41, 59, 10, 32, 32, // ser(''));.
|
||||
32, 32, 114, 101, 102, 114, 101, 115, 104, 40, 41, 59, // refresh();
|
||||
10, 32, 32, 32, 32, 119, 97, 116, 99, 104, 40, 41, // . watch()
|
||||
59, 10, 32, 32, 125, 44, 32, 91, 93, 41, 59, 10, // ;. }, []);.
|
||||
10, 32, 32, 105, 102, 32, 40, 33, 117, 115, 101, 114, // . if (!user
|
||||
41, 32, 114, 101, 116, 117, 114, 110, 32, 104, 116, 109, // ) return htm
|
||||
108, 96, 60, 36, 123, 76, 111, 103, 105, 110, 125, 32, // l`<${Login}
|
||||
108, 111, 103, 105, 110, 61, 36, 123, 108, 111, 103, 105, // login=${logi
|
||||
110, 125, 32, 47, 62, 96, 59, 10, 32, 32, 99, 111, // n} />`;. co
|
||||
110, 115, 116, 32, 97, 100, 109, 105, 110, 32, 61, 32, // nst admin =
|
||||
117, 115, 101, 114, 32, 61, 61, 32, 39, 97, 100, 109, // user == 'adm
|
||||
105, 110, 39, 59, 10, 32, 32, 99, 111, 110, 115, 116, // in';. const
|
||||
32, 99, 111, 108, 115, 105, 122, 101, 32, 61, 32, 97, // colsize = a
|
||||
100, 109, 105, 110, 32, 63, 32, 39, 99, 52, 39, 32, // dmin ? 'c4'
|
||||
58, 32, 39, 99, 54, 39, 59, 10, 32, 32, 99, 111, // : 'c6';. co
|
||||
110, 115, 116, 32, 99, 115, 32, 61, 32, 97, 100, 109, // nst cs = adm
|
||||
105, 110, 32, 63, 32, 104, 116, 109, 108, 96, 60, 36, // in ? html`<$
|
||||
123, 67, 104, 97, 110, 103, 101, 83, 101, 116, 116, 105, // {ChangeSetti
|
||||
110, 103, 115, 125, 32, 99, 111, 110, 102, 105, 103, 61, // ngs} config=
|
||||
36, 123, 99, 111, 110, 102, 105, 103, 125, 32, 47, 62, // ${config} />
|
||||
96, 32, 58, 32, 39, 39, 59, 10, 32, 32, 114, 101, // ` : '';. re
|
||||
116, 117, 114, 110, 32, 104, 116, 109, 108, 96, 10, 60, // turn html`.<
|
||||
36, 123, 78, 97, 118, 125, 32, 117, 115, 101, 114, 61, // ${Nav} user=
|
||||
36, 123, 117, 115, 101, 114, 125, 32, 108, 111, 103, 111, // ${user} logo
|
||||
117, 116, 61, 36, 123, 108, 111, 103, 111, 117, 116, 125, // ut=${logout}
|
||||
32, 47, 62, 10, 60, 100, 105, 118, 32, 99, 108, 97, // />.<div cla
|
||||
115, 115, 61, 34, 99, 111, 110, 116, 97, 105, 110, 101, // ss="containe
|
||||
114, 34, 62, 10, 32, 32, 60, 36, 123, 72, 101, 114, // r">. <${Her
|
||||
111, 125, 32, 47, 62, 10, 32, 32, 60, 100, 105, 118, // o} />. <div
|
||||
32, 99, 108, 97, 115, 115, 61, 34, 114, 111, 119, 34, // class="row"
|
||||
62, 10, 32, 32, 32, 32, 60, 100, 105, 118, 32, 99, // >. <div c
|
||||
108, 97, 115, 115, 61, 34, 99, 111, 108, 32, 36, 123, // lass="col ${
|
||||
99, 111, 108, 115, 105, 122, 101, 125, 34, 62, 60, 36, // colsize}"><$
|
||||
123, 83, 104, 111, 119, 83, 101, 116, 116, 105, 110, 103, // {ShowSetting
|
||||
115, 125, 32, 99, 111, 110, 102, 105, 103, 61, 36, 123, // s} config=${
|
||||
99, 111, 110, 102, 105, 103, 125, 32, 47, 62, 60, 47, // config} /></
|
||||
110, 40, 114, 32, 61, 62, 32, 114, 46, 98, 111, 100, // n(r => r.bod
|
||||
121, 46, 103, 101, 116, 82, 101, 97, 100, 101, 114, 40, // y.getReader(
|
||||
41, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 46, // )). .
|
||||
116, 104, 101, 110, 40, 102, 41, 10, 32, 32, 32, 32, // then(f).
|
||||
32, 32, 32, 32, 46, 99, 97, 116, 99, 104, 40, 101, // .catch(e
|
||||
32, 61, 62, 32, 115, 101, 116, 84, 105, 109, 101, 111, // => setTimeo
|
||||
117, 116, 40, 119, 97, 116, 99, 104, 44, 32, 49, 48, // ut(watch, 10
|
||||
48, 48, 41, 41, 59, 10, 32, 32, 125, 59, 10, 10, // 00));. };..
|
||||
32, 32, 117, 115, 101, 69, 102, 102, 101, 99, 116, 40, // useEffect(
|
||||
40, 41, 32, 61, 62, 32, 123, 10, 32, 32, 32, 32, // () => {.
|
||||
102, 101, 116, 99, 104, 40, 39, 47, 97, 112, 105, 47, // fetch('/api/
|
||||
108, 111, 103, 105, 110, 39, 44, 32, 123, 104, 101, 97, // login', {hea
|
||||
100, 101, 114, 115, 58, 32, 123, 65, 117, 116, 104, 111, // ders: {Autho
|
||||
114, 105, 122, 97, 116, 105, 111, 110, 58, 32, 39, 39, // rization: ''
|
||||
125, 125, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, // }}).
|
||||
46, 116, 104, 101, 110, 40, 114, 32, 61, 62, 32, 114, // .then(r => r
|
||||
46, 106, 115, 111, 110, 40, 41, 41, 10, 32, 32, 32, // .json()).
|
||||
32, 32, 32, 32, 32, 46, 116, 104, 101, 110, 40, 114, // .then(r
|
||||
32, 61, 62, 32, 108, 111, 103, 105, 110, 40, 114, 41, // => login(r)
|
||||
41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 46, 99, // ). .c
|
||||
97, 116, 99, 104, 40, 101, 114, 114, 32, 61, 62, 32, // atch(err =>
|
||||
115, 101, 116, 85, 115, 101, 114, 40, 39, 39, 41, 41, // setUser(''))
|
||||
59, 10, 32, 32, 32, 32, 114, 101, 102, 114, 101, 115, // ;. refres
|
||||
104, 40, 41, 59, 10, 32, 32, 32, 32, 119, 97, 116, // h();. wat
|
||||
99, 104, 40, 41, 59, 10, 32, 32, 125, 44, 32, 91, // ch();. }, [
|
||||
93, 41, 59, 10, 10, 32, 32, 105, 102, 32, 40, 33, // ]);.. if (!
|
||||
117, 115, 101, 114, 41, 32, 114, 101, 116, 117, 114, 110, // user) return
|
||||
32, 104, 116, 109, 108, 96, 60, 36, 123, 76, 111, 103, // html`<${Log
|
||||
105, 110, 125, 32, 108, 111, 103, 105, 110, 61, 36, 123, // in} login=${
|
||||
108, 111, 103, 105, 110, 125, 32, 47, 62, 96, 59, 10, // login} />`;.
|
||||
32, 32, 99, 111, 110, 115, 116, 32, 97, 100, 109, 105, // const admi
|
||||
110, 32, 61, 32, 117, 115, 101, 114, 32, 61, 61, 32, // n = user ==
|
||||
39, 97, 100, 109, 105, 110, 39, 59, 10, 32, 32, 99, // 'admin';. c
|
||||
111, 110, 115, 116, 32, 99, 111, 108, 115, 105, 122, 101, // onst colsize
|
||||
32, 61, 32, 97, 100, 109, 105, 110, 32, 63, 32, 39, // = admin ? '
|
||||
99, 52, 39, 32, 58, 32, 39, 99, 54, 39, 59, 10, // c4' : 'c6';.
|
||||
32, 32, 99, 111, 110, 115, 116, 32, 99, 115, 32, 61, // const cs =
|
||||
32, 97, 100, 109, 105, 110, 32, 63, 32, 104, 116, 109, // admin ? htm
|
||||
108, 96, 60, 36, 123, 67, 104, 97, 110, 103, 101, 83, // l`<${ChangeS
|
||||
101, 116, 116, 105, 110, 103, 115, 125, 32, 99, 111, 110, // ettings} con
|
||||
102, 105, 103, 61, 36, 123, 99, 111, 110, 102, 105, 103, // fig=${config
|
||||
125, 32, 47, 62, 96, 32, 58, 32, 39, 39, 59, 10, // } />` : '';.
|
||||
32, 32, 114, 101, 116, 117, 114, 110, 32, 104, 116, 109, // return htm
|
||||
108, 96, 10, 60, 36, 123, 78, 97, 118, 125, 32, 117, // l`.<${Nav} u
|
||||
115, 101, 114, 61, 36, 123, 117, 115, 101, 114, 125, 32, // ser=${user}
|
||||
108, 111, 103, 111, 117, 116, 61, 36, 123, 108, 111, 103, // logout=${log
|
||||
111, 117, 116, 125, 32, 47, 62, 10, 60, 100, 105, 118, // out} />.<div
|
||||
32, 99, 108, 97, 115, 115, 61, 34, 99, 111, 110, 116, // class="cont
|
||||
97, 105, 110, 101, 114, 34, 62, 10, 32, 32, 60, 36, // ainer">. <$
|
||||
123, 72, 101, 114, 111, 125, 32, 47, 62, 10, 32, 32, // {Hero} />.
|
||||
60, 100, 105, 118, 32, 99, 108, 97, 115, 115, 61, 34, // <div class="
|
||||
114, 111, 119, 34, 62, 10, 32, 32, 32, 32, 60, 100, // row">. <d
|
||||
105, 118, 32, 99, 108, 97, 115, 115, 61, 34, 99, 111, // iv class="co
|
||||
108, 32, 36, 123, 99, 111, 108, 115, 105, 122, 101, 125, // l ${colsize}
|
||||
34, 62, 60, 36, 123, 83, 104, 111, 119, 83, 101, 116, // "><${ShowSet
|
||||
116, 105, 110, 103, 115, 125, 32, 99, 111, 110, 102, 105, // tings} confi
|
||||
103, 61, 36, 123, 99, 111, 110, 102, 105, 103, 125, 32, // g=${config}
|
||||
47, 62, 60, 47, 100, 105, 118, 62, 10, 32, 32, 32, // /></div>.
|
||||
32, 60, 100, 105, 118, 32, 99, 108, 97, 115, 115, 61, // <div class=
|
||||
34, 99, 111, 108, 32, 36, 123, 99, 111, 108, 115, 105, // "col ${colsi
|
||||
122, 101, 125, 34, 62, 36, 123, 99, 115, 125, 60, 47, // ze}">${cs}</
|
||||
100, 105, 118, 62, 10, 32, 32, 32, 32, 60, 100, 105, // div>. <di
|
||||
118, 32, 99, 108, 97, 115, 115, 61, 34, 99, 111, 108, // v class="col
|
||||
32, 36, 123, 99, 111, 108, 115, 105, 122, 101, 125, 34, // ${colsize}"
|
||||
62, 36, 123, 99, 115, 125, 60, 47, 100, 105, 118, 62, // >${cs}</div>
|
||||
10, 32, 32, 32, 32, 60, 100, 105, 118, 32, 99, 108, // . <div cl
|
||||
97, 115, 115, 61, 34, 99, 111, 108, 32, 36, 123, 99, // ass="col ${c
|
||||
111, 108, 115, 105, 122, 101, 125, 34, 62, 60, 36, 123, // olsize}"><${
|
||||
67, 104, 97, 116, 125, 32, 109, 101, 115, 115, 97, 103, // Chat} messag
|
||||
101, 115, 61, 36, 123, 109, 101, 115, 115, 97, 103, 101, // es=${message
|
||||
115, 125, 32, 47, 62, 60, 47, 100, 105, 118, 62, 10, // s} /></div>.
|
||||
32, 32, 60, 47, 100, 105, 118, 62, 10, 32, 32, 60, // </div>. <
|
||||
36, 123, 70, 111, 111, 116, 101, 114, 125, 32, 47, 62, // ${Footer} />
|
||||
10, 60, 47, 100, 105, 118, 62, 96, 59, 10, 125, 59, // .</div>`;.};
|
||||
10, 10, 119, 105, 110, 100, 111, 119, 46, 111, 110, 108, // ..window.onl
|
||||
111, 97, 100, 32, 61, 32, 40, 41, 32, 61, 62, 32, // oad = () =>
|
||||
114, 101, 110, 100, 101, 114, 40, 104, 40, 65, 112, 112, // render(h(App
|
||||
41, 44, 32, 100, 111, 99, 117, 109, 101, 110, 116, 46, // ), document.
|
||||
98, 111, 100, 121, 41, 59, 10, 0 // body);.
|
||||
62, 60, 36, 123, 67, 104, 97, 116, 125, 32, 109, 101, // ><${Chat} me
|
||||
115, 115, 97, 103, 101, 115, 61, 36, 123, 109, 101, 115, // ssages=${mes
|
||||
115, 97, 103, 101, 115, 125, 32, 47, 62, 60, 47, 100, // sages} /></d
|
||||
105, 118, 62, 10, 32, 32, 60, 47, 100, 105, 118, 62, // iv>. </div>
|
||||
10, 32, 32, 60, 36, 123, 70, 111, 111, 116, 101, 114, // . <${Footer
|
||||
125, 32, 47, 62, 10, 60, 47, 100, 105, 118, 62, 96, // } />.</div>`
|
||||
59, 10, 125, 59, 10, 10, 119, 105, 110, 100, 111, 119, // ;.};..window
|
||||
46, 111, 110, 108, 111, 97, 100, 32, 61, 32, 40, 41, // .onload = ()
|
||||
32, 61, 62, 32, 114, 101, 110, 100, 101, 114, 40, 104, // => render(h
|
||||
40, 65, 112, 112, 41, 44, 32, 100, 111, 99, 117, 109, // (App), docum
|
||||
101, 110, 116, 46, 98, 111, 100, 121, 41, 59, 10, 0 // ent.body);.
|
||||
};
|
||||
static const unsigned char v3[] = {
|
||||
118, 97, 114, 32, 101, 44, 110, 44, 95, 44, 116, 44, // var e,n,_,t,
|
||||
@@ -2345,7 +2357,7 @@ static const struct packed_file {
|
||||
time_t mtime;
|
||||
} packed_files[] = {
|
||||
{"/web_root/index.html", v1, sizeof(v1), 1652432837},
|
||||
{"/web_root/main.js", v2, sizeof(v2), 1652514584},
|
||||
{"/web_root/main.js", v2, sizeof(v2), 1652995504},
|
||||
{"/web_root/preact.min.js", v3, sizeof(v3), 1652374364},
|
||||
{"/web_root/style.css", v4, sizeof(v4), 1652467860},
|
||||
{"/web_root/user.png", v5, sizeof(v5), 1626172939},
|
||||
|
||||
@@ -187,8 +187,9 @@ const App = function(props) {
|
||||
const [user, setUser] = useState('');
|
||||
const [config, setConfig] = useState({});
|
||||
|
||||
const refresh = () =>
|
||||
fetch('/api/config/get').then(r => r.json()).then(r => setConfig(r));
|
||||
const refresh = () => fetch('/api/config/get', {headers: {Authorization: ''}})
|
||||
.then(r => r.json())
|
||||
.then(r => setConfig(r));
|
||||
|
||||
const login = function(u) {
|
||||
document.cookie = `access_token=${u.token};path=/;max-age=3600`;
|
||||
@@ -214,14 +215,14 @@ const App = function(props) {
|
||||
if (!result.done) return f(reader);
|
||||
});
|
||||
};
|
||||
fetch('/api/watch')
|
||||
fetch('/api/watch', {headers: {Authorization: ''}})
|
||||
.then(r => r.body.getReader())
|
||||
.then(f)
|
||||
.catch(e => setTimeout(watch, 1000));
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
fetch('/api/login')
|
||||
fetch('/api/login', {headers: {Authorization: ''}})
|
||||
.then(r => r.json())
|
||||
.then(r => login(r))
|
||||
.catch(err => setUser(''));
|
||||
|
||||
@@ -88,14 +88,8 @@ static void timer_fn(void *arg) {
|
||||
if (s_boot_timestamp < 9999) mg_sntp_request(s_sntp_conn);
|
||||
}
|
||||
|
||||
// Use Zephyr's printk() for Mongooose MG_* logging
|
||||
static void logfn(const void *ptr, size_t len, void *userdata) {
|
||||
printk("%.*s", (int) len, (char *) ptr);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
mg_log_set(s_debug_level);
|
||||
mg_log_set_callback(logfn, NULL);
|
||||
|
||||
mg_mgr_init(&s_mgr);
|
||||
mg_timer_add(&s_mgr, 5000, MG_TIMER_REPEAT | MG_TIMER_RUN_NOW, timer_fn,
|
||||
|
||||
@@ -69,16 +69,10 @@ static void timer_fn(void *arg) {
|
||||
if (s_boot_timestamp < 9999) mg_sntp_request(s_sntp_conn);
|
||||
}
|
||||
|
||||
// Use Zephyr's printk() for Mongooose MG_* logging
|
||||
static void logfn(const void *ptr, size_t len, void *userdata) {
|
||||
printk("%.*s", (int) len, (char *) ptr);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
struct mg_mgr mgr;
|
||||
|
||||
mg_log_set(s_debug_level);
|
||||
mg_log_set_callback(logfn, NULL);
|
||||
|
||||
mg_mgr_init(&mgr);
|
||||
mg_http_listen(&mgr, s_http_addr, wcb, NULL);
|
||||
|
||||
@@ -86,14 +86,8 @@ static void timer_fn(void *arg) {
|
||||
if (s_boot_timestamp < 9999) mg_sntp_request(s_sntp_conn);
|
||||
}
|
||||
|
||||
// Use Zephyr's printk() for Mongooose MG_* logging
|
||||
static void logfn(const void *ptr, size_t len, void *userdata) {
|
||||
printk("%.*s", (int) len, (char *) ptr);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
mg_log_set(s_debug_level);
|
||||
mg_log_set_callback(logfn, NULL);
|
||||
|
||||
mg_mgr_init(&mgr);
|
||||
mg_timer_add(&mgr, 5000, MG_TIMER_REPEAT | MG_TIMER_RUN_NOW, timer_fn, &mgr);
|
||||
|
||||
@@ -63,16 +63,10 @@ static void timer_fn(void *arg) {
|
||||
if (s_boot_timestamp < 9999) mg_sntp_request(s_sntp_conn);
|
||||
}
|
||||
|
||||
// Use Zephyr's printk() for Mongooose MG_* logging
|
||||
static void logfn(const void *ptr, size_t len, void *userdata) {
|
||||
printk("%.*s", (int) len, (char *) ptr);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
struct mg_mgr mgr;
|
||||
|
||||
mg_log_set(s_debug_level);
|
||||
mg_log_set_callback(logfn, NULL);
|
||||
|
||||
mg_mgr_init(&mgr);
|
||||
mg_http_listen(&mgr, s_ws_addr, fn, NULL);
|
||||
|
||||
Reference in new issue
Block a user