-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Contest list
- Loading branch information
Showing
19 changed files
with
924 additions
and
315 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#ifndef ANNOUNCEMENT_H | ||
#define ANNOUNCEMENT_H | ||
#include <command.h> | ||
|
||
struct command* init_announcement_command(void); | ||
|
||
#endif // ANNOUNCEMENT_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#ifndef CLIENT_H | ||
#define CLIENT_H | ||
|
||
#include <curl/curl.h> | ||
#include <sr_keychain.h> | ||
|
||
#ifndef NDEBUG | ||
#define TARGET_URL "http://judge_ui:8888" | ||
#else | ||
#define TARGET_URL "https://judge.eluminatis-of-lu.com" | ||
#endif | ||
|
||
#define target_url(x) TARGET_URL "/" x | ||
|
||
struct response | ||
{ | ||
char *memory; | ||
size_t size; | ||
}; | ||
extern struct response response_body; | ||
extern CURL *curl; | ||
|
||
void init_curl(void); | ||
void cleanup_curl(void); | ||
void print_cookies(void); | ||
void save_cookies(void); | ||
size_t noop_write_callback(char *ptr, size_t size, size_t nmemb, void *userdata); | ||
|
||
#endif // CLIENT_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#ifndef COMMAND_H | ||
#define COMMAND_H | ||
|
||
struct command | ||
{ | ||
const char *name; | ||
const char *desc; | ||
const char *help; | ||
struct command **sub; | ||
int (*func)(struct command *cur, int argc, char **argv); | ||
}; | ||
|
||
void print_help(struct command *cmd); | ||
int print_help_and_traverse(struct command *cur, int argc, char **argv); | ||
void cleanup_commands(struct command *cmd); | ||
|
||
#endif // COMMAND_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#ifndef CONTEST_H | ||
#define CONTEST_H | ||
#include <command.h> | ||
|
||
struct command *init_contest_command(void); | ||
|
||
#endif // CONTEST_H |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/* | ||
* The MIT License | ||
* | ||
* Copyright (c) 2008- Attractive Chaos <attractor@live.co.uk> | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining | ||
* a copy of this software and associated documentation files (the | ||
* "Software"), to deal in the Software without restriction, including | ||
* without limitation the rights to use, copy, modify, merge, publish, | ||
* distribute, sublicense, and/or sell copies of the Software, and to | ||
* permit persons to whom the Software is furnished to do so, subject to | ||
* the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be | ||
* included in all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS | ||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | ||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
#ifndef KSON_H | ||
#define KSON_H | ||
|
||
#include <string.h> | ||
|
||
#define KSON_TYPE_NO_QUOTE 1 | ||
#define KSON_TYPE_SGL_QUOTE 2 | ||
#define KSON_TYPE_DBL_QUOTE 3 | ||
#define KSON_TYPE_BRACKET 4 | ||
#define KSON_TYPE_BRACE 5 | ||
|
||
#define KSON_OK 0 | ||
#define KSON_ERR_EXTRA_LEFT 1 | ||
#define KSON_ERR_EXTRA_RIGHT 2 | ||
#define KSON_ERR_NO_KEY 3 | ||
|
||
typedef struct kson_node_s { | ||
unsigned long long type:3, n:61; | ||
char *key; | ||
union { | ||
struct kson_node_s **child; | ||
char *str; | ||
} v; | ||
} kson_node_t; | ||
|
||
typedef struct { | ||
long n_nodes; | ||
kson_node_t *root; | ||
} kson_t; | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
kson_t *kson_parse(const char *json); | ||
void kson_destroy(kson_t *kson); | ||
const kson_node_t *kson_by_path(const kson_node_t *root, int path_len, ...); | ||
void kson_format(const kson_node_t *root); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#define kson_is_internal(p) ((p)->type == KSON_TYPE_BRACKET || (p)->type == KSON_TYPE_BRACE) | ||
|
||
static inline const kson_node_t *kson_by_key(const kson_node_t *p, const char *key) | ||
{ | ||
long i; | ||
if (!kson_is_internal(p)) return 0; | ||
for (i = 0; i < (long)p->n; ++i) { | ||
const kson_node_t *q = p->v.child[i]; | ||
if (q->key && strcmp(q->key, key) == 0) | ||
return q; | ||
} | ||
return 0; | ||
} | ||
|
||
static inline const kson_node_t *kson_by_index(const kson_node_t *p, long i) | ||
{ | ||
if (!kson_is_internal(p)) return 0; | ||
return 0 <= i && i < (long)p->n? p->v.child[i] : 0; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#ifndef LOGIN_H | ||
#define LOGIN_H | ||
#include <command.h> | ||
|
||
struct command *init_login_command(void); | ||
|
||
#endif // LOGIN_H |
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.