Mercurial
annotate playground/main.c @ 120:cbbf78b17cfa
[Seobeo][Websocket] Created Web socket client logic.
| author | June Park <parkjune1995@gmail.com> |
|---|---|
| date | Thu, 08 Jan 2026 03:19:59 -0800 |
| parents | 1c446ab6f945 |
| children | e7899c93da77 |
| rev | line source |
|---|---|
|
18
fa2b8af609d9
[Seobeo] Fixed a bug with pathing. Support SSL.
June Park <parkjune1995@gmail.com>
parents:
17
diff
changeset
|
1 #include <stdio.h> |
|
71
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
2 #include <stdlib.h> |
|
1
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
3 |
|
108
f07abbcd2ec5
[HgWeb] Will probably hold off on using it since it is not urgent.
June Park <parkjune1995@gmail.com>
parents:
71
diff
changeset
|
4 #define REPO_ROOT "/Users/mrjunejune/zenbu" |
|
f07abbcd2ec5
[HgWeb] Will probably hold off on using it since it is not urgent.
June Park <parkjune1995@gmail.com>
parents:
71
diff
changeset
|
5 |
|
25
342726584be2
[Bun] Fixed how bun would be ran within bazel.
June Park <parkjune1995@gmail.com>
parents:
18
diff
changeset
|
6 int main() |
|
1
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
7 { |
|
108
f07abbcd2ec5
[HgWeb] Will probably hold off on using it since it is not urgent.
June Park <parkjune1995@gmail.com>
parents:
71
diff
changeset
|
8 char command[512]; |
|
f07abbcd2ec5
[HgWeb] Will probably hold off on using it since it is not urgent.
June Park <parkjune1995@gmail.com>
parents:
71
diff
changeset
|
9 snprintf(command, sizeof(command), "hg -R %s serve --stdio", REPO_ROOT); |
|
f07abbcd2ec5
[HgWeb] Will probably hold off on using it since it is not urgent.
June Park <parkjune1995@gmail.com>
parents:
71
diff
changeset
|
10 printf("command: %s\n", command); |
|
f07abbcd2ec5
[HgWeb] Will probably hold off on using it since it is not urgent.
June Park <parkjune1995@gmail.com>
parents:
71
diff
changeset
|
11 |
|
f07abbcd2ec5
[HgWeb] Will probably hold off on using it since it is not urgent.
June Park <parkjune1995@gmail.com>
parents:
71
diff
changeset
|
12 FILE *hg_pipe = popen(command, "r+"); |
|
f07abbcd2ec5
[HgWeb] Will probably hold off on using it since it is not urgent.
June Park <parkjune1995@gmail.com>
parents:
71
diff
changeset
|
13 if (!hg_pipe) |
|
f07abbcd2ec5
[HgWeb] Will probably hold off on using it since it is not urgent.
June Park <parkjune1995@gmail.com>
parents:
71
diff
changeset
|
14 { |
|
f07abbcd2ec5
[HgWeb] Will probably hold off on using it since it is not urgent.
June Park <parkjune1995@gmail.com>
parents:
71
diff
changeset
|
15 printf("Failed to open pipe\n"); |
|
f07abbcd2ec5
[HgWeb] Will probably hold off on using it since it is not urgent.
June Park <parkjune1995@gmail.com>
parents:
71
diff
changeset
|
16 return -1; |
|
f07abbcd2ec5
[HgWeb] Will probably hold off on using it since it is not urgent.
June Park <parkjune1995@gmail.com>
parents:
71
diff
changeset
|
17 } |
|
f07abbcd2ec5
[HgWeb] Will probably hold off on using it since it is not urgent.
June Park <parkjune1995@gmail.com>
parents:
71
diff
changeset
|
18 |
|
f07abbcd2ec5
[HgWeb] Will probably hold off on using it since it is not urgent.
June Park <parkjune1995@gmail.com>
parents:
71
diff
changeset
|
19 fprintf(hg_pipe, "capabilities\n"); |
|
f07abbcd2ec5
[HgWeb] Will probably hold off on using it since it is not urgent.
June Park <parkjune1995@gmail.com>
parents:
71
diff
changeset
|
20 fflush(hg_pipe); |
|
71
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
21 |
|
109
1c446ab6f945
[MrJuneJune] New Blog about writing Seobeo library.
June Park <parkjune1995@gmail.com>
parents:
108
diff
changeset
|
22 char *output = malloc(sizeof(char) * 2048); |
|
1c446ab6f945
[MrJuneJune] New Blog about writing Seobeo library.
June Park <parkjune1995@gmail.com>
parents:
108
diff
changeset
|
23 char *curr = output; |
|
1c446ab6f945
[MrJuneJune] New Blog about writing Seobeo library.
June Park <parkjune1995@gmail.com>
parents:
108
diff
changeset
|
24 int c; |
|
1c446ab6f945
[MrJuneJune] New Blog about writing Seobeo library.
June Park <parkjune1995@gmail.com>
parents:
108
diff
changeset
|
25 int number_of_breakline = 0; |
|
1c446ab6f945
[MrJuneJune] New Blog about writing Seobeo library.
June Park <parkjune1995@gmail.com>
parents:
108
diff
changeset
|
26 while ((c = fgetc(hg_pipe)) != NULL) |
|
1c446ab6f945
[MrJuneJune] New Blog about writing Seobeo library.
June Park <parkjune1995@gmail.com>
parents:
108
diff
changeset
|
27 { |
|
1c446ab6f945
[MrJuneJune] New Blog about writing Seobeo library.
June Park <parkjune1995@gmail.com>
parents:
108
diff
changeset
|
28 *curr++ = c; |
|
1c446ab6f945
[MrJuneJune] New Blog about writing Seobeo library.
June Park <parkjune1995@gmail.com>
parents:
108
diff
changeset
|
29 printf("output: %s\n", output); |
|
1c446ab6f945
[MrJuneJune] New Blog about writing Seobeo library.
June Park <parkjune1995@gmail.com>
parents:
108
diff
changeset
|
30 if (c == '\n') |
|
1c446ab6f945
[MrJuneJune] New Blog about writing Seobeo library.
June Park <parkjune1995@gmail.com>
parents:
108
diff
changeset
|
31 number_of_breakline++; |
|
1c446ab6f945
[MrJuneJune] New Blog about writing Seobeo library.
June Park <parkjune1995@gmail.com>
parents:
108
diff
changeset
|
32 if (number_of_breakline == 2) |
|
1c446ab6f945
[MrJuneJune] New Blog about writing Seobeo library.
June Park <parkjune1995@gmail.com>
parents:
108
diff
changeset
|
33 break; |
|
1c446ab6f945
[MrJuneJune] New Blog about writing Seobeo library.
June Park <parkjune1995@gmail.com>
parents:
108
diff
changeset
|
34 printf("char: %c\n", c); |
|
1c446ab6f945
[MrJuneJune] New Blog about writing Seobeo library.
June Park <parkjune1995@gmail.com>
parents:
108
diff
changeset
|
35 } |
|
108
f07abbcd2ec5
[HgWeb] Will probably hold off on using it since it is not urgent.
June Park <parkjune1995@gmail.com>
parents:
71
diff
changeset
|
36 pclose(hg_pipe); |
|
71
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
37 |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
38 |
|
75de5903355c
Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
June Park <parkjune1995@gmail.com>
parents:
25
diff
changeset
|
39 return 0; |
|
1
adcfad6e86fb
Updated naming and separated out some logic within seobeo.
June Park <parkjune1995@gmail.com>
parents:
diff
changeset
|
40 } |
|
108
f07abbcd2ec5
[HgWeb] Will probably hold off on using it since it is not urgent.
June Park <parkjune1995@gmail.com>
parents:
71
diff
changeset
|
41 |
|
f07abbcd2ec5
[HgWeb] Will probably hold off on using it since it is not urgent.
June Park <parkjune1995@gmail.com>
parents:
71
diff
changeset
|
42 |