Esempio n. 1
1
File: main.c Progetto: taysom/tau
int main (int argc, char *argv[])
{
	int	c;

	setprogname(argv[0]);
	debugoff();
	init_shell(NULL);
	my_commands();

	while ((c = getopt(argc, argv, "dv?")) != -1) {
		switch (c) {
		case 'd':
			debugon();
			fdebugon();
			break;
		case 'v':
			Zerofill = TRUE;
			break;
		case '?':
		default:
			usage();
			exit(1);
			break;
		}
	}
	if (init_msg_tau(getprogname())) {
		fatal("Couldn't connect to messaging system");
	}
	switchboard();
	tag_loop();

	return 0;
}
Esempio n. 2
0
File: shell.c Progetto: 560944/hw1
int shell (int argc, char *argv[]) {
    char *s = malloc(INPUT_STRING_SIZE+1);			/* user input string */
    tok_t *t;			/* tokens parsed from input */
    int lineNum = 0;
    int fundex = -1;
    pid_t pid = getpid();		/* get current processes PID */
    pid_t ppid = getppid();	/* get parents PID */
    pid_t cpid, tcpid, cpgid;
https://onedrive.live.com/about/en-us/#
    init_shell();

    printf("%s running as PID %d under %d\n",argv[0],pid,ppid);

    lineNum=0;
    fprintf(stdout, "%d: ", lineNum);
    while ((s = freadln(stdin))) {
        t = getToks(s); /* break the line into tokens */
        fundex = lookup(t[0]); /* Is first token a shell literal */
        if(fundex >= 0) cmd_table[fundex].fun(&t[1]);
        else {
            //fprintf(stdout, "This shell only supports built-ins. Replace this to run programs as commands.\n");

            cmd_fork(t);


        }
        fprintf(stdout, "%d: ", lineNum);
    }
    return 0;
}
Esempio n. 3
0
File: shell.c Progetto: pucklife/hw1
int shell (int argc, char *argv[]) {
  char *s = malloc(INPUT_STRING_SIZE+1);			/* user input string */
  tok_t *t;			/* tokens parsed from input */
  int lineNum = 0;
  int fundex = -1;
  pid_t pid = getpid();		/* get current processes PID */
  pid_t ppid = getppid();	/* get parents PID */
  

  init_shell();
  
  char buf[1024];
  getcwd(buf, sizeof(buf));

  printf("%s running as PID %d under %d\n",argv[0],pid,ppid);

  
  fprintf(stdout, "%d:%s$ ", lineNum, buf);
  lineNum=1;
  while ((s = freadln(stdin))){
    t = getToks(s); /* break the line into tokens */
    fundex = lookup(t[0]); /* Is first token a shell literal */
    if(fundex >= 0) cmd_table[fundex].fun(&t[1]);
    else {
    	if(t[0]){
      		cmd_fork(t);
      	}
    }
    getcwd(buf, sizeof(buf));
    fprintf(stdout, "%d:%s$ ", lineNum, buf);
    lineNum++;
  }
  return 0;
}
Esempio n. 4
0
File: main.c Progetto: taysom/tau
int main (int argc, char *argv[])
{
	char	*dev_name = ".btree";

#if DEVELOPMENT
	debugon();
	fdebugon();
#else
	debugoff();
	fdebugoff();
#endif

FN;
	if (argc > 1) {
		dev_name = argv[1];
	}
	binit(20);

#if DEVELOPMENT
	unlink(dev_name);
#else
	blazy();
#endif

	start_string(dev_name);
	init_shell(quit_callback);
	init_cmd();
	return shell();
}
Esempio n. 5
0
File: main.c Progetto: taysom/tau
int main (int argc, char *argv[])
{
	char	*dev_name = ".btree";

#if DEVELOPMENT
	debugon();
	fdebugon();
#else
	debugoff();
	fdebugoff();
#endif

FN;
	if (argc > 1) {
		dev_name = argv[1];
	}
#if DEVELOPMENT
	unlink(dev);	/* Development only */
#endif
	binit(20);
	Dev = bopen(dev_name);
	if (!Dev) eprintf("Couldn't open %s:", dev_name);
	blazy(Dev);

	init_string(Dev);
	init_shell(quit_callback);
	init_cmd();
	return shell();
}
Esempio n. 6
0
int					main(int ac, char **av)
{
	t_env			envir;
	char			read_char[5];
	t_list			*list;
	int				i;

	tab_zero(read_char);
	i = 1;
	list = NULL;
	if (ac > 1)
	{
		while (i < ac)
		{
			list = list_add_end(list, list_new(av[i]));
			i++;
		}
		i = 1;
	}
	init_shell(&envir);
	print_ft_list(list);
	wait_key(read_char, &list, &envir);
	restore_term(&envir);
	exit(EXIT_SUCCESS);
	return (0);
}
Esempio n. 7
0
void  kernel_main(){
    arch::enable_sse();

    interrupt::install_idt();
    interrupt::install_isrs();
    interrupt::remap_irqs();
    interrupt::install_irqs();
    interrupt::enable_interrupts();

    e820::finalize_memory_detection();

    init_memory_manager();

    install_timer();
    //acpi::init();
    keyboard::install_driver();
    disks::detect_disks();

    //Call global cosntructors
    _init();

    //Launch the shell
    init_shell();

    return;
}
Esempio n. 8
0
int shell (int argc, char *argv[]) {
  char *s = malloc(INPUT_STRING_SIZE+1);			/* user input string */
  char cwd[MAX_FILE_SIZE+1];
  tok_t *t;			/* tokens parsed from input */
  int lineNum = 0;
  int fundex = -1;
  pid_t pid = getpid();		/* get current processes PID */
  pid_t ppid = getppid();	/* get parents PID */
  pid_t cpid, tcpid, cpgid;

  init_shell();

  printf("%s running as PID %d under %d\n",argv[0],pid,ppid);
  
  //getcwd(cwd, MAX_FILE_SIZE);
  lineNum=0;
  //fprintf(stdout, "%d - %s: ", cwd, lineNum);
  while ((s = freadln(stdin))){
    
    t = getToks(s); /* break the line into tokens */
    fundex = lookup(t[0]); /* Is first token a shell literal */
   if(fundex >= 0) {
   	cmd_table[fundex].fun(&t[1]);
   }
    else{
	cmd_exec(t);
    }
    fprintf(stdout, "%d %s: ", ++lineNum, get_current_dir_name());
  }
  return 0;
}
Esempio n. 9
0
File: cmd.c Progetto: taysom/tau
void cmd (void)
{
	init_twins(".devA", ".devB");
	init_shell(NULL);
	init_cmd();
	if (shell()) warn("shell error");
}
Esempio n. 10
0
static void
terminal_create (TerminalPlugin *term_plugin)
{
	GtkWidget *frame;
	
	g_return_if_fail(term_plugin != NULL);

	term_plugin->child_pid = 0;
	
	/* Create the terminals. */
	term_plugin->shell = create_terminal (term_plugin);
	term_plugin->shell_box = create_box (term_plugin->shell);
	
	term_plugin->term = create_terminal (term_plugin);
	term_plugin->term_box = create_box (term_plugin->term);
	
	/* key-press handler for ctrl-d "kill" */
	g_signal_connect (G_OBJECT (term_plugin->term), "key-press-event",
					  G_CALLBACK (terminal_keypress_cb), term_plugin);
	
	frame = gtk_frame_new (NULL);
	gtk_widget_show (frame);
	gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);

	gtk_container_add (GTK_CONTAINER (frame), term_plugin->shell_box);
	gtk_widget_show_all (frame);
	
	term_plugin->frame = frame;
	
	g_signal_connect (vte_reaper_get(), "child-exited",
					  G_CALLBACK (terminal_child_exited_cb), term_plugin);
	
	init_shell (term_plugin, NULL);
}
Esempio n. 11
0
int shell (int argc, char *argv[]) {
  char *s = malloc(INPUT_STRING_SIZE+1);			/* user input string */
  tok_t *t;			/* tokens parsed from input */
  int lineNum = 0;
  int fundex = -1;
  pid_t pid = getpid();		/* get current processes PID */
  pid_t ppid = getppid();	/* get parents PID */
  // pid_t cpid, tcpid, cpgid;

  init_shell();

  printf("%s running as PID %d under %d\n",argv[0],pid,ppid);

  lineNum=0;
  char *cwd = getcwd(NULL, 0);
  fprintf(stdout, "%d [%s]:", lineNum, cwd);
  free(cwd);
  while ((s = freadln(stdin))){
    // printf("%s\n", s);
    char *s_copy;
    asprintf(&s_copy, "%s", s);

    t = getToks(s); /* break the line into tokens */
    fundex = lookup(t[0]); /* Is first token a shell literal */
    if(fundex >= 0) cmd_table[fundex].fun(&t[1]);
    else {
      run_program(t, s_copy);
    }
    ++lineNum;
    cwd = getcwd(NULL, 0);
    fprintf(stdout, "%d [%s]:", lineNum, cwd);
    free(cwd);
  }
  return 0;
}
Esempio n. 12
0
File: main.c Progetto: wtaysom/tau
int main (int argc, char *argv[])
{
//	debugoff();
	debugon();
FN;
	init_dir();
	init_shell(NULL);
	init_cmd();
	return shell();
}
Esempio n. 13
0
int main(int argc, char* argv[]) {

	//int fd;
	//struct winsize win;
	// forkpty(master, name, &term, &win);
	/*pid_t pid = forkpty(&fd, NULL, &term, NULL);
	if (pid == -1) {
		perror("forkpty");
		return 1;
	} else if (pid == 0) {
		if (execlp("/bin/sh", "sh", (void*)0) == -1) {
			perror("execlp");
		}
		fprintf(stderr, "program exited.\n");
		return 1;
	}
	printf("Child process: %d\n", pid);
	printf("master fd: %d\n", fd);*/

		
	/*const char* cmd = "ls -l /\n";
	if (write(fd, cmd, strlen(cmd)) == -1) {
		perror("write");
		return 1;
	}

	char buf[255];
	int nread;
	while ((nread = read(fd, buf, 254)) > 0) {
		int i;
		for (i = 0; i < nread; i++) {
			putchar(buf[i]);
		}
	}
	printf("Done\n");*/

	//wchar_t *test;
	//wscanf(L"%ls",test);

	if(init_shell() == RET_ERROR) {
		print_error("Cannot init!");
		return RET_ERROR;
	}

	if(run_shell() == RET_ERROR) {
		print_error("Cannot run shell!");
		return RET_ERROR;
	}

	
	quit_shell();

	return RET_OK;
}
Esempio n. 14
0
File: main.c Progetto: vthangar/A1
int main(int argc, char *argv[]) {
    
    init_shell();     // Initalizes the shell
    welcome_screen(); // Displays the welcome screen
    
    setenv("shell", getcwd(currentDirectory, 1024), 1);
    
    command_parser();
    
    return (0);
}
Esempio n. 15
0
int shell (int argc, char *argv[]) {
    char *s = malloc(INPUT_STRING_SIZE+1);			/* user input string */
    tok_t *t;			/* tokens parsed from input */
    int lineNum = 0;
    int fundex = -1;
    pid_t pid = getpid();		/* get current processes PID */
    pid_t ppid = getppid();	/* get parents PID */
    pid_t cpid, tcpid, cpgid;

    init_shell();

    printf("%s running as PID %d under %d\n",argv[0],pid,ppid);

    lineNum=0;
    char cwd[5000];
    fprintf(stdout, "%d: %s:", lineNum, getcwd(cwd,sizeof(cwd)));
    while ((s = freadln(stdin))) {
        t = getToks(s); /* break the line into tokens */
        fundex = lookup(t[0]); /* Is first token a shell literal */
        if(fundex >= 0) cmd_table[fundex].fun(&t[1]);
        else {
            pid = fork();

            if( pid == 0 ) { // child process
                // printf("%d\n", strlen(strstr(s,">")));
                int i;
                for(i=0; i<MAXTOKS && t[i]; i++) {
                    if (strcmp( t[i], ">") == 0) {
                        t[i]=NULL;
                        //printf("hello");
                        part4(t,t[i+1],">");
                    }
                    if (strcmp( t[i], "<") == 0) {
                        t[i]=NULL;
                        //printf("hello");
                        part4(t,t[i+1],"<");
                    }
                }
                part3(t);
                part2(t);

            } else if(pid<0) {
                perror( "Fork failed" );
                exit( EXIT_FAILURE );
            }
        }
        lineNum++;
        wait(NULL);

        fprintf(stdout, "%d: %s :", lineNum, getcwd(cwd,sizeof(cwd)));
    }
    return 0;
}
Esempio n. 16
0
/* MAIN */
int main(int argc, char **argv) {
    init_shell();

    /* config */

    /* command loop */
    commands();

    /* cleanup */

    return 0;
}
Esempio n. 17
0
int shell (int argc, char *argv[]) {
  char *s = malloc(INPUT_STRING_SIZE+1);			/* user input string */
  tok_t *t;
  int status = 0;			/* tokens parsed from input */
  int lineNum = 0;char *fi1;
  int fundex = -1;
  int MAX_NUM = 10000;
  char nyawa[MAX_NUM];
  pid_t pid = getpid();		/* get current processes PID */
  pid_t ppid = getppid();	/* get parents PID */
  pid_t cpid, tcpid, cpgid;
  init_shell();
  printf("%s running as PID %d under %d\n",argv[0],pid,ppid);
  lineNum=0;
  fprintf(stdout, "%d: %s:", lineNum, getcwd(nyawa,sizeof(nyawa)));
  while ((s = freadln(stdin))){
    t = getToks(s); /* break the line into tokens */
    fundex = lookup(t[0]); /* Is first token a shell literal */
    if(fundex >= 0) cmd_table[fundex].fun(&t[1]);
    else {
        
         pid_t pid = fork();
         if (pid ==-1)
         {
         perror("cmd");
         exit(1);
          }
         else if(pid == 0)
           {
                tok_t *fi;
                char *fi1=getenv("PATH");
                fi = getToks(fi1);
                for(int i = 0;i<MAXTOKS && fi[i];i++){
                char *char1 =concat(fi[i],"/");
                char1 =concat(char1,t[0]);
		if(access(char1,F_OK) != -1){
		     execve(char1,t, NULL); 
		   }
                 }
             execvp(*t,t);
             perror(*t);
             exit(0);   
            }
        else
         {
             while ((pid != wait(&status)));
        }
   }
    fprintf(stdout, "%d: %s :",++lineNum,getcwd(nyawa,sizeof(nyawa)));
  }
  return 0;
}
Esempio n. 18
0
void tasking_initiator()
{
  current_task = (uint32_t)Idle_task;
  printf("\n\n\n\t-------------MISSION ACCOMPLISHED-------------\n\n-------------Welcome to the MultiThreading World!!!-------------\n");
  printf("\n----Spawning 5 Immortal Idle Tasks, each would print a unique number----\n\tStarting in 3...2...1... GO...\n\n");
  delay1(20);
  init_shell();
  //init_hpet();
  apic_start_timer();       //The respective Timer initialization function of the timer of choice
//  for(int i=0;i<1000000;i++)
  asm volatile("sti");
  while(1);
}
Esempio n. 19
0
int shell(int argc, char *argv[]) {
  char *input_bytes;
  tok_t *tokens;
  int line_num = 0;
  int fundex = -1;

  init_shell();

  if (shell_is_interactive)
    /* Please only print shell prompts when standard input is not a tty */
    fprintf(stdout, "%d: ", line_num);

  while ((input_bytes = freadln(stdin))) {
    tokens = get_toks(input_bytes);
    fundex = lookup(tokens[0]);
    if (fundex >= 0) {
	cmd_table[fundex].fun(&tokens[1]);	
    } else {
	int pid = fork();
	if (pid == 0){
		int i;
		for(i = 1;i < MAXTOKS - 1;i++) 
			if(strcmp(">",tokens[i]) == 0){	
				FILE *f = fopen(tokens[i + 1],"w");
				if(f == NULL) {
					exit(1);			
				}
				dup2(fileno(f),STDOUT_FILENO);
				fclose(f);
			}
			else if(strcmp("<",tokens[i]) == 0){
				FILE *f = fopen(tokens[i + 1],"r");
				if(f == NULL) {
					exit(1);			
				}
				dup2(fileno(f),fileno(stdin));
				fclose(f);	
			}
		execvp(tokens[0],tokens + 1);
		exit(0);
	}
    }

    if (shell_is_interactive)
      /* Please only print shell prompts when standard input is not a tty */
      fprintf(stdout, "%d: ", ++line_num);
  }

  return 0;
}
Esempio n. 20
0
void kernel_main()
{
    init_process();
    init_dispatcher();
    init_ipc();
    init_interrupts();
    init_null_process();
    init_timer();
    init_com();
    init_keyb();
	init_ne2k();
    init_shell();

    while (1);
}
Esempio n. 21
0
int main (int argc, char *argv[])
{
	debugenv();
	setprogname(argv[0]);
	init_shell(NULL);

	init_net();

	init_sage();
	init_dir();
	init_test();

	CMD(test, "# test function");
	return shell();
}
Esempio n. 22
0
File: main.c Progetto: tsujamin/swsh
int main(int argc, char * argv[])
{
    init_shell();
    parse_swsh_flags(argc, argv);

    int eval_ret = 0;
    struct CommandEval * cmd;

    //Read-Print-Eval loop
    while(1) {
        cmd = repl_read(eval_ret);
        eval_ret = repl_eval(cmd);
        free_command_eval(cmd);
    }
    return 0;
}
Esempio n. 23
0
int		main(int ac, char **av, char **env)
{
	int		tty;
	t_shell	*shell;

	(void)ac;
	(void)av;
	tty = isatty(0);
	g_is_a_term = tty;
	ft_putstr("\x1b[32mDoseShell\x1b[35m");
	ft_putstr(", by flime, jbernabe, srabah-m\x1b[0m \n\n");
	if ((shell = init_shell(env, &tty)) == NULL)
		return (-1);
	doseshell(shell, tty);
	clean_shell_mem(shell);
	return (g_main_return);
}
Esempio n. 24
0
File: main.c Progetto: wtaysom/tau
int main (int argc, char *argv[])
{
	char	*dev = ".btree";

//	debugoff();
	debugon();
FN;
	if (argc > 1) {
		dev = argv[1];
	}
	unlink(dev);	/* Development only */
	binit(20);
	init_fs(dev);
	init_shell(NULL);
	init_cmd();
	return shell();
}
Esempio n. 25
0
File: main.c Progetto: Fluray/OS-2
void start(uint32_t* modulep, void* physbase, void* physfree)
{
	clear_screen();
//	printf("Pysfree in mainbefore:BASE:%x:%x", physfree, physbase);
	
	while(modulep[0] != 0x9001) modulep += modulep[1]+2;
	for(smap = (struct smap_t*)(modulep+2); smap < (struct smap_t*)((char*)modulep+modulep[1]+2*4); ++smap) {
		if (smap->type == 1 /* memory */ && smap->length != 0) {
//			printf("Available Physical Memory [%x-%x]\n", smap->base, smap->base + smap->length);
			free_page_list(smap, physbase, physfree);	// Creates free page list (linked list implementation)
		}
	}
//	printf("tarfs in [%p:%p]\n", &_binary_tarfs_start, &_binary_tarfs_end);
	// kernel starts here	
	physfree +=  1048576;	// increasing physfree by 1 MB accomodating free page list 
//	uint64_t cur_VK = ((uint64_t )physfree + 0xffffffff80000000);		// Free Virtual Memory above Kernel starts from here
//	uint64_t cur_PK = 0x2097152;	// Starts at 2 MB mark (abhi confirm)
//	uint64_t pbase99 = (uint64_t)((uint64_t)physfree + 0xffffffff80000000);
//	uint64_t pid_bitmap[32]= {0};
//	printf("PhysFREE in mainnow:%x", physfree);
//	printf("\nFREE_PAGE:%x:%x:%x", (uint64_t *) get_page());
//	printf("\n VK:%x", cur_VK);
	kern_pt((void *) &kernmem, (uint64_t)physbase, (uint64_t)physfree);	// Mapping Kernel to new Page Table
	init_VM((uint64_t) physfree);
	init_task();
	init_fdtable();
	clear_screen();
	init_shell();
//	uint64_t te = 0xFFFF00FF80000000;
//	*te = 1;
//	void *te = (void *)  0xFFFFFFFF80000000;
//	void *te = (void *)  0xFFFF000080000000;
//	uint64_t te =(uint64_t) (0xffffffff80000000 + physbase);
//	uint64_t te =  0xFFFFFEFF80000000;
//	self_refrence(te);	
//	call_first();
	//update physfree
//	printf("\n CHAR:%c:%s:%d:\n:%x:%p", 'A', "STONY !@#$ BROOK", 9999, 0xFFFF1B, &(stack));
//	printf("\n STRING:%s","ABHIROOP DABRAL");
//	printf("\n INT:%d", 0xFFC);
//	printf("\n HEX:%x", 510);
//	printf("\n PT:%p",(uint64_t *) te);

	while(1);
}
int
shell( int argc, char *argv[] ) {

  init_shell(); // initialize the shell
  
  pid_t pid = getpid();	       // get current processe's PID
  pid_t ppid = getppid();      // get parent's PID 
  pid_t cpid, tcpid, cpgid;

  print_welcome( argv[0], pid, ppid );
  print_prompt();
  char *s = malloc(INPUT_STRING_SIZE + 1); // user input string
  
  while( (s = freadln(stdin)) ){ // read in the input string
    process *p = create_process( s );
    if( p != NULL ){ // do we need to run a newly created process?
      cpid = fork(); // fork off a child
      if( cpid == 0 ) { // child
	p->pid = getpid();
	launch_process( p );
      } // if( cpid == 0 )
      else if( cpid > 0 ){ // parent
	p->pid = cpid;
	if( shell_is_interactive ){ // are we running shell from a terminal?
	  // put 'p' into its own process group
	  // since our shell is not supporting pipes, we treat
	  // each process by itself as a 'job' to be done
	  if( setpgid( cpid, cpid ) < 0 ) 
	    printf( "Failed to put the child into its own process group.\n" );
	  if( p->background )
	    put_in_background( p, false );
	  else
	    put_in_foreground( p, false );
	} // if( shell_is_interactive )
	else
	  wait_for_process( p );
      } // else if( cpid > 0 )
      else // fork() failed
	printf( "fork() failed\n" );
    } // if( p != NULL )
    print_prompt();
  } // while

  return EXIT_SUCCESS;
} // shell
Esempio n. 27
0
void kernel_main() {
    init_process();
    init_dispatcher();
    init_ipc();
    init_interrupts();
    init_null_process();
    init_timer();
#if VGA_MODE_ENABLED
    init_vga_mode();
#endif
    init_com();
    init_keyb();
    clear_kernel_window();
    init_ne_driver();
    init_em();
    init_shell();
    while (1);
}
Esempio n. 28
0
void kernel_main()
{
	terminal_initialize();
	kprintf("Identifying CPU...", COLOR_WHITE);
	cpuid_t cpu_data = get_cpuid();
	kprintf(cpu_data.make, COLOR_WHITE);
	kprintf("\n", COLOR_WHITE);
	kprintf("Type: ", COLOR_WHITE);
	kprintf(itoa(cpu_data.family), COLOR_WHITE);
	kprintf("\n", COLOR_WHITE);
	kprintf("Family: ", COLOR_WHITE);
	kprintf(cpu_data.family, COLOR_WHITE);
	kprintf("\n", COLOR_WHITE);
	kprintf("Model: ", COLOR_WHITE);
	kprintf(cpu_data.model, COLOR_WHITE);
	kprintf("\n", COLOR_WHITE);
	kprintf("Enabling A20 Line...\n", COLOR_WHITE);
	enable_a20();
	kprintf("Initilizing VGA Driver....\n",COLOR_WHITE);
	kprintf("Installing Global Descriptor Table....\n",COLOR_WHITE);
	gdt_install();
	kprintf("Installing Interrupt Descriptor Table....\n",COLOR_WHITE);
	idt_install();
	kprintf("Enabling paging...\n", COLOR_WHITE);
	init_paging();
	kprintf("Setting up ISRs...\n",COLOR_WHITE);
	isrs_install();
	kprintf("Remapping the PIC and setting up IRQs...\n",COLOR_WHITE);
	install_irq();
	kprintf("Initializing the Kernel Address Translation Table...\n", COLOR_WHITE);
	kATT_Init();
	kprintf("Identifying ATA drives.....\n", COLOR_WHITE);
	ATA_Init();
	kprintf(DRIVE_DATA, COLOR_WHITE);
        kprintf("Installing Timer ISR....\n",COLOR_WHITE);
 	timer_install();
//	kprintf("Checking PCI device vendors....\n",COLOR_WHITE);
//	init_PCI();
	kprintf("Starting shell....\n",COLOR_WHITE);

	init_shell();

	for (;;);
}
Esempio n. 29
0
File: main.c Progetto: benatto/ftp
int main(int argc, char **argv){
	char *user;
	char *cmd;

	user = getenv("USER");

	fprintf(stdout, "Hi %s, see the list of active commands bellow:\n", user);
	fprintf(stdout, " +ls\n");
	fprintf(stdout, " +cd\n");
	fprintf(stdout, " +get\n");
	fprintf(stdout, " +put\n");
	fprintf(stdout, " +exit\n");

	init_shell();

	start_shell();	

	return 0;
}
Esempio n. 30
0
File: main.c Progetto: pxsta/MyShell
int main()
{
    list_node *token_list;
    token current_token;
    job *job_list;

    init_tokenizer(stdin);
    init_shell();

    while (1)
    {
        fprintf(stdout, "myshell>");
        token_list = create_list(sizeof(token));
        //字句解析を行なってリストに追加する
        while ((current_token = get_token()).kind != token_type_eol && current_token.kind != token_type_eof)
        {
            add_list(token_list, &current_token);
        }

        request_job_notification ();
        if (token_list->next == NULL)
        {
            p_debug("continue");
            continue;
        }

        //字句解析結果を表示
        //dump_token_list_data(token_list);

        //構文解析を行う
        job_list = parse(token_list);

        //実行
        launch_job(job_list);

        free_list(token_list);
    }
}