2009年3月31日星期二

My a small Shell.

/* You can see here */
/* a simple shell */
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <string.h>
#include <errno.h>

#define SHELL_NAME "sh1"
#define PROMPT_ENVIRONMENT_VARIABLE "PROMPT"

char *prompt;

int main(int argc,char **argv)
{
char cmd[80];
int statval;

/*Dtermine prompt value.*/
if((prompt=getenv(PROMPT_ENVIRONMENT_VARIABLE))==NULL)
prompt=SHELL_NAME":";

/*Process commands until exit,or death by signal.*/
while(1) {
/*Prompt and read a command.*/
printf(prompt);
gets(cmd);

/*Process built-in commands.*/
if(strcasecmp(cmd,"exit")==0)
break;

/*Process non-built-in commands.*/
if(fork()==0) {
execlp(cmd,cmd,NULL);
fprintf(stderr,"%s:Exec%sfailed:%s\n",argv[0],cmd,strerror(errno));
exit(1);
}
wait(&statval);
if(WIFEXITED(statval)) {
if(WEXITSTATUS(statval)) {
fprintf(stderr,"%s:child exited with status %d.\n",argv[0],WEXITSTATUS(statval));
}
}
else {
fprintf(stderr,"%s:child died unexpectedly.\n",argv[0]);
}
}

}

My friend help me modify it, as follows:
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <string.h>
#include <errno.h>

#define SHELL_NAME "sh1"
#define SHELL_GETS(var) printf(prompt); gets(var)
#define SHELL_CMD(str) strcasecmp(cmd, str) == 0

char *prompt;

int main(int argc,char **argv)
{
char cmd[80];
int statval;

if(!(prompt = getenv("PROMPT")))
prompt = SHELL_NAME ": ";

while(1) {
SHELL_GETS(cmd);

if (SHELL_CMD("exit"))
break;

if (fork() == 0) {
execlp(cmd, cmd, NULL);
fprintf(stderr, "%s:Exec %sfailed:%s\n", argv[0], cmd, strerror(errno));
exit(1);
}

wait(&statval);

if (WIFEXITED(statval)) {
if (WEXITSTATUS(statval)) {
fprintf(stderr, "%s:child exited with status %d.\n", argv[0], WEXITSTATUS(statval));
}
}
else {
fprintf(stderr, "%s:child died unexpectedly.\n", argv[0]);
}
}

}

2009年3月30日星期一

My application

My name: gaowei
My email: xiyou.gaowei@gmail.com
My IRC nickname: weiwei
My Phone number: 13772035412
My Web page: http://gaoweige.blogspot.com/ 
My group club website: http://www.xiyoulinux.cn/

  I am a junior student in the Computer Network Department at Xi'an Institute of Post and Telecommunications in China.

  I have been using open source software on my computer for three years, and I like it because it helps me complete my work and studies every day.It helps me to learn much about software and computer devices.I can modify them to satisfy my needs.When I learned about operating systems, I wanted to program a small operating system.At the moment,I read a lot of library books and searched a sea of information on the internet. I know the Linux0.01 architecture and how to implement and compile it into my computer. In addition, I not only have some experience with Linux0.11 and Linux2.6.26, but I am also learning Linux2.6.28.So I have a great interest in the kernels of operating system. Of course, I skimmed over the codes of Minix and Free BSD. 

  I know that Minix is an excellent OS and is a new open-source OS designed to be highly reliable, flexible, secure, and what's more,is intended as a teaching tool. I programmed a simple shell and a small File System and wanted to use fewer lines of executable code to implement an OS. So I want to apply to take part in a program concerning the OS project. Then I can only utilise my knowledge, but also share my ideas and skills.

2009年3月28日星期六

install MINIX

Runnig Minix 3 on QEmu

You can download a Minix 3 ISO from the Download page, and set QEmu to install a machine from that ISO.
These instructions are to get MINIX 3 running under qemu 0.10-0-1 under Ubuntu Linux, but it should generally apply to other qemu installations under linux as well. First, use your package manager or other means to install qemu on your host operating system. Under Ubuntu you can use aptitude to install qemu as follows.

[root@localhost VMWARE]# qemu-img create minix.img 2G
Formating 'minix.img', fmt=raw, size=2097152 kB
[root@localhost VMWARE]# qemu -localtime -net user -net nic -m 128 -cdrom minix3_1_3a_ide_r2964.iso -hda minix.img -boot d
Could not open '/dev/kqemu' - QEMU acceleration layer not activated
[root@localhost VMWARE]#qemu -localtime -net user -net nic -m 256 -cdrom minix3_1_3a_ide_r2964.iso -hda minix.img -boot -c

Note:Don't move your *img to other place. If you do it,then it will error and don't boot in qemu for minix.

2009年3月25日星期三

GSOC我之所见

去年,大家(我们xiyoulinux兴趣小组)有很人想参加,但是只有我一个人坚持到最后,因为都是英文,都是高手,几乎没有我们表现的,也真说明了一点,我们的能力还是有待提高。那次之后,我对开源有了新的认识,也经常去一些社区看看!但是,还是没有真正的参与进去,今年,我想真正的参与进去,而不是为了什么名利,这次活动的主要动机也是让更多的人了解开源,参与开源。
昨天,磊子,告诉现在公司里面要的是可以干活的人,你那些参与人家认证吗?那也根本不能说明你的能力。对,很对,所以就更应该借助这个机会来提高自己的水平。要知道,开源里面是如何的沟通,如何的运作,如何吸引别人的,代码是如何高效的写出,是如何的管理代码,我们是要学这些。要选择一个自己喜欢的,哪怕自己现在没有能力,当然,我是不知望我可以被录取,我知道我的水平,我只是想参与开源,当然,即使没有GSOC我也应该参与开源项目的。这真是,磊子,说的经验,可以拿的出手的东西。一定要做,实践,专注。
对自己的要求,1.每天至少看一个小时;2.不要参与太多,一个就好了!3.重在参与,不断提高自己;4.一定要有可以拿出手的东西,来证明自己的实力!
好了!一点感悟!

