aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLAN-TW <lantw44@gmail.com>2012-10-27 20:17:00 +0800
committerLAN-TW <lantw44@gmail.com>2012-10-27 20:19:57 +0800
commitde2f67d2d8353ff6218f6255465404f605c34f28 (patch)
treed6e59c5630b7e88051a62c64b8fb9ba0acb7bedc
parent0869aeeba4c0cecd5279891666fe068ed87d5ccc (diff)
downloadsctjudge-de2f67d2d8353ff6218f6255465404f605c34f28.tar.gz
sctjudge-de2f67d2d8353ff6218f6255465404f605c34f28.tar.zst
sctjudge-de2f67d2d8353ff6218f6255465404f605c34f28.zip
使用者可利用 configure 設定用於捨棄資料的裝置檔案
其實就是 /dev/null 或 /dev/zero 之類的東西!預設是 /dev/null
-rw-r--r--configure.ac18
-rw-r--r--src/config2.h3
-rw-r--r--src/main.c8
3 files changed, 20 insertions, 9 deletions
diff --git a/configure.ac b/configure.ac
index 232a5b5..1b9bada 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,13 +1,13 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
-AC_INIT([sctjudge], [1.0], [lantw44@gmail.com])
+AC_INIT([sctjudge], [1.0-rc1], [lantw44@gmail.com])
AM_INIT_AUTOMAKE([foreign -Wall])
AM_SILENT_RULES([yes])
AC_CONFIG_SRCDIR([src/main.c])
AC_CONFIG_HEADERS([src/config.h])
-releasedate="2012-XX-XX"
+releasedate="2012-10-27"
rpmversion="1.0"
# Checks for programs.
@@ -58,6 +58,16 @@ AC_ARG_ENABLE([cap],
test x"${opt_cap}" = xyes && \
AC_DEFINE([HAVE_CONF_CAP], [1], [Linux Capabilities])
+# 可以設定 /dev/null 名稱
+AC_ARG_WITH([null],
+ AS_HELP_STRING([--with-null=NULL],
+ [set the path of the data sink (default: /dev/null)]),
+ [with_null=$withval], [with_null=/dev/null])
+
+AC_CHECK_FILE([${with_null}],
+ [AC_DEFINE_UNQUOTED([NULL_DEVICE], ["${with_null}"],
+ [Path of the data sink])],
+ [AC_MSG_ERROR([${with_null} does not exist])])
# 可以設定 proc filesystem 在哪裡
AC_ARG_WITH([proc],
@@ -67,11 +77,11 @@ AC_ARG_WITH([proc],
if test x"${opt_procmon}" = xyes; then \
AC_CHECK_FILES([${with_proc}/stat ${with_proc}/$$/stat ${with_proc}/$$/statm ${with_proc}/$$/status],
- [AC_DEFINE_UNQUOTED([PROC_PATH], ["${with_proc}"], [Location of Linux proc file system])],
+ [AC_DEFINE_UNQUOTED([PROC_PATH], ["${with_proc}"],
+ [Location of Linux proc file system])],
[AC_MSG_ERROR([Linux proc file system support is incomplete])])
fi
-
# Checks for libraries.
checkliblist="pthread_create pthread_exit pthread_cancel pthread_join pthread_attr_init pthread_attr_destroy pthread_attr_setdetachstate pthread_mutex_init pthread_mutex_destroy pthread_mutex_lock pthread_mutex_unlock pthread_setcancelstate pthread_setcanceltype"
diff --git a/src/config2.h b/src/config2.h
index 822ebdb..41ae605 100644
--- a/src/config2.h
+++ b/src/config2.h
@@ -5,9 +5,6 @@
#define SCT_CHECKTLE_INTERVAL 128000000
#define SCT_DISPTIME_INTERVAL 384000000
-/* XXX 這個看能不能用 GNU autotool 取代,我可不確定 /dev/null 永遠存在!*/
-#define NULL_DEVICE "/dev/null"
-
/* sctjudge 這個程式的 exit status */
#define SCTEXIT_SUCCESS 0 /* 當然就是正常結束 */
#define SCTEXIT_SYNTAX 1 /* 解析階段:命令列語法錯誤 */
diff --git a/src/main.c b/src/main.c
index 6bbb576..e88c813 100644
--- a/src/main.c
+++ b/src/main.c
@@ -191,12 +191,16 @@ int main(int argc, char* argv[]){
);
putchar('\n');
printf("編譯時指定的參數列表:\n"
+#ifdef NULL_DEVICE
+ " * 用於捨棄資料的裝置檔案:"
+ NULL_DEVICE
+ " (--with-null)\n"
+#endif
#ifdef PROC_PATH
" * Linux 的 proc 檔案系統路徑:"
PROC_PATH
- " (--with-proc)"
+ " (--with-proc)\n"
#endif
- "\n"
);
exit(SCTEXIT_SUCCESS);
}else if(!strcmp(&argv[i][1], "v") ||