mirror of
https://github.com/javalsai/lidm.git
synced 2025-08-30 18:08:00 +02:00
feat(chvt): use custom implementation instead of system()
Calling system() is vulnerable and shouldn't be used.
This commit is contained in:
21
include/chvt.h
Normal file
21
include/chvt.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef _CHVTH_
|
||||
#define _CHVTH_
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define KDGKBTYPE 0x4b33
|
||||
#define VT_ACTIVATE 0x5606
|
||||
#define VT_WAITACTIVE 0x5607
|
||||
|
||||
/**
|
||||
* @brief change foreground virtual terminal to `n`
|
||||
*
|
||||
* @param n virtual terminal number
|
||||
* @return int non-negative value on success
|
||||
*/
|
||||
int chvt(int n);
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user