Browse Source

3.18

master
陈越 3 years ago
parent
commit
47c68ef79a
7 changed files with 34 additions and 24 deletions
  1. +0
    -2
      README.md
  2. +20
    -2
      fun.h
  3. +3
    -7
      fun_1.c
  4. +3
    -9
      fun_2.c
  5. BIN
      main
  6. +2
    -4
      main.c
  7. +6
    -0
      mytop.c

+ 0
- 2
README.md View File

@ -1,2 +0,0 @@
# Operating_System

+ 20
- 2
fun.h View File

@ -2,8 +2,26 @@
#define FUN_H_INCLUDED
#define MAXLINE (80)
#include "fun_2.c"
#include "fun_1.c"
void eval(char *cmdline);
void sigint_handler();
pid_t getpid(void);
pid_t main_proc_pid;
int Is_pipe(char **argv);
int pipe(int *fd);
int Is_redirect(char **argv);
void history(char *cmdline);
void print_history(char *argv);
int fork();
int close(int arg);
int dup(int fd);
int execvp(const char *, char * const *);
int wait(int arg);
int parseline(const char *cmdline, char **argv);
int builtin_cmd(char **argv);
int dup2(int fd, int arg);
int chdir(const char *path );
#endif // FUN_H_INCLUDED

+ 3
- 7
fun_1.c View File

@ -2,14 +2,9 @@
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include<fcntl.h>
#include <fcntl.h>
#include "mytop.c"
int parseline(const char *cmdline, char **argv);
int builtin_cmd(char **argv);
int dup2(int fd, int arg);
int chdir(const char *path );
#include "fun.h"
void eval(char *cmdline)
{
@ -41,6 +36,7 @@ void eval(char *cmdline)
printf("%s:Command not found.\n",argv[0]);
exit(0);
}
exit(0);
}
if(!isBg)
{

+ 3
- 9
fun_2.c View File

@ -1,15 +1,9 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include<fcntl.h>
void history(char *cmdline);
void print_his(char *argv);
int pipe(int *fd);
int fork();
int close(int arg);
int dup(int fd);
int execvp(const char *, char * const *);
int wait(int arg);
#include "fun.h"
static int num = 0;
static char storage[MAXLINE][MAXLINE];

BIN
main View File


+ 2
- 4
main.c View File

@ -2,10 +2,8 @@
#include <stdlib.h>
#include "fun.h"
void eval(char *cmdline);
void sigint_handler();
pid_t getpid(void);
pid_t main_proc_pid;
#include "fun_2.c"
#include "fun_1.c"
int main()
{

+ 6
- 0
mytop.c View File

@ -335,3 +335,9 @@ void mytop()
print_procs(prev_proc,proc,1);
return;
}
/*
void mytop()
{
}
*/

Loading…
Cancel
Save