?? halt.cgi.c
字號:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>#include <sys/stat.h>#include <dirent.h>#include <pwd.h>#include <grp.h>#include <signal.h>#include <getopt.h>
int main()
{
char *lenstr;
char input[100];
long len; printf("Content-Type:text/html\n\n");//頭標信號 printf("<TITLE>系統(tǒng)關(guān)機</TITLE>\n"); printf("<HR>"); printf("<P>設(shè)備已關(guān)機</P>");
lenstr = getenv("CONTENT_LENGTH");
if(!lenstr)
printf("<P>系統(tǒng)無法正常關(guān)機!</P>");
else{
sscanf(lenstr,"%ld",&len);
fgets(input,len+1,stdin);
printf("%s\n",input);
if(strcmp(input,"halt=do")==0){
system("/bin/shutdown");
kill(-1, SIGTERM);
}
printf("<a href=../sys_form.html>返回首頁</a>");
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -