免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 3298 | 回复: 13
打印 上一主题 下一主题

vi中汉字的问题 [复制链接]

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2004-08-24 15:00 |只看该作者 |倒序浏览
用vi看源程序的时候,如果注释是汉字的,当光标移过的时候汉字就会变乱码,这个问题有人遇到过吗?应该怎么解决?

论坛徽章:
0
2 [报告]
发表于 2004-08-24 15:06 |只看该作者

vi中汉字的问题

你得看看你的console是不是能支持汉字显示。
另外……我的vi一直都很少显示中文(看代码一般都是英文的,我写代码,注释也用英文,至于为什么……因为我懒得切换输入法……而且我的console不支持中文)

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
3 [报告]
发表于 2004-08-24 15:09 |只看该作者

vi中汉字的问题

应该可以支持汉字的显示吧。偶是用SCRT连上去的。打开文件的时候汉字都是好好的,光标一过就乱码了。

论坛徽章:
0
4 [报告]
发表于 2004-08-24 15:22 |只看该作者

vi中汉字的问题

[quote]原帖由 "aero"]应该可以支持汉字的显示吧。偶是用SCRT连上去的。打开文件的时候汉字都是好好的,光标一过就乱码了。[/quote 发表:
知道我面对这种情况会怎么做吗?忍!嘿嘿~我对编程环境的要求很朴素~至今我的console还不能显示中文呢~所以对于我这种人来说,一个能编辑ASCII 有缩进,有高亮的编辑器来编辑代码就不错了~
嘿嘿~~

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
5 [报告]
发表于 2004-08-24 15:30 |只看该作者

vi中汉字的问题

^_^,其实偶对环境要求也是很朴素地。他们现在都在win上用editplus编辑,然后ftp上去了,很方便的。但是偶就不喜欢用,呵呵,偶还是喜欢vi的手不动地方的方式。^_^。

问题找到了,但似乎无法解决。是SCRT的问题,把滚动条滚上去在滚下来就好了。

论坛徽章:
0
6 [报告]
发表于 2004-08-24 17:00 |只看该作者

vi中汉字的问题

Secure CRT有这个问题,
Secure Netterm显示是没有问题的。
推荐一下Secure Netterm:)

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
7 [报告]
发表于 2004-08-24 17:02 |只看该作者

vi中汉字的问题

呵呵,好用吗?发偶一份。

论坛徽章:
0
8 [报告]
发表于 2004-08-24 17:27 |只看该作者

vi中汉字的问题

已发送,请查收。

论坛徽章:
0
9 [报告]
发表于 2004-08-24 17:58 |只看该作者

vi中汉字的问题

呵呵~
偶以前是在windows上用Source Insight写代码,然后用cvs和一个linux服务器上的代码同步,接着用netterm去telnet到linux上,然后编译~呵呵~当初在那个地方网络条件好啊~如今在家只能用vi gcc gdb make了……不过也不错啦~早就习惯了~只是……目前发现,gdb不能调试多进程的东西,搞的我现在焦头烂额……加上我经常马马虎虎,所以子进程中的测试代码总是忘了删……程序运行时候总莫名其妙的建立几个文件,然后往里面写东西(那本来是用来测试的……)。所以……搭车问一下:谁能推荐一个能够调试多进程的调试器?

论坛徽章:
0
10 [报告]
发表于 2004-08-24 21:49 |只看该作者

vi中汉字的问题

模仿VC中的_DEBUG宏,写线程安全的打印宏TRACE。

很多时候调试起来还要靠这些东西,特别是多线程的时候。
将输出分级,请参考如下代码中的级别。
另外,配合配置文件,指定输出级别和模块。比如配置文件:
DebugLevel = 3
DebugAllModule = true
DebugLogFile = true
NoDebugModule =  
DebugModule = Hello.cpp,\
                Hello2.cpp,\
                Hello3.cpp

WithFileName = true
WithLineNumber = false

表示输出级别为3,所有大于3的级别都不会有输出了。
另外,输出中会带有文件名、线程号,调试起多线程来很有力。
如果不是debug版,这个宏会被屏蔽。

