-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #318 from blackav/317-add-default_disabled-config-…
…variable-to-language-section 317 add default disabled config variable to language section
- Loading branch information
Showing
9 changed files
with
64 additions
and
15 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
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* -*- mode: c -*- */ | ||
|
||
/* Copyright (C) 2008-2023 Alexander Chernov <[email protected]> */ | ||
/* Copyright (C) 2008-2024 Alexander Chernov <[email protected]> */ | ||
|
||
/* | ||
* This program is free software; you can redistribute it and/or modify | ||
|
@@ -496,6 +496,10 @@ update_language_script( | |
size_t in_z = 0, out_z = 0; | ||
FILE *f = 0; | ||
char buf[1024]; | ||
char old_path[PATH_MAX]; | ||
char lock_path[PATH_MAX]; | ||
char new_script_out[PATH_MAX]; | ||
__attribute__((unused)) int _; | ||
|
||
// read the source file | ||
if (!(f = fopen(script_in, "r"))) { | ||
|
@@ -520,16 +524,30 @@ update_language_script( | |
fclose(f); f = 0; | ||
if (!strcmp(out_t, in_t)) { | ||
// no difference, but update the modtime | ||
if (utime(script_out, 0) < 0) { | ||
log_printf(err_f, win, "error: cannot change mod time for `%s'\n", | ||
script_out); | ||
// error | ||
} | ||
//if (utime(script_out, 0) < 0) { | ||
// log_printf(err_f, win, "error: cannot change mod time for `%s'\n", | ||
// script_out); | ||
// // error | ||
//} | ||
goto cleanup; | ||
} | ||
xfree(out_t); out_t = 0; | ||
} | ||
|
||
// check the lock file | ||
_ = snprintf(lock_path, sizeof(lock_path), "%s.lock", script_out); | ||
if (access(lock_path, F_OK) >= 0) { | ||
_ = snprintf(new_script_out, sizeof(new_script_out), "%s.new", script_out); | ||
script_out = new_script_out; | ||
} else { | ||
// preserve the old output file | ||
_ = snprintf(old_path, sizeof(old_path), "%s.old", script_out); | ||
if (rename(script_out, old_path) < 0) { | ||
log_printf(err_f, win, "error: cannot rename `%s'\n", script_out); | ||
goto cleanup; | ||
} | ||
} | ||
|
||
// write the output file | ||
if (!(f = fopen(script_out, "w"))) { | ||
log_printf(err_f, win, "error: cannot open `%s' for writing\n", | ||
|
@@ -1189,11 +1207,10 @@ lang_config_generate_compile_cfg( | |
s = shellconfig_get(p->cfg, "long_name"); | ||
if (!s) s = ""; | ||
fprintf(f, "long_name = \"%s\"\n", s); | ||
/* | ||
s = shellconfig_get(p->cfg, "version"); | ||
if (!s) s = ""; | ||
fprintf(f, "%s\"\n", s); | ||
*/ | ||
if (s && *s) { | ||
fprintf(f, "version = \"%s\"\n", s); | ||
} | ||
if ((s = shellconfig_get(p->cfg, "src_sfx"))) { | ||
fprintf(f, "src_sfx = \"%s\"\n", s); | ||
} | ||
|
@@ -1221,6 +1238,9 @@ lang_config_generate_compile_cfg( | |
if ((s = shellconfig_get(p->cfg, "enable_ejudge_env"))) { | ||
fprintf(f, "enable_ejudge_env\n"); | ||
} | ||
if ((s = shellconfig_get(p->cfg, "default_disabled"))) { | ||
fprintf(f, "default_disabled\n"); | ||
} | ||
if (!(s = shellconfig_get(p->cfg, "cmd"))) s = p->lang; | ||
fprintf(f, "cmd = \"%s\"\n", s); | ||
if ((s = shellconfig_get(p->cfg, "arch"))) { | ||
|
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
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/bin/sh | ||
# Copyright (c) 2023 Alexander Chernov <[email protected]> | ||
# Copyright (c) 2023-2024 Alexander Chernov <[email protected]> | ||
|
||
# compiler script interface is as follows | ||
# <comp>-version [OPTION] | ||
|
@@ -22,6 +22,7 @@ common_config() { | |
echo 'long_name="Custom"' | ||
echo 'src_sfx=".txt"' | ||
echo 'enable_custom=1' | ||
echo 'default_disabled=1' | ||
} | ||
|
||
failure() { | ||
|
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#! /bin/bash | ||
# Copyright (c) 2023 Alexander Chernov <[email protected]> | ||
# Copyright (c) 2023-2024 Alexander Chernov <[email protected]> | ||
|
||
prefix="@prefix@" | ||
exec_prefix="@exec_prefix@" | ||
|
@@ -13,6 +13,7 @@ common_config() { | |
echo 'long_name="PostgreSQL"' | ||
echo 'src_sfx=".sql"' | ||
echo 'arch="linux-shared"' | ||
echo 'default_disabled=1' | ||
} | ||
|
||
failure() { | ||
|