2009年3月23日星期一

网页制作工具


我基本就不会写网页,但是这周,突然想写一个,所以找到如下的工具

Amaya是 一个具有浏览功能 的WEB开发工具,是由万维网协会(W3C)成员开发的一个网络浏览器,同时也可以作为对W3C成果的测试工具。Amaya包括了一个HTML编辑器和浏 览器,用户可以免费到W3C的网站下载它,在linux和windows下都有对应的版本。Amaya起初只支持HTML和CSS的编缉,现在已经添加了 对XML、XHTML、MathML、SVG等的支持。Amaya is intended to be a comprehensive client environment for testing and evaluating new proposals for Web standards and formats. A large part of the intended features of Amaya are implemented in this release, but some of them are not complete yet. Amaya is designed as an application on top of the Thot editing tool kit.
Bluefish,正如其项目主页上描述的那样,是一个功能强大的编缉程。你可以用它来设计网站,编写脚本和程序代码。Bluefish支持很多程序语言和标记语言,它最突出的特点在于编缉动态的交互式网站。Bluefish has many features, this list will give you an overview of the most important or outstanding features.
Quanta Plus 原 名叫Quanta,是一个WEB的集成开发环境(IDE),可以用于HTML、XHTML、CSS、XML、PHP和其它基于XML的语言或者是脚本语言 的开发。Quanta Plus是一个KDE的软件,包含于Kdewebdev软件包里。Quanta有可见即所得的设计模式和代码编缉模式两种开发模式。它的特点有:代码标签 提示功能,脚本语言的变量自动完成,项目管理,实时预览, PHP调试器,Quanta Plus is a highly stable and feature rich web development environment. The vision with Quanta has always been to start with the best architectural foundations, design for efficient and natural use and enable maximal user extensibility. We recognize that we don't have the resources to do everything we would like to so our target is to make it easy for you to help make this the best community based desktop application anywhere. Pretty much everything in Quanta is designed so you can extend it. Even the way it handles XML DTDs is based on XML files you can edit. You can even import DTDs, write scripts to manage editor contents, visually create dialogs for your scripts and assign script actions to nearly any file operation in a project. You can even look at and communicate with a wide range of what happens inside Quanta using DCOP.

KompoZer是一个基于Nvu的所见即所得的HTML编缉器。KompoZer是Sourceforge上的一个项目,它主要由社区修护。下面是从网络上摘录的关于KompoZer功能的介绍
支持所见即所得(WYSIWYG),在我们在制作网页时,更加的直观化,编辑网页就如同打字一样容易。内建一个FTP Client,让我们可以很轻易的把编辑好的文件发布到服务器上。登录FTP Server后,还支持在线实时更改页面。可靠的HTML原始码,让由Nvu所创建出来的网页,可以在当前多数的浏览器上正常运作。制作网页时,可以使用所见即所得模式或HTML原始码编辑模式。Tab功能:可以让我们很迅速的在多个页签间切换,并且编辑这些网页。支持表单、表格、layer以及网页模版。

还有SCREEM is a web development environment. It's purpose is to increase productivity when constructing a site, by providing quick access to commonly used features. While it is written for use with the GNOME desktop environment in mind it does not specifically require you to be running it, just have the libraries installed.

2009年3月19日星期四

网络&生活

有网络真的太好了!
现在,网络上有太多的机遇给你,所以,我们要马不停蹄的学习,而后运用我的知识,不要什么也想参与,什么也想学好,可能吗?估计,以我的能力是不可能实现的,现在就想少睡觉,多看看世界,多动手实践,好不至于以后输给自己啊!机会会越来越多,但是我们必须要有扎实的基本工,过人之处,不要盲目的羡慕别人。自己也要很多的优点,赢自己才是真正的赢!

网络中很多人帮助我,真的不错。

今天,感受了一下企业培训,企业培训主要是教你干什么,如何干,而学校教你这个可以干什么,是什么原理,而不教你具体的干,也要你锻炼的机会很少。所以再以后的学习过程中,应该把这二者结合起来,那样就无敌了!感觉,社会对专科和本科有明显的区别,名牌和不名牌也是,四级过的没有过的。很多事情当你真正的经历了从会更加深刻的体会到!其实,我有时在开导别人,其实,也在安慰自己,有时候自己,也何尝不是有很多忧愁的时候,只是不表现吧了!今天,上口语课,别人都可以用流利的英语对话,而我呢?就是讲不出来,当时,我就想我毕业了将如何呢?口语不好,对于那些好公司应该就会把我拒绝门外了。上课时候,我想要不,我毕业了去打工,而后,去做销售,然后转型,做生意,但是我这种性格真的适合搞推销嘛。我在很多方面已经尝试过了,编程,似乎真的不是很适合我,以后应该会改变我的道路。就不多说了!

关于ChatZila的使用,过去一般在网页里面和别人用IRC聊天,但是感觉很不好,最好采用了ChatZila感觉还比较好用。用法,简单介绍,在*client*里面输入/server 您要登录的频道,然后/join
#您要去的组就可以了,还是比较好用。其实,很多事情当我们熟练操作之后感觉一切不过如此的简单.

现在每天用这个聊天,而QQ就很少用了。啊哈!

奋发吧!不要唠叨了!

time