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±íʾµ÷Óøú¯ÊýÀ´»ñÈ¡×Ö·û´®Ê±»ñÈ¡Ê
Ïà¹ØÎĵµ£º
Internet------(eth1)router1(eth2)------(eth1)router2(eth0)------(eth0)router3(eth1)------(eth0)pc
ÉÏÃæ¾ÍÊÇÎÒµÄÍøÂçÍØÆ˽ṹ£¬ÆäÖзÓÉÆ÷1ÊÇÓÃÀ´Á¬½ÓÍⲿÍøÂçµÄһ̨linux»úÆ÷£¬Í¼ÖÐËùÓзÓÉÆ÷¶¼ÊÇÆÕͨµÄpc»ú£¬ÕâЩpc¶¼°²×°ÁËubuntu×ÀÃæϵͳ£¬³ýÁË×îÓұߵÄpc£¬ÆäÓàµÄpc¶¼×°ÁË3ÕÅÍø¿¨£¨ÆäÖÐÒ»Õű¸Óã©¡£
ÓÉÓÚDebianϵ ......
LinuxϹػú×îÒªÓÐÒÔÏ·½·¨£¬ÎÒÏëÕâЩ·½·¨×ãÒÔÂú×ãÄãµÄÐèÒª£º
[root@localhost /]# shutdown [-tÃë] [-arkhcncfF] [ʱ¼ä] [ÌáʾÐÅÏ¢]
[root@localhost /]# shutdown -h 10 'I will shutdown after 10 mins'
-t sec : -t ºó¼ÓÃëÊý£¬¼´‘¹ý¼¸ÃëÖÓºó¹Ø»ú’µÄÒâ˼¡£
-k : ²»ÒªÕæµÄ¹Ø»ú£¬Ö»ÊÇ·¢ËÍÌáʾÐÅÏ¢¡£
......
Îĵµ´´½¨ÈÕÆÚ£º2010-02-19
01 // P173: 2.±à³ÌÌâ (7)
02
03 // The beginning of C program: test06-07.c.
04
05 // ......
#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 ......