From noreply在list.moon.ossxp.com Sat Aug 22 17:28:54 2009 From: noreply在list.moon.ossxp.com (jiangxin) Date: Sat, 22 Aug 2009 17:28:54 +0800 Subject: [Hello-commit] r1 - / Message-ID: Author: jiangxin Date: 2009-08-22 17:28:54 +0800 (六, 2009-08-22) New Revision: 1 Added: branches/ tags/ trunk/ Log: 目录初始化 From noreply在list.moon.ossxp.com Sat Aug 22 17:31:19 2009 From: noreply在list.moon.ossxp.com (jiangxin) Date: Sat, 22 Aug 2009 17:31:19 +0800 Subject: [Hello-commit] r2 - trunk Message-ID: Author: jiangxin Date: 2009-08-22 17:31:19 +0800 (六, 2009-08-22) New Revision: 2 Added: trunk/README trunk/src/ Log: See #1: 项目目录初始化 * README 文件内容同 Trac 首页 * src 目录用于保存代码 已增加: trunk/README =================================================================== --- trunk/README (rev 0) +++ trunk/README 2009-08-22 09:31:19 UTC (rev 2) @@ -0,0 +1,15 @@ += Hello World 项目 (svn) = +Hello World 项目是一个用 C 语言开发的演示项目,主要用于版本控制系统的演示。有 svn 和 hg 两种不同的版本, +分别用 Subversion 和 Mercurial 做版本控制,以演示两种版本库维护第三方版本库的高下。 + +本项目作为 svn 版本库维护的上游版本,对应的下游版本项目页,参见: [[//trac/hello-svn-hacks]] + +相关的概念 + * '''上游版本库''': + 无权在该版本库中 Checkin,如果需要对其中的代码进行定制,只能通过 fork ── 本地重建版本库的方式。 + * '''下游版本库''': + 自己或自己所在的团队,为了修改上游版本库而另外建立的版本库。该版本库用于镜像上游代码,以及维护代码定制。 + * '''卖主分支''': + 使用 Subversion 作为下游版本库维护代码,采用的方法称为卖主分支。即使用一个分支专门用于镜像上游版本库的代码,在主线维护包含定制的代码。 + * '''Hg + MQ''': + 使用 Mercurial(Hg) 以及 Hg 内置的 MQ 插件来维护下游版本库,是一种更为有效的方法。尤其是对上游的定制相当的多和复杂的情况,可以大大减少由于上游版本频繁升级带来的维护负担。这种方法实际上维护的是一系列补丁文件,这些补丁文件使用的是 [[http://savannah.nongnu.org/projects/quilt|quilt]] 格式。 Property changes on: trunk/README ___________________________________________________________________ 已增加: svn:eol-style + native From noreply在list.moon.ossxp.com Sat Aug 22 17:37:02 2009 From: noreply在list.moon.ossxp.com (jiangxin) Date: Sat, 22 Aug 2009 17:37:02 +0800 Subject: [Hello-commit] r3 - trunk/src Message-ID: Author: jiangxin Date: 2009-08-22 17:37:02 +0800 (六, 2009-08-22) New Revision: 3 Added: trunk/src/Makefile trunk/src/main.bak trunk/src/main.c Log: Fixed #1: hello world initialized. 已增加: trunk/src/Makefile =================================================================== --- trunk/src/Makefile (rev 0) +++ trunk/src/Makefile 2009-08-22 09:37:02 UTC (rev 3) @@ -0,0 +1,6 @@ + +OBJECTS = main.o +hello: $(OBJECTS) + $(CC) -o $@ $^ + +# vim: noet Property changes on: trunk/src/Makefile ___________________________________________________________________ 已增加: svn:eol-style + LF 已增加: trunk/src/main.bak =================================================================== --- trunk/src/main.bak (rev 0) +++ trunk/src/main.bak 2009-08-22 09:37:02 UTC (rev 3) @@ -0,0 +1,7 @@ +#include + +int +main() +{ + printf("Hello world.\n"); +} Property changes on: trunk/src/main.bak ___________________________________________________________________ 已增加: svn:mime-type + text/plain 已增加: svn:eol-style + native 已增加: trunk/src/main.c =================================================================== --- trunk/src/main.c (rev 0) +++ trunk/src/main.c 2009-08-22 09:37:02 UTC (rev 3) @@ -0,0 +1,7 @@ +#include + +int +main() +{ + printf("Hello world.\n"); +} Property changes on: trunk/src/main.c ___________________________________________________________________ 已增加: svn:mime-type + text/plain 已增加: svn:eol-style + native From noreply在list.moon.ossxp.com Sat Aug 22 17:49:14 2009 From: noreply在list.moon.ossxp.com (jiangxin) Date: Sat, 22 Aug 2009 17:49:14 +0800 Subject: [Hello-commit] r4 - trunk/src Message-ID: Author: jiangxin Date: 2009-08-22 17:49:13 +0800 (六, 2009-08-22) New Revision: 4 Modified: trunk/src/main.c Log: Fixed #3: add help message for -h|--help options. 已修改: trunk/src/main.c =================================================================== --- trunk/src/main.c 2009-08-22 09:37:02 UTC (rev 3) +++ trunk/src/main.c 2009-08-22 09:49:13 UTC (rev 4) @@ -1,7 +1,29 @@ #include +int usage(int code) +{ + printf("Hello world example.\n" + "Copyright Jiang Xin , 2009\n" + "\n" + "Usage:\n" + " hello\n" + " say hello to the world.\n\n" + " hello \n" + " say hi to the user.\n\n" + " hello -h, -help\n" + " this help screen.\n\n"); + return code; +} + int -main() +main(int argc, char **argv) { - printf("Hello world.\n"); + if (argc == 1) { + printf ("Hello world.\n"); + } else if ( strcmp(argv[1],"-h") == 0 || + strcmp(argv[1],"--help") == 0 ) { + return usage(0); + } else { + printf ("Hi, %s.\n", argv[1]); + } } From noreply在list.moon.ossxp.com Sat Aug 22 17:55:54 2009 From: noreply在list.moon.ossxp.com (jiangxin) Date: Sat, 22 Aug 2009 17:55:54 +0800 Subject: [Hello-commit] r5 - trunk/src Message-ID: Author: jiangxin Date: 2009-08-22 17:55:54 +0800 (六, 2009-08-22) New Revision: 5 Modified: trunk/src/Makefile Log: Fixed #4: make clean to delete template files. 已修改: trunk/src/Makefile =================================================================== --- trunk/src/Makefile 2009-08-22 09:49:13 UTC (rev 4) +++ trunk/src/Makefile 2009-08-22 09:55:54 UTC (rev 5) @@ -1,6 +1,14 @@ +OBJECTS = main.o +TARGET = hello -OBJECTS = main.o -hello: $(OBJECTS) +all: $(TARGET) + +$(TARGET): $(OBJECTS) $(CC) -o $@ $^ - + +clean: + rm -f $(TARGET) $(OBJECTS) + +.PHONY: all clean + # vim: noet From noreply在list.moon.ossxp.com Sat Aug 22 17:58:11 2009 From: noreply在list.moon.ossxp.com (jiangxin) Date: Sat, 22 Aug 2009 17:58:11 +0800 Subject: [Hello-commit] propchange - r5 svn:log Message-ID: Author: jiangxin Revision: 5 Property Name: svn:log New Property Value: Fixed #4: ''make clean'' to __delete__ ~~temporary files~~. From noreply在list.moon.ossxp.com Sat Aug 22 18:05:36 2009 From: noreply在list.moon.ossxp.com (jiangxin) Date: Sat, 22 Aug 2009 18:05:36 +0800 Subject: [Hello-commit] r6 - tags Message-ID: Author: jiangxin Date: 2009-08-22 18:05:36 +0800 (六, 2009-08-22) New Revision: 6 Added: tags/version-1.0.0/ Log: Create tag version-1.0.0. Fixed #5 From noreply在list.moon.ossxp.com Sat Aug 22 18:15:30 2009 From: noreply在list.moon.ossxp.com (jiangxin) Date: Sat, 22 Aug 2009 18:15:30 +0800 Subject: [Hello-commit] r7 - branches Message-ID: Author: jiangxin Date: 2009-08-22 18:15:30 +0800 (六, 2009-08-22) New Revision: 7 Added: branches/1.0.x/ Log: Create branches 1.0.x. From noreply在list.moon.ossxp.com Sat Aug 22 18:16:44 2009 From: noreply在list.moon.ossxp.com (user1) Date: Sat, 22 Aug 2009 18:16:44 +0800 Subject: [Hello-commit] r8 - trunk/src Message-ID: Author: user1 Date: 2009-08-22 18:16:44 +0800 (六, 2009-08-22) New Revision: 8 Removed: trunk/src/main.bak Log: Fixed #2: delete temporary file. 已删除: trunk/src/main.bak =================================================================== --- trunk/src/main.bak 2009-08-22 10:15:30 UTC (rev 7) +++ trunk/src/main.bak 2009-08-22 10:16:44 UTC (rev 8) @@ -1,7 +0,0 @@ -#include - -int -main() -{ - printf("Hello world.\n"); -} From noreply在list.moon.ossxp.com Sat Aug 22 18:19:28 2009 From: noreply在list.moon.ossxp.com (user1) Date: Sat, 22 Aug 2009 18:19:28 +0800 Subject: [Hello-commit] r9 - trunk/src Message-ID: Author: user1 Date: 2009-08-22 18:19:28 +0800 (六, 2009-08-22) New Revision: 9 Modified: trunk/src/main.c Log: Fixed #6: using getopt to parse options. 已修改: trunk/src/main.c =================================================================== --- trunk/src/main.c 2009-08-22 10:16:44 UTC (rev 8) +++ trunk/src/main.c 2009-08-22 10:19:28 UTC (rev 9) @@ -1,4 +1,5 @@ #include +#include int usage(int code) { @@ -18,12 +19,41 @@ int main(int argc, char **argv) { - if (argc == 1) { + int c; + char *uname = NULL; + + while (1) { + int option_index = 0; + static struct option long_options[] = { + {"help", 0, 0, 'h'}, + {0, 0, 0, 0} + }; + + c = getopt_long(argc, argv, "h", + long_options, &option_index); + if (c == -1) + break; + + switch (c) { + case 'h': + return usage(0); + default: + return usage(1); + } + } + + if (optind < argc) { + uname = argv[optind]; + } + + if (uname == NULL) { printf ("Hello world.\n"); - } else if ( strcmp(argv[1],"-h") == 0 || - strcmp(argv[1],"--help") == 0 ) { - return usage(0); } else { - printf ("Hi, %s.\n", argv[1]); + printf ("Hi, %s.\n", uname); } } + + +/* + * vim: et ts=4 sw=4 + */ From noreply在list.moon.ossxp.com Sat Aug 22 18:22:20 2009 From: noreply在list.moon.ossxp.com (user1) Date: Sat, 22 Aug 2009 18:22:20 +0800 Subject: [Hello-commit] r10 - trunk/src Message-ID: Author: user1 Date: 2009-08-22 18:22:20 +0800 (六, 2009-08-22) New Revision: 10 Added: trunk/src/COPYRIGHT Log: Fixed #7: add copyright info. 已增加: trunk/src/COPYRIGHT =================================================================== --- trunk/src/COPYRIGHT (rev 0) +++ trunk/src/COPYRIGHT 2009-08-22 10:22:20 UTC (rev 10) @@ -0,0 +1 @@ +Copyright Jiang Xin , 2009. Property changes on: trunk/src/COPYRIGHT ___________________________________________________________________ 已增加: svn:eol-style + native From noreply在list.moon.ossxp.com Sat Aug 22 18:24:56 2009 From: noreply在list.moon.ossxp.com (user1) Date: Sat, 22 Aug 2009 18:24:56 +0800 Subject: [Hello-commit] r11 - tags Message-ID: Author: user1 Date: 2009-08-22 18:24:56 +0800 (六, 2009-08-22) New Revision: 11 Added: tags/version-2.0.0/ Log: New tag: version-2.0.0 From noreply在list.moon.ossxp.com Sat Aug 22 18:25:40 2009 From: noreply在list.moon.ossxp.com (jiangxin) Date: Sat, 22 Aug 2009 18:25:40 +0800 Subject: [Hello-commit] r12 - branches Message-ID: Author: jiangxin Date: 2009-08-22 18:25:40 +0800 (六, 2009-08-22) New Revision: 12 Added: branches/2.0.x/ Log: New branch: 2.0.x