LinuxÏÂÍê³ÉµÄÒ»¸ö×÷Òµ³ÌÐò
Îĵµ´´½¨ÈÕÆÚ£º2010-02-19
01 // P174: 2.±à³ÌÌâ (13)²»ÀûÓÃstrcmpº¯Êý£¬×Ô¼º±à³ÌʵÏÖÁ½¸öÈÎÒâ×Ö·û´®µÄ±È½Ï¡£
02
03 // The beginning of C program: test06-13.c.
04
05 // Header files included.
06 #include <stdio.h>
07
08 // Macro definition.
09 #define MAX_SIZE 100
10
11 // No.1: Subroutine: int getstr ( char ch[], int size );
12 int getstr ( char ch[], int size )
13 {
14 int i=0;
15 if ( size >= MAX_SIZE )
16 {
17 printf ( "Input error, data will overflow!\n" );
18 return (0);
19 }
20 do
21 {
22 ch[i] = getchar();
23 i++;
24 } while ( ch[i-1] != '\n' );
25 ch[i-1] = '\0';
26 // ·µ»Ø0±íʾµ÷Óøú¯ÊýÀ´»ñÈ¡×Ö·û´®Ê±»ñÈ¡Ê
Ïà¹ØÎĵµ£º
²é¿´ÏµÍ³µÄ´ÅÅÌÐÅÏ¢£º
fdisk -l
[root@localhost home]# fdisk -l
Disk /dev/hda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 83 Linux
/dev/hda2 14 979 7759395 ......
ÔÚÖ´ÐÐmake menuconfig ÃüÁî½øÐÐÄÚºËÅäÖÃʱ£¬Êä³öÏÂÃæµÄ³ö´íÐÅÏ¢£º
yyh:~/clfs/sources/linux-2.6.17.13$ make ARCH=i386 CROSS_COMPILE=${CLFS_TARGET}- menuconfig
HOSTCC scripts/basic/fixdep
HOSTCC scripts/basic/split-include
HOSTCC scripts/basic/docproc
HOSTCC scripts/kconfig/conf.o
HOSTCC scri ......
Îĵµ´´½¨ÈÕÆÚ£º2010-02-19
£ÛÎļþ1: test06-08.c£Ý
01 // P174: 2.±à³ÌÌâ (8)°ÑÓÐÐòµÄÁ½¸öÊý×éaºÍbºÏ²¢£¬ÒªÇóºÏ²¢ºóµÄÊý×éÒÀÈ»ÓÐÐò
02
03 // The beginning of C program: test06-08.c.
&nbs ......
Îĵµ´´½¨ÈÕÆÚ£º2010-02-19
001 // P174: 2.±à³ÌÌâ (9)½«Êý×éaÖÐÏàÍ¬ÔªËØÖ»±£ÁôµÚÒ»¸ö£¬ÆäÓàɾ³ý¡£
002
003 // The beginning of C program: test06-09.c.
004
005  ......
#include <linux/module.h>
MODULE_LICENSE("GPL");
static void hello_init(void);
static void hello_exit(void);
static void hello_init(void)
{
printk("init");
}
static void hello_exit(void)
{
printk("exit");
}
.
module_init(hello_init);
m ......