以下的代码在windows和linux中通过
Trace.h


  1. // **********************************************************************
  2. //
  3. // Copyright (c) 2001-2004
  4. // StarMiddleware.net
  5. // www.StarMiddleware.net
  6. //
  7. // All Rights Reserved
  8. //
  9. // Author: Wang Kebo    mep AT 263.net
  10. // Author: Huang Jie    huangjie AT email.com
  11. // Author: Su Liang     centuryfree AT yahoo.com.cn
  12. //
  13. // **********************************************************************

  14. // Version: 1.0.0

  15. #ifndef __Trace_h__
  16. #define __Trace_h__

  17. #ifdef _DEBUG

  18. //LEVEL0:关闭所有输出;
  19. //LEVEL1:发生致命错或异常(使得系统不可能继续运行下去);
  20. //LEVEL2:发生错误或异常,需要提示用户;
  21. //LEVEL3:输出系统运行的提示信息(比如:系统启动);
  22. //LEVEL4:指明系统正在进行的比较具体的动作(比如:容器初始化);
  23. //LEVEL5:输出trace的具体的位置,比如:输出方法名;
  24. //LEVEL6:输出具体的参数的值;

  25. #define LEVEL0 0
  26. #define LEVEL1 1
  27. #define LEVEL2 2
  28. #define LEVEL3 3
  29. #define LEVEL4 4
  30. #define LEVEL5 5
  31. #define LEVEL6 6

  32. #include <stdio.h>;
  33. #include <string.h>;
  34. #include <assert.h>;

  35. extern int debugLevel;
  36. extern char* debugModule;
  37. extern char* noDebugModule;
  38. extern bool debugAllModule;
  39. extern bool debugLogFile;
  40. extern bool withFileName;
  41. extern bool withLineNumber;
  42. extern FILE* log;

  43. char* noPathFileName(char* file);
  44. bool checkDebugLevel(int lvl);
  45. bool checkModule(const char* file);

  46. #ifdef WIN32

  47. #include <Windows.h>;
  48. #define _THREAD_ID GetCurrentThreadId()

  49. #define _SPIN_LOCK_STRING \
  50.                 __asm{ \
  51.                         __asm L1: \
  52.                                 __asm lock dec lock_ \
  53.                                 __asm js L2 \
  54.                                 __asm jmp L3 \
  55.                         __asm L2: \
  56.                                 __asm cmp lock_ ,0x0  \
  57.                                 __asm rep nop \
  58.                                 __asm jle L2 \
  59.                                 __asm jmp L1 \
  60.                         __asm L3: \
  61.                         }

  62. #define _SPIN_UNLOCK_STRING __asm{ \
  63.                                                                 __asm mov lock_, 0x1 \
  64.                                                                 }

  65. #else /*#ifdef WIN32*/

  66. #include <pthread.h>;
  67. #define _THREAD_ID pthread_self()

  68. #ifdef LINUX

  69. #define _SPIN_LOCK_STRING \
  70.         __asm__ __volatile__( \
  71.         "\n1:\t" \
  72.         "lock ; decb %0\n\t" \
  73.         "js 2f\n" \
  74.         ".subsection 1\n" \
  75.         "2:\t" \
  76.         "cmpb $0,%0\n\t" \
  77.         "rep;nop\n\t" \
  78.         "jle 2b\n\t" \
  79.         "jmp 1b\n" \
  80.         ".subsection 0\n" \
  81.         :"=m" (lock_) : : "memory" \
  82.         );

  83. #define _SPIN_UNLOCK_STRING \
  84.         __asm__ __volatile__( \
  85.         "movb $1,%0" \
  86.                 :"=m" (lock->;lock) : : "memory" \
  87.         );

  88. #endif /*#ifdef LINUX*/

  89. #define _SPIN_LOCK_STRING
  90. #define _SPIN_UNLOCK_STRING

  91. #endif /*#ifdef WIN32*/

  92. extern volatile unsigned int lock_;

  93. class SpinLock
  94. {
  95. public:
  96.         SpinLock(){ _SPIN_LOCK_STRING }
  97.         ~SpinLock(){ _SPIN_UNLOCK_STRING }
  98. };

  99. #define _TRACE_BEGIN(lvl)        do{ \
  100.                                                         if(checkDebugLevel(lvl) && \
  101.                                                                 checkModule(noPathFileName(__FILE__))) \
  102.                                                         { \
  103.                                                                 SpinLock lock;

  104. #define _TRACE_END                } \
  105.                                         } while(0)

  106. #define TRACE0(lvl,s)        _TRACE_BEGIN(lvl) \
  107.                                                 if(log != NULL) \
  108.                                                 { \
  109.                                                         if(withFileName) \
  110.                                                         { \
  111.                                                                 fprintf(log,"%s",__FILE__); \
  112.                                                         } \
  113.                                                         if(withLineNumber) \
  114.                                                         { \
  115.                                                                 fprintf(log," %d",__LINE__); \
  116.                                                         } \
  117.                                                         if(withFileName||withLineNumber) \
  118.                                                                 fprintf(log,"\n"); \
  119.                                                         fprintf(log,"T@%d ",_THREAD_ID); \
  120.                                                         fprintf(log,s); \
  121.                                                         fflush(log); \
  122.                                                 } \
  123.                                                 else \
  124.                                                 { \
  125.                                                         if(withFileName) \
  126.                                                         { \
  127.                                                                 printf("%s",__FILE__); \
  128.                                                         } \
  129.                                                         if(withLineNumber) \
  130.                                                         { \
  131.                                                                 printf(" %d",__LINE__); \
  132.                                                         } \
  133.                                                         if(withFileName||withLineNumber) \
  134.                                                                 printf("\n"); \
  135.                                                         printf("T@%d ",_THREAD_ID); \
  136.                                                         printf(s); \
  137.                                                 } \
  138.                                                 _TRACE_END

  139. #define TRACE1(lvl,s,v1)        _TRACE_BEGIN(lvl) \
  140.                                                 if(log != NULL) \
  141.                                                 { \
  142.                                                         if(withFileName) \
  143.                                                         { \
  144.                                                                 fprintf(log,"%s",__FILE__); \
  145.                                                         } \
  146.                                                         if(withLineNumber) \
  147.                                                         { \
  148.                                                                 fprintf(log," %d",__LINE__); \
  149.                                                         } \
  150.                                                         if(withFileName||withLineNumber) \
  151.                                                                 fprintf(log,"\n"); \
  152.                                                         fprintf(log,"T@%d ",_THREAD_ID); \
  153.                                                         fprintf(log,s,v1); \
  154.                                                         fflush(log); \
  155.                                                 } \
  156.                                                 else \
  157.                                                 { \
  158.                                                         if(withFileName) \
  159.                                                         { \
  160.                                                                 printf("%s",__FILE__); \
  161.                                                         } \
  162.                                                         if(withLineNumber) \
  163.                                                         { \
  164.                                                                 printf(" %d",__LINE__); \
  165.                                                         } \
  166.                                                         if(withFileName||withLineNumber) \
  167.                                                                 printf("\n"); \
  168.                                                         printf("T@%d ",_THREAD_ID); \
  169.                                                         printf(s,v1); \
  170.                                                 } \
  171.                                                 _TRACE_END

  172. #define TRACE2(lvl,s,v1,v2)        _TRACE_BEGIN(lvl) \
  173.                                                 if(log != NULL) \
  174.                                                 { \
  175.                                                         if(withFileName) \
  176.                                                         { \
  177.                                                                 fprintf(log,"%s",__FILE__); \
  178.                                                         } \
  179.                                                         if(withLineNumber) \
  180.                                                         { \
  181.                                                                 fprintf(log," %d",__LINE__); \
  182.                                                         } \
  183.                                                         if(withFileName||withLineNumber) \
  184.                                                                 fprintf(log,"\n"); \
  185.                                                         fprintf(log,"T@%d ",_THREAD_ID); \
  186.                                                         fprintf(log,s,v1,v2); \
  187.                                                         fflush(log); \
  188.                                                 } \
  189.                                                 else \
  190.                                                 { \
  191.                                                         if(withFileName) \
  192.                                                         { \
  193.                                                                 printf("%s",__FILE__); \
  194.                                                         } \
  195.                                                         if(withLineNumber) \
  196.                                                         { \
  197.                                                                 printf(" %d",__LINE__); \
  198.                                                         } \
  199.                                                         if(withFileName||withLineNumber) \
  200.                                                                 printf("\n"); \
  201.                                                         printf("T@%d ",_THREAD_ID); \
  202.                                                         printf(s,v1,v2); \
  203.                                                 } \
  204.                                                 _TRACE_END

  205. #define TRACE3(lvl,s,v1,v2,v3)        _TRACE_BEGIN(lvl) \
  206.                                                 if(log != NULL) \
  207.                                                 { \
  208.                                                         if(withFileName) \
  209.                                                         { \
  210.                                                                 fprintf(log,"%s",__FILE__); \
  211.                                                         } \
  212.                                                         if(withLineNumber) \
  213.                                                         { \
  214.                                                                 fprintf(log," %d",__LINE__); \
  215.                                                         } \
  216.                                                         if(withFileName||withLineNumber) \
  217.                                                                 fprintf(log,"\n"); \
  218.                                                         fprintf(log,"T@%d ",_THREAD_ID); \
  219.                                                         fprintf(log,s,v1,v2,v3); \
  220.                                                         fflush(log); \
  221.                                                 } \
  222.                                                 else \
  223.                                                 { \
  224.                                                         if(withFileName) \
  225.                                                         { \
  226.                                                                 printf("%s",__FILE__); \
  227.                                                         } \
  228.                                                         if(withLineNumber) \
  229.                                                         { \
  230.                                                                 printf(" %d",__LINE__); \
  231.                                                         } \
  232.                                                         if(withFileName||withLineNumber) \
  233.                                                                 printf("\n"); \
  234.                                                         printf("T@%d ",_THREAD_ID); \
  235.                                                         printf(s,v1,v2,v3); \
  236.                                                 } \
  237.                                                 _TRACE_END

  238. #define TRACE4(lvl,s,v1,v2,v3,v4)        _TRACE_BEGIN(lvl) \
  239.                                                 if(log != NULL) \
  240.                                                 { \
  241.                                                         if(withFileName) \
  242.                                                         { \
  243.                                                                 fprintf(log,"%s",__FILE__); \
  244.                                                         } \
  245.                                                         if(withLineNumber) \
  246.                                                         { \
  247.                                                                 fprintf(log," %d",__LINE__); \
  248.                                                         } \
  249.                                                         if(withFileName||withLineNumber) \
  250.                                                                 fprintf(log,"\n"); \
  251.                                                         fprintf(log,"T@%d ",_THREAD_ID); \
  252.                                                         fprintf(log,s,v1,v2,v3,v4); \
  253.                                                         fflush(log); \
  254.                                                 } \
  255.                                                 else \
  256.                                                 { \
  257.                                                         if(withFileName) \
  258.                                                         { \
  259.                                                                 printf("%s",__FILE__); \
  260.                                                         } \
  261.                                                         if(withLineNumber) \
  262.                                                         { \
  263.                                                                 printf(" %d",__LINE__); \
  264.                                                         } \
  265.                                                         if(withFileName||withLineNumber) \
  266.                                                                 printf("\n"); \
  267.                                                         printf("T@%d ",_THREAD_ID); \
  268.                                                         printf(s,v1,v2,v3,v4); \
  269.                                                 } \
  270.                                                 _TRACE_END

  271. #define TRACE5(lvl,s,v1,v2,v3,v4,v5)        _TRACE_BEGIN(lvl) \
  272.                                                 if(log != NULL) \
  273.                                                 { \
  274.                                                         if(withFileName) \
  275.                                                         { \
  276.                                                                 fprintf(log,"%s",__FILE__); \
  277.                                                         } \
  278.                                                         if(withLineNumber) \
  279.                                                         { \
  280.                                                                 fprintf(log," %d",__LINE__); \
  281.                                                         } \
  282.                                                         if(withFileName||withLineNumber) \
  283.                                                                 fprintf(log,"\n"); \
  284.                                                         fprintf(log,"T@%d ",_THREAD_ID); \
  285.                                                         fprintf(log,s,v1,v2,v3,v4,v5); \
  286.                                                         fflush(log); \
  287.                                                 } \
  288.                                                 else \
  289.                                                 { \
  290.                                                         if(withFileName) \
  291.                                                         { \
  292.                                                                 printf("%s",__FILE__); \
  293.                                                         } \
  294.                                                         if(withLineNumber) \
  295.                                                         { \
  296.                                                                 printf(" %d",__LINE__); \
  297.                                                         } \
  298.                                                         if(withFileName||withLineNumber) \
  299.                                                                 printf("\n"); \
  300.                                                         printf("T@%d ",_THREAD_ID); \
  301.                                                         printf(s,v1,v2,v3,v4,v5); \
  302.                                                 } \
  303.                                                 _TRACE_END

  304. #define TRACE6(lvl,s,v1,v2,v3,v4,v5,v6)        _TRACE_BEGIN(lvl) \
  305.                                                 if(log != NULL) \
  306.                                                 { \
  307.                                                         if(withFileName) \
  308.                                                         { \
  309.                                                                 fprintf(log,"%s",__FILE__); \
  310.                                                         } \
  311.                                                         if(withLineNumber) \
  312.                                                         { \
  313.                                                                 fprintf(log," %d",__LINE__); \
  314.                                                         } \
  315.                                                         if(withFileName||withLineNumber) \
  316.                                                                 fprintf(log,"\n"); \
  317.                                                         fprintf(log,"T@%d ",_THREAD_ID); \
  318.                                                         fprintf(log,s,v1,v2,v3,v4,v5,v6); \
  319.                                                         fflush(log); \
  320.                                                 } \
  321.                                                 else \
  322.                                                 { \
  323.                                                         if(withFileName) \
  324.                                                         { \
  325.                                                                 printf("%s",__FILE__); \
  326.                                                         } \
  327.                                                         if(withLineNumber) \
  328.                                                         { \
  329.                                                                 printf(" %d",__LINE__); \
  330.                                                         } \
  331.                                                         if(withFileName||withLineNumber) \
  332.                                                                 printf("\n"); \
  333.                                                         printf("T@%d ",_THREAD_ID); \
  334.                                                         printf(s,v1,v2,v3,v4,v5,v6); \
  335.                                                 } \
  336.                                                 _TRACE_END

  337. #define ASSERT(exp) assert(exp)

  338. class InitHelper
  339. {
  340.         void LoadProfile();
  341. public:
  342.         InitHelper();
  343. };

  344. #else /*#ifdef _DEBUG*/

  345. #define TRACE0(lvl,s)
  346. #define TRACE1(lvl,s,v1)
  347. #define TRACE2(lvl,s,v1,v2)
  348. #define TRACE3(lvl,s,v1,v2,v3)
  349. #define TRACE4(lvl,s,v1,v2,v3,v4)
  350. #define TRACE5(lvl,s,v1,v2,v3,v4,v5)
  351. #define TRACE6(lvl,s,v1,v2,v3,v4,v5,v6)

  352. #define ASSERT(exp)

  353. #endif /*#ifdef _DEBUG*/

  354. #endif /*#ifndef __Trace_h__*/
复制代码



Trace.cpp


  1. // **********************************************************************
  2. //
  3. // Copyright (c) 2001-2004
  4. // StarMiddleware.net
  5. // www.StarMiddleware.net
  6. //
  7. // All Rights Reserved
  8. //
  9. // Author: Wang Kebo    mep AT 263.net
  10. // Author: Huang Jie    huangjie AT email.com
  11. // Author: Su Liang     centuryfree AT yahoo.com.cn
  12. //
  13. // **********************************************************************

  14. // Version: 1.0.0

  15. #ifdef _DEBUG

  16. #include <Trace.h>;
  17. #include <stdlib.h>;

  18. #ifdef WIN32
  19. #include <direct.h>;
  20. #include <windows.h>;
  21. #else
  22. #include <unistd.h>;
  23. #endif

  24. int debugLevel = LEVEL6;
  25. bool debugAllModule = false;
  26. bool withFileName = false;
  27. bool withLineNumber = false;
  28. bool debugLogFile = false;
  29. char* debugModule = NULL;
  30. char* noDebugModule = NULL;

  31. FILE* log = NULL;

  32. volatile unsigned int lock_ = 1;

  33. InitHelper dummy;

  34. char* noPathFileName(char* file)
  35. {
  36.         char* tempName = file;
  37.         char* noPathName = file;

  38. #ifdef WIN32
  39.         while(tempName = strstr(tempName,"\\"))
  40. #else
  41.         while(tempName = strstr(tempName,"/"))
  42. #endif
  43.         {
  44.                 noPathName = ++tempName;
  45.         }

  46.         return noPathName;
  47. }

  48. bool checkDebugLevel(int lvl)
  49. {
  50.         if( lvl <= debugLevel )
  51.                 return true;
  52.         else
  53.                 return false;
  54. }

  55. bool checkModule(const char* file)
  56. {
  57.         char* copy = _strlwr(_strdup((char*)file));
  58.         if(noDebugModule != NULL)
  59.         {
  60.                 if(strstr(_strlwr(noDebugModule),copy))
  61.                 {
  62.                         free(copy);
  63.                         return false;
  64.                 }
  65.         }

  66.         if(debugAllModule)
  67.         {
  68.                 free(copy);
  69.                 return true;
  70.         }

  71.         if(debugModule == NULL)
  72.         {
  73.                 free(copy);
  74.                 return false;
  75.         }

  76.         if(strstr(_strlwr(debugModule),copy))
  77.         {
  78.                 free(copy);
  79.                 return true;
  80.         }
  81.         else
  82.         {
  83.                 free(copy);
  84.                 return false;
  85.         }
  86. }

  87. InitHelper::InitHelper()
  88. {
  89.         const char* homeDir = getenv("CCM_HOME");
  90.        
  91.         if(homeDir != NULL && strcmp(homeDir, "") != 0)
  92.         {
  93.                 chdir(homeDir);
  94.         }
  95.         else
  96.         {
  97.                 chdir("c:\\ccm_home");
  98.         }

  99.         LoadProfile();

  100.         if(debugLogFile)
  101.         {
  102.                 char exeName[128];
  103.                 #ifdef WIN32
  104.                 GetModuleFileName(NULL, exeName, 128);
  105.                 char* index;
  106.                 char* old = exeName;
  107.                 while(index = strstr(old, "\\"))
  108.                 {
  109.                         old = index + 1;
  110.                 }
  111.                 strcpy(exeName, old);
  112.                 exeName[strlen(exeName)-4] = 0;

  113.                 DWORD id = GetCurrentProcessId();
  114.                 sprintf(exeName + strlen(exeName), "%d",id);
  115.                 strcat(exeName, ".log");
  116.                 #else
  117.                 strcpy(exeName, "trace.log");
  118.                 #endif
  119.                 log = fopen(exeName,"w+");
  120.         }
  121. }

  122. void
  123. InitHelper::LoadProfile()
  124. {
  125.         char rawBuf[1024];
  126.         char buf[1024];
  127.         char skip;
  128.         char* value;
  129.         char* oldBuf = rawBuf;
  130.         char* newBuf = buf;

  131.         FILE* iniFile = fopen("DebugConfig.ini","r");

  132.         if(iniFile == NULL)
  133.         {
  134.                 printf("Can't open `DebugConfig.ini\' file.\n");
  135.                 return;
  136.         }

  137.         while(!feof(iniFile))
  138.         {
  139.                 oldBuf = rawBuf;
  140.                
  141.                 fread(oldBuf++,sizeof(char),1,iniFile);

  142.                 while(*(oldBuf-1) != '\n' && !feof(iniFile))
  143.                 {
  144.                         if(*(oldBuf-1) == '\\')
  145.                         {
  146.                                 oldBuf--;

  147.                                 do
  148.                                 {
  149.                                         fread(&skip,sizeof(char),1,iniFile);
  150.                                 } while(skip != '\n' && !feof(iniFile) );
  151.                         }

  152.                         fread(oldBuf++,sizeof(char),1,iniFile);
  153.                 }
  154.                
  155.                 if(!feof(iniFile))
  156.                 {
  157.                         if(*(oldBuf-1) == '\n')
  158.                                 *(oldBuf-1) = 0;
  159.                         else
  160.                                 *oldBuf =0;
  161.                 }
  162.                 else
  163.                         *(oldBuf-1) = 0;

  164.                 oldBuf = rawBuf;
  165.                 newBuf = buf;

  166.                 while(*oldBuf)
  167.                 {
  168.                         if((*oldBuf) != ' ' && (*oldBuf) != '\t')
  169.                         {
  170.                                 *newBuf = *oldBuf;
  171.                                 newBuf ++;
  172.                                 oldBuf ++;
  173.                         }
  174.                         else
  175.                                 oldBuf ++;
  176.                 }

  177.                 *newBuf = 0;
  178.                 //printf("%s\n",buf);

  179.                 if(strncmp(buf,"DebugLevel",strlen("DebugLevel"))==0)
  180.                 {
  181.                         value = buf + strlen("DebugLevel") + 1;
  182.                         debugLevel = atoi(value);
  183.                 }
  184.                 else if(strncmp(buf,"DebugAllModule",strlen("DebugAllModule"))==0)
  185.                 {
  186.                         value = buf + strlen("DebugAllModule") + 1;
  187.                         if(strcmp(value,"true") == 0)
  188.                                 debugAllModule = true;
  189.                         else if(strcmp(value,"false") == 0)
  190.                                 debugAllModule = false;
  191.                 }
  192.                 else if(strncmp(buf,"WithFileName",strlen("WithFileName"))==0)
  193.                 {
  194.                         value = buf + strlen("WithFileName") + 1;
  195.                         if(strcmp(value,"true") == 0)
  196.                                 withFileName = true;
  197.                         else if(strcmp(value,"false") == 0)
  198.                                 withFileName = false;
  199.                 }
  200.                 else if(strncmp(buf,"WithLineNumber",strlen("WithLineNumber"))==0)
  201.                 {
  202.                         value = buf + strlen("WithLineNumber") + 1;
  203.                         if(strcmp(value,"true") == 0)
  204.                                 withLineNumber = true;
  205.                         else if(strcmp(value,"false") == 0)
  206.                                 withLineNumber = false;
  207.                 }
  208.                 else if(strncmp(buf,"DebugLogFile",strlen("DebugLogFile"))==0)
  209.                 {
  210.                         value = buf + strlen("DebugLogFile") + 1;
  211.                         if(strcmp(value,"true") == 0)
  212.                                 debugLogFile = true;
  213.                         else if(strcmp(value,"false") == 0)
  214.                                 debugLogFile = false;
  215.                 }
  216.                 else if(strncmp(buf,"DebugModule",strlen("DebugModule"))==0)
  217.                 {
  218.                         value = buf + strlen("DebugModule") + 1;
  219.                         debugModule = strdup(value);
  220.                 }
  221.                 else if(strncmp(buf,"NoDebugModule",strlen("NoDebugModule"))==0)
  222.                 {
  223.                         value = buf + strlen("NoDebugModule") + 1;
  224.                         noDebugModule = strdup(value);
  225.                 }
  226.         }

  227.         fclose(iniFile);
  228. }

  229. #endif
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP