⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 onoff.c

📁 中科院徐志伟老师一书《操作系统 原理·技术与编程》的源代码和习题接
💻 C
字号:
#include <fcntl.h>#include <unistd.h>#include <stdio.h>#include <string.h>#include <linux/ioport.h>#include "trlight.h"#include <asm/io.h>int value=0;void main (int argc, char** argv){        int fd;	if (argc<2){		printf("usage: onoff [1/0]\n");		exit(0);	}        fd=open("/dev/trlight",0);	sscanf(argv[1],"%d",&value);	printf("%d",value);	if (value==1)		value=TRLIGHT_START;	else if (value==0)		value=TRLIGHT_STOP;        ioctl(fd,value,0);	close(fd);		}					

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -