📄 types.h
字号:
/* This file define the common structers which used in job control */
#if! defined (__TYPES_H_)
#define __TYPES_H_
#include <glob.h>
#include <sys/types.h>
enum redirection_type {
REDIRECT_READ, REDIRECT_OVERWRITE,
REDIRECT_APPEND, REDIRECT_READWRITE
};
/* Structure describing a redirection. */
struct redirection_specifier
{
enum redirection_type type;
int fd; /* File descriptor */
char *filename; /* File name */
};
/* Each child of the shell is remembered in a STRUCT PROCESS. */
typedef struct process {
pid_t pid; /* Process ID. */
int is_stopped; /* Non-zero if this process is running. */
char **argv; /* The particular program that is running. */
int num_redirections;
struct redirection_specifier *redirections;
glob_t glob_result;
int free_glob;
} PROCESS;
typedef struct job {
int id; /* Job ID. */
int num_progs; /* Number of the programs in this job. */
int running_progs; /* Number of the programs still running in this job. */
pid_t pgrp; /* The process ID of the process group (necessary). */
PROCESS *progs; /* The pipeline of processes that make up this job. */
struct job *next;
int stopped_progs;
char *text;
char *cmd_buf;
} JOB;
/* Chain of the jobs */
typedef struct job_set {
JOB *head; /* The head of the chain. */
JOB *fg; /* The job which currently running in foreground. */
} CHAIN;
extern CHAIN job_list;
#endif /* __TYPES_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -