File: chexist.c

package info (click to toggle)
chdrv 1.0.13-0.1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 1,204 kB
  • ctags: 1,069
  • sloc: ansic: 8,972; perl: 412; asm: 234; makefile: 195; sh: 36
file content (29 lines) | stat: -rw-r--r-- 466 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <sys/ioctl.h>
#include <fcntl.h>
#include <signal.h>
#include <unistd.h>
#include <sys/vt.h>
#include <sys/kd.h>
#include "chinese.h"
extern int chinese_mod;

check_if_chinese_exist()
{
  FILE *fp;
  int pid;

  fp = fopen("/var/run/chdrv.pid",O_RDONLY);
  if (fp == NULL)
    chinese_mod = 0;
  else
    {
      fscanf(fp,"%d",&pid);
      fclose(fp);
      if (kill(pid,0)==0)
	chinese_mod = 1;
      else
	chinese_mod = 0;
    }
  return chinese_mod;
}