ivaneeo's blog

自由的力量,自由的生活。

  BlogJava :: 首页 :: 联系 :: 聚合  :: 管理
  669 Posts :: 0 Stories :: 64 Comments :: 0 Trackbacks
hello.c
#include <stdio.h>
int main(void)
{
  char msg[ ] = "Hello Linux programmer!";
  puts(msg);
  printf("Here you are, using diff.\n");

  return 0;
}

howdy.c
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
  char msg[ ] = "Hello, linux programmer, from howdy.c";
  puts(msg);
  printf("howdy.c says, 'Here you are using diff.'\n");
  exit(EXIT_SUCCESS);
}
使用diff的基本语法产生的输出(在下面"理解正规输出格式"部分所介绍的为正规格式)是:
$diff hello.c howdy.c
la2
> #include <stdlib.h>
5c6
<   char msg[ ] = "Hello, Linux programmer!";
---
>   char msg[ ] = "Hello, Linux programmer, from howdy.c!";
8c9
<   printf("Here you are, using diff.\n");
---
>   printf("howdy.c says, 'Here you are, using diff.'\n");
10c11
<   return 0;
---
>   exit(EXIT_SUCCESS);
diff能够产生几种输出格式,包括正规(normal,也是diff默认的市场格式),上下文(context),统一(unified)以及并排(side-by-side)4种.
posted on 2005-08-04 17:23 ivaneeo 阅读(135) 评论(0)  编辑  收藏 所属分类: GNU牛力

只有注册用户登录后才能发表评论。


网站导航: