Esempio n. 1
0
void
project_init(void)
{
	project_cmd.name = _("project");
	project_cmd.altname = _("tree");
	project_cmd.cfunc = project_f;
	project_cmd.args = _("[-c|-s|-C|-d <depth>|-p <path>] project ...");
	project_cmd.argmin = 1;
	project_cmd.argmax = -1;
	project_cmd.oneline = _("check, setup or clear project quota trees");
	project_cmd.help = project_help;

	if (expert)
		add_command(&project_cmd);
}
Esempio n. 2
0
BOOL CALLBACK MainDlg(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam)
{
	switch(msg){
	case WM_INITDIALOG:
		ghmainmenu=LoadMenu(ghinstance,MAKEINTRESOURCE(IDR_MAIN_MENU));
		if(ghmainmenu!=0)
			SetMenu(hwnd,ghmainmenu);
		create_fileview(hwnd,&ghfileview1,0);
		create_fileview(hwnd,&ghfileview2,0);
		init_grippy(ghfileview2,IDC_GRIPPY);
		resize_main_dlg(hwnd,gstyle);
		ghevent=CreateEvent(NULL,FALSE,FALSE,TEXT("WORKEREVENT"));
		if(ghevent!=0){
			worker_params.hevent=ghevent;
			CreateThread(NULL,0,worker_thread,&worker_params,0,&gthreadid);
			add_command(CMD_INIT,0);
			add_command(CMD_NEWTAB,0);
			SetEvent(ghevent);
		}
		break;
	case WM_SIZE:
		resize_main_dlg(hwnd,gstyle);
		break;
	case WM_COMMAND:
		switch(LOWORD(wparam)){
		case IDCANCEL:
			PostQuitMessage(0);
			break;
		}
		break;
	case WM_CLOSE:
		PostQuitMessage(0);
		break;
	}
	return 0;
}
Esempio n. 3
0
void
create_mybreak(int depth) /* create command mybreak */
{
    struct command *cmd;

    if (depth > 3 || depth < 1) {
	sprintf(string, "invalid number of levels to break: %d; only 1,2 or 3 are allowed",depth);
	error(ERROR,string);
    }

    cmd = add_command (cBREAK_MULTI, NULL, NULL);
    cmd->tag=depth;
    sprintf(string,"%d",depth);
    cmd->diag=my_strdup(string);
}
Esempio n. 4
0
void
path_init(void)
{
	path_cmd.name = "path";
	path_cmd.altname = "paths";
	path_cmd.args = _("[N]");
	path_cmd.cfunc = path_f;
	path_cmd.argmin = 0;
	path_cmd.argmax = 1;
	path_cmd.flags = CMD_FLAG_GLOBAL;
	path_cmd.oneline = _("set current path, or show the list of paths");

	print_cmd.name = "print";
	print_cmd.altname = "p";
	print_cmd.cfunc = print_f;
	print_cmd.argmin = 0;
	print_cmd.argmax = 0;
	print_cmd.flags = CMD_FLAG_GLOBAL;
	print_cmd.oneline = _("list known mount points and projects");

	if (expert)
		add_command(&path_cmd);
	add_command(&print_cmd);
}
Esempio n. 5
0
void
reflink_init(void)
{
	reflink_cmd.name = "reflink";
	reflink_cmd.altname = "rl";
	reflink_cmd.cfunc = reflink_f;
	reflink_cmd.argmin = 4;
	reflink_cmd.argmax = -1;
	reflink_cmd.flags = CMD_NOMAP_OK | CMD_FOREIGN_OK;
	reflink_cmd.args =
_("infile src_off dst_off len");
	reflink_cmd.oneline =
		_("reflinks a number of bytes at a specified offset");
	reflink_cmd.help = reflink_help;

	add_command(&reflink_cmd);
}
Esempio n. 6
0
void
pwrite_init(void)
{
	pwrite_cmd.name = "pwrite";
	pwrite_cmd.altname = "w";
	pwrite_cmd.cfunc = pwrite_f;
	pwrite_cmd.argmin = 2;
	pwrite_cmd.argmax = -1;
	pwrite_cmd.flags = CMD_NOMAP_OK | CMD_FOREIGN_OK;
	pwrite_cmd.args =
		_("[-i infile [-d] [-s skip]] [-b bs] [-S seed] [-wW] off len");
	pwrite_cmd.oneline =
		_("writes a number of bytes at a specified offset");
	pwrite_cmd.help = pwrite_help;

	add_command(&pwrite_cmd);
}
Esempio n. 7
0
void
sendfile_init(void)
{
	sendfile_cmd.name = "sendfile";
	sendfile_cmd.altname = "send";
	sendfile_cmd.cfunc = sendfile_f;
	sendfile_cmd.argmin = 2;
	sendfile_cmd.argmax = -1;
	sendfile_cmd.flags = CMD_NOMAP_OK | CMD_FOREIGN_OK;
	sendfile_cmd.args =
		_("-i infile | -f N [off len]");
	sendfile_cmd.oneline =
		_("Transfer data directly between file descriptors");
	sendfile_cmd.help = sendfile_help;

	add_command(&sendfile_cmd);
}
Esempio n. 8
0
void CheckExternalScripts::addAllScriptsFrom(std::string str_path) {
	boost::filesystem::path path(str_path);
	if (path.has_relative_path())
		path = get_base_path() / path;
	file_helpers::patterns::pattern_type split_path = file_helpers::patterns::split_pattern(path);
	if (!boost::filesystem::is_directory(split_path.first))
		NSC_LOG_ERROR_STD("Path was not found: " + split_path.first.string());

	boost::regex pattern(split_path.second.string());
	boost::filesystem::directory_iterator end_itr; // default construction yields past-the-end
	for ( boost::filesystem::directory_iterator itr( split_path.first ); itr != end_itr; ++itr ) {
		if ( !is_directory(itr->status()) ) {
			std::string name = file_helpers::meta::get_filename(itr->path());
			if (regex_match(name, pattern))
				add_command(name, (split_path.first / name).string());
		}
	}
}
Esempio n. 9
0
void
create_label (char *label, int type)	/* creates command label */
{
    struct command *cmd;

    /* check, if label is duplicate */
    if (search_label (label, srmSUBR | srmLINK | srmLABEL)) {
        sprintf (string, "duplicate %s '%s'",
                 (type == cLABEL) ? "label" : "subroutine", strip (label));
        error (ERROR, string);
        return;
    }

    cmd = add_command (type, NULL, label);
    cmd->pointer = my_strdup (label);
    add_switch_state(cmd);

    link_label (cmd);
}
Esempio n. 10
0
void reset(int arg) {
  if(arg) return;

  set_light(1);
  add_property("hills");
  add_property("water");

  set_short("Rolling Hills Near River");
  set_long(LB("Here the hills flatten out and slope down to the edge "+
	"of a river to the west.  The river is slow-moving, and is shallow "+
	"enough at this point for you to ford.  Beyond the river you "+
	"catch sight of the open plains.  To the east is a dark and ancient "+
	"wood."));

  add_item("wood", LB("The small forest in the centre of the plains is "+
	"the Old Wood, said in folklore to be one of a few remnants of a "+
	"great forest which covered the whole of Nanny in millenia past, "+
	"before the coming of humans.  It is a dark and mysterious place, "+
	"where ancient powers sleep and dream of their past might."));
  add_item("river", LB("The river flows down from the mountains to the "+
	"north.  It is wide and its waters are ice-cold, and here is one "+
	"of the few places where you may cross it safely."));
  add_item("mountains", LB("Off in the distance to the north are the "+
	"tall and craggly mountains which shadow these lands.  It is "+
	"said that a great pine forest lies beyond them, where men "+
	"and dragons live peacefully, where wealth is abundant, and "+
	"evil does not exist.")); /* Not true, this rumour :) */
  add_item("hills", LB("The hills that surround you are quiet and "+
	"apparently largely uninhabited, except for insects and small "+
	"animals.  The skies are strangely empty of avians, and you "+
	"see no man-made structures around you.  You intuit an unexplained "+
	"spookiness in this forlorn place, however."));
  add_item("mist", LB("The mist, which only obscures the distances, "+
	"lends to the loneliness of the land."));

  add_exit("north","hill8");
  add_exit("east", "old_wood");
  add_exit("south","hill6");
  add_exit("west", "ford");

  add_command("drink %s","@drink_verb()");
}
Esempio n. 11
0
void CheckExternalScripts::addAllScriptsFrom(std::string str_path) {
	std::string pattern = "*.*";
	boost::filesystem::path path(str_path);
	if (!boost::filesystem::is_directory(path)) {
		if (path.has_relative_path())
			path = get_base_path() / path;
		if (!boost::filesystem::is_directory(path)) {
			file_helpers::patterns::pattern_type split_path = file_helpers::patterns::split_pattern(path);
			if (!boost::filesystem::is_directory(split_path.first)) {
				NSC_LOG_ERROR_STD("Path was not found: " + split_path.first.string());
				return;
			}
			path = split_path.first;
			pattern = split_path.second.string();
		}
	}
	NSC_DEBUG_MSG("Using script path: " + path.string());
	boost::regex re;
	try {
		std::string pre = file_helpers::patterns::glob_to_regexp(pattern);
		NSC_DEBUG_MSG("Using regexp: " + pre);
		re = pre;
	} catch (std::exception &e) {
		NSC_LOG_ERROR_EXR("Invalid pattern: " + pattern, e);
		return;
	}
	boost::filesystem::directory_iterator end_itr;
	for (boost::filesystem::directory_iterator itr(path); itr != end_itr; ++itr) {
		if (!is_directory(itr->status())) {
			std::string name = file_helpers::meta::get_filename(itr->path());
			std::string cmd = itr->path().string();
			if (allowArgs_) {
				cmd += " %ARGS%";
			}
			if (regex_match(name, re))
				add_command(name, cmd);
		}
	}
}
Esempio n. 12
0
void add_slalom_command(int leg_i, float r, float first_deg, float diff_deg, float height, float time, int step)
{

	float pos[3];
	float true_r;
	if (leg_i % 2 == 0)
		true_r = r + BODY_WIDTH/2;
	else
		true_r = r - BODY_WIDTH/2;
	for (int i = 0; i < step; i++) {
		calc_circle(leg_i, true_r, first_deg + (float)i * diff_deg / (float)step, pos);
		if (leg_i % 2 == 0)
			pos[0] -= r;
		else
			pos[0] += r;

		for (int j = 0; j < 2; j++) {
			commands[leg_i].trajectories[i][j] = pos[j];
		}
		commands[leg_i].trajectories[i][2] = height;
	}
	add_command(leg_i, time, step);
}
Esempio n. 13
0
static gboolean
add_first_part(DBusMessageIter *iter, HalDevice *device,
                   const gchar *command_line, char **extra_env) {
  DBusMessageIter array_iter;
  const char *udi;

  udi = hal_device_get_udi(device);
  dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &udi);

  dbus_message_iter_open_container(iter, 
                                   DBUS_TYPE_ARRAY,
                                   DBUS_TYPE_STRING_AS_STRING,
                                   &array_iter);
  hal_device_property_foreach (device, add_property_to_msg, &array_iter);
  add_basic_env(&array_iter, udi);
  add_extra_env(&array_iter, extra_env);
  dbus_message_iter_close_container(iter, &array_iter);

  if (!add_command(iter, command_line)) {
    return FALSE;
  }
  return TRUE;
}
Esempio n. 14
0
void init_debug_shell()
{
    strcpy(cwd, "/lib/infinity");
    
    stdin = open("/dev/tty0", O_RDONLY);
    stdout = open("/dev/tty0", O_RDWR);
    
    add_command("help", cmd_help);
    add_command("ls", cmd_ls);
    add_command("cd", cmd_cd);
    add_command("dmesg", cmd_dmesg);
    add_command("clear", cmd_clear);
    add_command("exec", cmd_exec);
    add_command("cat", cmd_cat);
    
    printf("Infinity debug shell enabled. Only basic commands are supported (IE: ls, insmod, dmesg, ect). For help type 'help'\n");
    
    struct tokenizer scanner;
    char *args[64];
    while(1) {
        char input[512];
        printf("\x1B[32minfinity \x1B[34m%s \x1B[1;32m# \x1B[0m", cwd);
        gets(input);
        init_tokenizer(&scanner, input);
        tokenize(&scanner);
        struct token *i = scanner.token_list;
        int j = 0;
        while(i) {
            args[j++] = i->value;
            i = i->next;
        }
        
        uninit_tokenizer(&scanner);
        
        if(j) {
            exec_command(args, j);
        }
    }    
}
command_t *transaction2commands(tick_t now,
		int tran_id,
		int transaction_type,
		addresses_t *this_a){
	//command_t *temp_c;
	command_t *command_queue;
	bank_t	*this_b;
	int bank_open;
	int bank_conflict;
	int chan_id,bank_id,row_id,rank_id;
	int i;
	int cas_command;
	int cmd_id = 0;

    command_queue = NULL;
    chan_id = this_a->chan_id;
    bank_id = this_a->bank_id;
    row_id = this_a->row_id;
    rank_id = this_a->rank_id;

    bank_open = FALSE;
    bank_conflict = FALSE;
    //bool bank_hit = FALSE;
    this_b = &(dram_system.dram_controller[chan_id].rank[rank_id].bank[bank_id]);

    /*if(this_b->status == ACTIVE) {
      if(this_b->row_id == row_id){
      bank_open = TRUE;
      } else {
      bank_conflict = TRUE;
      }
      } deprecated in newer version of memtest from dave 07/28/2004*/
    if(this_b->row_id == row_id){
      this_b->cas_count_since_ras++;
      if(this_b->status == ACTIVE) {
        //fprintf(stdout, " Bank opened by previous transaction \n");		  
        bank_open = TRUE;
        //bank_hit = TRUE;
      }
    } else {
      mem_gather_stat(GATHER_CAS_PER_RAS_STAT, this_b->cas_count_since_ras);
      this_b->cas_count_since_ras = 0;
      if(this_b->status == ACTIVE) {
        bank_conflict = TRUE;
      }
    }
    bank_conflict = TRUE;
    bank_open= TRUE;
    if(transaction_type == MEMORY_WRITE_COMMAND ){
      cas_command = CAS_WRITE;
    } else {
      if (dram_system.config.dram_type == FBD_DDR2 && cas_with_drive == TRUE) {
        cas_command = CAS_WITH_DRIVE;
      }else {
        cas_command = CAS;
      }
    }
    if((dram_system.config.row_buffer_management_policy == OPEN_PAGE)){ 
      /* current policy is open page, so we need to check if the row and bank address match */
      /* If they match, we only need a CAS.  If bank hit, and different row, then we need a */
      /* precharge then RAS. */

      /*** FBDIMM : For a CAS WRITE send Data commands
       * 			Number of Data commands = (cacheline / number of bytes
       * 			per outgoing packet
       * ****/	
      if (dram_system.config.dram_type == FBD_DDR2 && cas_command == CAS_WRITE) {
        for (i=0; i < dram_system.config.data_cmd_count; i++) {
          int dpos = (i == 0)? DATA_FIRST: (i == dram_system.config.data_cmd_count - 1) ? DATA_LAST : DATA_MIDDLE;
          command_queue = add_command(now,
              command_queue,
              DATA,
              this_a,
              tran_id,
              0,
              dpos, -1);
        }
      }


      if(bank_conflict == TRUE){  			/* or if we run into open bank limitations */
        command_queue = add_command(now,
            command_queue,
            PRECHARGE,
            this_a,
            tran_id,0,0,cmd_id++);

        command_queue = add_command(now,
            command_queue,
            RAS,
            this_a,
            tran_id,0,0,cmd_id++);

      } else if(bank_open == FALSE){ 			/* insert RAS */
        command_queue = add_command(now,
            command_queue,
            RAS,
            this_a,
            tran_id,0,0,cmd_id++);
      } else {
      }
      for(i=0;i<dram_system.config.packet_count;i++){ /* add CAS. How many do we add? */
        int dpos = 0;
        int dword = 0; 
        if (cas_command == CAS_WITH_DRIVE) {
          dpos = i == 0? DATA_FIRST: i == dram_system.config.data_cmd_count - 1 ? DATA_LAST : DATA_MIDDLE;

          dword = dram_system.config.cacheline_size/DATA_BYTES_PER_READ_BUNDLE;
        }

        command_queue = add_command(now,
            command_queue,
            cas_command,
            this_a,
            tran_id,
            dword,
            dpos, cmd_id++);
      }
      /*** FBDIMM: For a Drive command currently add one **/
      // If CAS With Drive, no need of DRIVE commands -aj (unless of course you wish to add more drives)
      if (dram_system.config.dram_type == FBD_DDR2 && cas_command == CAS) {
        command_queue = add_command(now,
            command_queue,
            DRIVE,
            this_a,
            tran_id,
            (dram_system.config.cacheline_size)/DATA_BYTES_PER_READ_BUNDLE,
            DATA_LAST,
            cmd_id++);
      }

    } else if ((dram_system.config.row_buffer_management_policy == CLOSE_PAGE)) {  

      /*** FBDIMM : For a CAS WRITE send Data commands
       * 			Number of Data commands = (cacheline / number of bytes
       * 			per outgoing packet
       * ****/	
      if (dram_system.config.dram_type == FBD_DDR2 && cas_command == CAS_WRITE) {
        for (i=0; i < dram_system.config.data_cmd_count; i++) {
          int dpos = i == 0? DATA_FIRST: i == dram_system.config.data_cmd_count - 1 ? DATA_LAST : DATA_MIDDLE;
          command_queue = add_command(now,
              command_queue,
              DATA,
              this_a,
              tran_id,1,dpos,-1); 
        }
      }

      /* We always need RAS, then CAS, then precharge */
      /* this needs to be fixed for the case that two consecutive accesses may hit the same page */
      command_queue = add_command(now,
          command_queue,
          RAS,
          this_a,
          tran_id,0,0,cmd_id++);
      for(i=0;i<dram_system.config.packet_count;i++){
        int dpos = 0;
        int dword = 0; 
        if (cas_command == CAS_WITH_DRIVE) {
          dpos = i == 0? DATA_FIRST: i == dram_system.config.data_cmd_count - 1 ? DATA_LAST : DATA_MIDDLE;
          dword = dram_system.config.cacheline_size/DATA_BYTES_PER_READ_BUNDLE;
        }
        if (dram_system.config.cas_with_prec) {
          if (transaction_type == MEMORY_WRITE_COMMAND) {
            command_queue = add_command(now,
                command_queue,
                CAS_WRITE_AND_PRECHARGE,
                this_a,
                tran_id,dword,dpos,cmd_id++);

          }else { // No support for cas with drive currently
            command_queue = add_command(now,
                command_queue,
                CAS_AND_PRECHARGE,
                this_a,
                tran_id,dword,dpos,cmd_id++);

          }
        }else {		  
          command_queue = add_command(now,
              command_queue,
              cas_command,
              this_a,
              tran_id,dword,dpos,cmd_id++);
        }
      }
      /*** FBDIMM: For a Drive command currently add one **/
      if (dram_system.config.dram_type == FBD_DDR2 && cas_command == CAS) {
        command_queue = add_command(now,
            command_queue,
            DRIVE,
            this_a,
            tran_id,
            (dram_system.config.cacheline_size/DATA_BYTES_PER_READ_BUNDLE),
            DATA_LAST,
            cmd_id++);
      }

      if (!dram_system.config.cas_with_prec) {
        command_queue = add_command(now,
            command_queue,
            PRECHARGE,
            this_a,
            tran_id,0,0,cmd_id++);
      }
    } else if (dram_system.config.row_buffer_management_policy == PERFECT_PAGE) {
      /* "Perfect" buffer management policy only need CAS.  */
      /* suppress cross checking issue, just use CAS for this policy */  	
      for(i=0;i<dram_system.config.packet_count;i++){
        int dpos = 0;
        int dword = 0; 
        if (cas_command == CAS_WITH_DRIVE) {
          dpos = i == 0? DATA_FIRST: i == dram_system.config.data_cmd_count - 1 ? DATA_LAST : DATA_MIDDLE;
          dword = dram_system.config.cacheline_size/DATA_BYTES_PER_READ_BUNDLE;
        }
        command_queue = add_command(now,
            command_queue,
            cas_command,
            this_a,
            tran_id,dword,dpos,cmd_id++);
      }
    } else {
      fprintf(stderr,"I am confused. Unknown buffer mangement policy %d\n ",
          dram_system.config.row_buffer_management_policy);
    }
    return command_queue;
}
Esempio n. 16
0
/* command_exec(cmd, pass_pipefd)
 *
 *   Execute the single command specified in the 'cmd' command structure.
 *
 *   The 'pass_pipefd' argument is used for pipes.
 *   On input, '*pass_pipefd' is the file descriptor used to read the
 *   previous command's output.  That is, it's the read end of the previous
 *   pipe.  It equals STDIN_FILENO if there was no previous pipe.
 *   On output, command_exec should set '*pass_pipefd' to the file descriptor
 *   used for reading from THIS command's pipe.
 *   If this command didn't have a pipe -- that is, if cmd->commandop != PIPE
 *   -- then it should set '*pass_pipefd = STDIN_FILENO'.
 *
 *   Returns the process ID of the forked child, or < 0 if some system call
 *   fails.
 *
 *   You must also handle the internal commands "cd" and "exit".
 *   These are special because they must execute in the shell process, rather
 *   than a child.  (Why?)
 *
 *   However, these special commands still have a status!
 *   For example, "cd DIR" should return status 0 if we successfully change
 *   to the DIR directory, and status 1 otherwise.
 *   Thus, "cd /tmp && echo /tmp exists" should print "/tmp exists" to stdout
 *   iff the /tmp directory exists.
 *   Not only this, but redirections should work too!
 *   For example, "cd /tmp > foo" should create an empty file named 'foo';
 *   and "cd /tmp 2> foo" should print any error messages to 'foo'.
 *
 *   How can you return a status, and do redirections, for a command executed
 *   in the parent shell?
 *   Hint: It is easiest if you fork a child ANYWAY!
 *   You should divide functionality between the parent and the child.
 *   Some functions will be executed in each process.
 */
static pid_t
command_exec(command_t *cmd, int *pass_pipefd)
{
	pid_t pid = -1;		// process ID for child
	int pipefd[2];		// file descriptors for this process's pipe
    qcommand_t *q_com;

	/* EXERCISE: Complete this function!
	 * We've written some of the skeleton for you, but feel free to
	 * change it.
	 */

	// Create a pipe, if this command is the left-hand side of a pipe.
	// Return -1 if the pipe fails.
	if (cmd->controlop == CMD_PIPE) {
		/* Your code here. */
		if (pipe(pipefd) == -1)
			return -1;
	}
    
    if (cmd->argv[0] != NULL && strcmp(cmd->argv[0], "q") == 0) {
        if (MKQ == NULL || strcmp(cmd->argv[1], MKQ->name))
            return -1;
        q_com = qcommand_alloc();
        pipe(q_com->pipe);
    }
    
	pid = fork();
    if (pid == -1) {
        return -1; //or error
    }

	if (pid == 0) {
		int fd;
		dup2(*pass_pipefd, 0);
        
        //used
		
        if (cmd->redirect_filename[0]) {
			fd = open(cmd->redirect_filename[0], O_RDONLY);
			dup2(fd, 0);
			close(fd);
		}

        if (cmd->controlop == CMD_PIPE) {
            dup2(pipefd[1], 1);
			close(pipefd[0]);
        } else if (cmd->redirect_filename[1]) {
            *pass_pipefd = STDIN_FILENO;
			fd = open(cmd->redirect_filename[1], O_TRUNC|O_CREAT|O_WRONLY, 0666);
			dup2(fd, 1);
			close(fd);	
		}
        else {
            *pass_pipefd = STDIN_FILENO;
            dup2(STDOUT_FILENO, 1);
        }

		if (cmd->redirect_filename[2]) {
			fd = open(cmd->redirect_filename[2], O_CREAT|O_WRONLY, 0666);
			dup2(fd, 2);
			close(fd);
		}
		
		if (cmd->subshell) {
            //printf("subshell?\n");
			int exit_status = command_line_exec(cmd->subshell);
			exit(exit_status ? EXIT_FAILURE : EXIT_SUCCESS);
		} else if (strcmp(cmd->argv[0], "cd") == 0) {
			if (cmd->argv[1]) {
				int fd = open(cmd->argv[1], O_RDONLY);
				if (fd != -1)
					close(fd);
				else {
					exit(EXIT_FAILURE);
				}
				exit(EXIT_SUCCESS);
			}
        } else if (strcmp(cmd->argv[0], "q") == 0) {
            //char a;
            //printf("To be Q'd\n");
            read(q_com->pipe[0], NULL, 1);
            execvp(cmd->argv[2], &cmd->argv[2]);
		} else {
			execvp(cmd->argv[0], &cmd->argv[0]);
		}
	} 
    else {
        if (cmd->argv[0]) {
			if (strcmp(cmd->argv[0], "cd") == 0) {
				chdir(cmd->argv[1] ? cmd->argv[1] : getenv("HOME"));
			} else if (strcmp(cmd->argv[0], "exit") == 0) {
				exit(0);
			} else if (strcmp(cmd->argv[0], "q") == 0) {
                q_com->pid = pid;
                q_com->cmd = cmd;//not necessarily, but useful for debugging purposes
                add_command(q_com);
            }
		}
        
        if (*pass_pipefd != STDIN_FILENO) {
            close(*pass_pipefd);
			//close(pipefd[1]);
		}
        if (cmd->controlop == CMD_PIPE) {
            *pass_pipefd = pipefd[0];
			close(pipefd[1]);
        } else
            *pass_pipefd = STDIN_FILENO;
        
		

	}
	
	
	
	// Fork the child and execute the command in that child.
	// You will handle all redirections by manipulating file descriptors.
	//
	// This section is fairly long.  It is probably best to implement this
	// part in stages, checking it after each step.  For instance, first
	// implement just the fork and the execute in the child.  This should
	// allow you to execute simple commands like 'ls'.  Then add support
	// for redirections: commands like 'ls > foo' and 'cat < foo'.  Then
	// add parentheses, then pipes, and finally the internal commands
	// 'cd' and 'exit'.
	//
	// In the child, you should:
	//    1. Set up stdout to point to this command's pipe, if necessary.
	//    2. Set up stdin to point to the PREVIOUS command's pipe (that
	//       is, *pass_pipefd), if appropriate.
	//    3. Close some file descriptors.  Hint: Consider the read end
	//       of this process's pipe.
	//    4. Set up redirections.
	//       Hint: For output redirections (stdout and stderr), the 'mode'
	//       argument of open() should be set to 0666.
	//    5. Execute the command.
	//       There are some special cases:
	//       a. Parentheses.  Execute cmd->subshell.  (How?)
	//       b. A null command (no subshell, no arguments).
	//          Exit with status 0.
	//       c. "exit".
	//       d. "cd".
	//
	// In the parent, you should:
	//    1. Close some file descriptors.  Hint: Consider the write end
	//       of this command's pipe, and one other fd as well.
	//    2. Handle the special "exit" and "cd" commands.
	//    3. Set *pass_pipefd as appropriate.
	//
	// "cd" error note:
	// 	- Upon syntax errors: Display the message
	//	  "cd: Syntax error on bad number of arguments"
	// 	- Upon system call errors: Call perror("cd")
	//
	// "cd" Hints:
	//    For the "cd" command, you should change directories AFTER
	//    the fork(), not before it.  Why?
	//    Design some tests with 'bash' that will tell you the answer.
	//    For example, try "cd /tmp ; cd $HOME > foo".  In which directory
	//    does foo appear, /tmp or $HOME?  If you chdir() BEFORE the fork,
	//    in which directory would foo appear, /tmp or $HOME?
	//
	//    EXTRA CREDIT: Our "cd" solution changes the
	//    directory both in the parent process and in the child process.
	//    This introduces a potential race condition.
	//    Explain what that race condition is, and fix it.
	//    Hint: Investigate fchdir().

	/* Your code here. */

	// return the child process ID
	return pid;
}
Esempio n. 17
0
int main(int argc, char **argv)
{
    int readonly = 0;
    int growable = 0;
    const char *sopt = "hVc:rsnmgk";
    const struct option lopt[] = {
        { "help", 0, NULL, 'h' },
        { "version", 0, NULL, 'V' },
        { "offset", 1, NULL, 'o' },
        { "cmd", 1, NULL, 'c' },
        { "read-only", 0, NULL, 'r' },
        { "snapshot", 0, NULL, 's' },
        { "nocache", 0, NULL, 'n' },
        { "misalign", 0, NULL, 'm' },
        { "growable", 0, NULL, 'g' },
        { "native-aio", 0, NULL, 'k' },
        { NULL, 0, NULL, 0 }
    };
    int c;
    int opt_index = 0;
    int flags = 0;

    progname = basename(argv[0]);

    while ((c = getopt_long(argc, argv, sopt, lopt, &opt_index)) != -1) {
        switch (c) {
        case 's':
            flags |= BDRV_O_SNAPSHOT;
            break;
        case 'n':
            flags |= BDRV_O_NOCACHE;
            break;
        case 'c':
            add_user_command(optarg);
            break;
        case 'r':
            readonly = 1;
            break;
        case 'm':
            misalign = 1;
            break;
        case 'g':
            growable = 1;
            break;
        case 'k':
            flags |= BDRV_O_NATIVE_AIO;
            break;
        case 'V':
            printf("%s version %s\n", progname, VERSION);
            exit(0);
        case 'h':
            usage(progname);
            exit(0);
        default:
            usage(progname);
            exit(1);
        }
    }

    if ((argc - optind) > 1) {
        usage(progname);
        exit(1);
    }

    bdrv_init();

    /* initialize commands */
    quit_init();
    help_init();
    add_command(&open_cmd);
    add_command(&close_cmd);
    add_command(&read_cmd);
    add_command(&readv_cmd);
    add_command(&write_cmd);
    add_command(&writev_cmd);
    add_command(&multiwrite_cmd);
    add_command(&aio_read_cmd);
    add_command(&aio_write_cmd);
    add_command(&aio_flush_cmd);
    add_command(&flush_cmd);
    add_command(&truncate_cmd);
    add_command(&length_cmd);
    add_command(&info_cmd);
    add_command(&alloc_cmd);

    add_args_command(init_args_command);
    add_check_command(init_check_command);

    /* open the device */
    if (!readonly) {
        flags |= BDRV_O_RDWR;
    }

    if ((argc - optind) == 1)
        openfile(argv[optind], flags, growable);
    command_loop();

    /*
     * Make sure all outstanding requests get flushed the program exits.
     */
    qemu_aio_flush();

    if (bs)
        bdrv_close(bs);
    return 0;
}
Esempio n. 18
0
void
agi_init(void)
{
	add_command(&agi_cmd);
}
Esempio n. 19
0
/*
	BuildTris

	Generate a list of trifans or strips
	for the model, which holds for all frames
*/
static void
BuildTris (void)
{
	float		s, t;
	int			bestlen, len, startv, type, i, j, k;
	int			besttype = 0;
	int		   *bestverts = 0, *besttris = 0;

	// build tristrips
	numorder = 0;
	numcommands = 0;
	stripcount = 0;
	alloc_used (pheader->mdl.numtris);
	memset (used, 0, used_size * sizeof (used[0]));

	for (i = 0; i < pheader->mdl.numtris; i++) {
		// pick an unused triangle and start the trifan
		if (used[i])
			continue;

		bestlen = 0;
		for (type = 0; type < 2; type++) {
//  type = 1;
			for (startv = 0; startv < 3; startv++) {
				if (type == 1)
					len = StripLength (i, startv);
				else
					len = FanLength (i, startv);
				if (len > bestlen) {
					besttype = type;
					bestlen = len;
					if (bestverts)
						free (bestverts);
					if (besttris)
						free (besttris);
					bestverts = stripverts;
					besttris = striptris;
					stripverts = striptris = 0;
					strip_size = 0;
				}
			}
		}

		// mark the tris on the best strip as used
		for (j = 0; j < bestlen; j++)
			used[besttris[j + 2]] = 1;

		if (besttype == 1)
			add_command (bestlen + 2);
		else
			add_command (-(bestlen + 2));

		for (j = 0; j < bestlen + 2; j++) {
			int         tmp;
			// emit a vertex into the reorder buffer
			k = bestverts[j];
			add_vertex (k);

			// emit s/t coords into the commands stream
			s = stverts[k].s;
			t = stverts[k].t;
			if (!triangles[besttris[0]].facesfront && stverts[k].onseam)
				s += pheader->mdl.skinwidth / 2;	// on back side
			s = (s + 0.5) / pheader->mdl.skinwidth;
			t = (t + 0.5) / pheader->mdl.skinheight;

			memcpy (&tmp, &s, 4);
			add_command (tmp);
			memcpy (&tmp, &t, 4);
			add_command (tmp);
		}
	}

	add_command (0);					// end of list marker

	Sys_MaskPrintf (SYS_DEV, "%3i tri %3i vert %3i cmd\n",
					pheader->mdl.numtris, numorder, numcommands);

	allverts += numorder;
	alltris += pheader->mdl.numtris;

	if (bestverts)
		free (bestverts);
	if (besttris)
		free (besttris);
}
Esempio n. 20
0
File: test.c Progetto: TomDoug/AOS
int shift_startup (void *ctx) {
	HC595Init();
	last_shift_time = timer_ticks;
	add_command("shift", shift_value, NULL, "Play with the shift register");
	return 0;
}
Esempio n. 21
0
void
inode_init(void)
{
	add_command(&inode_cmd);
}
Esempio n. 22
0
void register_cmd_install(void) {
  top_commands=add_command(top_commands,"install"    ,NULL,cmd_install,1,1,"Install a given implementation or a system for "PACKAGE" environment",NULL);
  top_helps=add_help(top_helps,"install","",(LVal)NULL,(LVal)NULL,NULL,NULL,install_help);
}
Esempio n. 23
0
void pr8210_state::execute_command(int command)
{
	static const UINT8 digits[10] = { 0x01, 0x11, 0x09, 0x19, 0x05, 0x15, 0x0d, 0x1d, 0x03, 0x13 };

	switch (command)
	{
		case CMD_SCAN_REVERSE:
			if (m_command_buffer_in == m_command_buffer_out ||
				m_command_buffer_in == (m_command_buffer_out + 1) % ARRAY_LENGTH(m_command_buffer))
			{
				add_command(0x1c);
				m_playing = true;
			}
			break;

		case CMD_STEP_REVERSE:
			add_command(0x12);
			m_playing = false;
			break;

		case CMD_SLOW_REVERSE:
			add_command(0x02);
			m_playing = true;
			break;

		case CMD_FAST_REVERSE:
			if (m_command_buffer_in == m_command_buffer_out ||
				m_command_buffer_in == (m_command_buffer_out + 1) % ARRAY_LENGTH(m_command_buffer))
			{
				add_command(0x0c);
				m_playing = true;
			}
			break;

		case CMD_SCAN_FORWARD:
			if (m_command_buffer_in == m_command_buffer_out ||
				m_command_buffer_in == (m_command_buffer_out + 1) % ARRAY_LENGTH(m_command_buffer))
			{
				add_command(0x08);
				m_playing = true;
			}
			break;

		case CMD_STEP_FORWARD:
			add_command(0x04);
			m_playing = false;
			break;

		case CMD_SLOW_FORWARD:
			add_command(0x18);
			m_playing = true;
			break;

		case CMD_FAST_FORWARD:
			if (m_command_buffer_in == m_command_buffer_out ||
				m_command_buffer_in == (m_command_buffer_out + 1) % ARRAY_LENGTH(m_command_buffer))
			{
				add_command(0x10);
				m_playing = true;
			}
			break;

		case CMD_PLAY:
			add_command(0x14);
			m_playing = true;
			break;

		case CMD_PAUSE:
			add_command(0x0a);
			m_playing = false;
			break;

		case CMD_FRAME_TOGGLE:
			add_command(0x0b);
			break;

		case CMD_CHAPTER_TOGGLE:
			add_command(0x06);
			break;

		case CMD_CH1_TOGGLE:
			add_command(0x0e);
			break;

		case CMD_CH2_TOGGLE:
			add_command(0x16);
			break;

		case CMD_0:
		case CMD_1:
		case CMD_2:
		case CMD_3:
		case CMD_4:
		case CMD_5:
		case CMD_6:
		case CMD_7:
		case CMD_8:
		case CMD_9:
			add_command(digits[command - CMD_0]);
			break;

		case CMD_SEARCH:
			add_command(0x1a);
			m_playing = false;
			break;
	}
}
Esempio n. 24
0
void init_stepi(){
	register_callback(check_steps, Step_callback);
	add_command("show-step", com_show_step, "Show the steps of current processor.\n");
	//add_command("show-step", com_show_step, "Show the steps of current processor.\n");
}
Esempio n. 25
0
void register_cmd_setup(int argc,char **argv,struct sub_command* cmd) {
  top_commands=add_command(top_commands,"setup"  ,NULL,cmd_setup,1,1,"Initial setup",NULL);
}
Esempio n. 26
0
void
input_init(void)
{
	add_command(&source_cmd);
}
Esempio n. 27
0
static void _keydown(enum nos_key key, unsigned int sym) {
	if(key == KEY_MWHEELUP && camera_distance >= 0.1f) {
		camera_distance -= 0.5f;
		return;
	}
	if(key == KEY_MWHEELDOWN && camera_distance <= 100.0f) {
		camera_distance += 0.5f;
		return;
	}
	if(key == KEY_RBUTTON) {
		camera_rotate = 1;
		nos_mouse_delta(NULL, NULL);
		return;
	}
	if(key == KEY_LBUTTON) {
		if(moving_code[0]) {
			add_command(moving_code[0], moving_code[2] << 8 | moving_code[1]);
			moving_code[0] = 0;
		} else {
			add_command(0xf0, best_quad);
		}
		return;
	}
	if(sym == 0x1b) {
		last_sym = 0;
		moving_code[0] = 0;
		return;
	}
	if(sym == ' ') {
		show_menu ^= 1;
		nos_mouse_pos(&menu_x, &menu_y);
		return;
	}
	if(last_sym == 's') {
		if(sym == 'n') {
			move_command(0x81);
			return;
		}
		if(sym == 'x') {
			move_command(0x83);
			return;
		}
		if(sym == 'y') {
			move_command(0x85);
			return;
		}
		if(sym == 'z') {
			move_command(0x89);
			return;
		}
	}
	if(last_sym == 'S') {
		if(sym == 'x') {
			move_command(0x93);
			return;
		}
		if(sym == 'y') {
			move_command(0x95);
			return;
		}
		if(sym == 'z') {
			move_command(0x99);
			return;
		}
	}
	if(last_sym == 't') {
		if(sym == 'n') {
			move_command(0xA1);
			return;
		}
		if(sym == 'x') {
			move_command(0xA3);
			return;
		}
		if(sym == 'y') {
			move_command(0xA5);
			return;
		}
		if(sym == 'z') {
			move_command(0xA9);
			return;
		}
	}
	if(last_sym == 'T') {
		if(sym == 'x') {
			move_command(0xB3);
			return;
		}
		if(sym == 'y') {
			move_command(0xB5);
			return;
		}
		if(sym == 'z') {
			move_command(0xB9);
			return;
		}
	}
	if(last_sym == 'r') {
		if(sym == 'x') {
			move_command(0xC3);
			return;
		}
		if(sym == 'y') {
			move_command(0xC5);
			return;
		}
		if(sym == 'z') {
			move_command(0xC9);
			return;
		}
	}
	if(last_sym == 'e') {
		if(sym == 's') {
			add_command(0x01, 0);
			return;
		}
		if(sym == 'd') {
			add_command(0x02, 0);
			return;
		}
		if(sym == 'a') {
			add_command(0x03, 0);
			return;
		}
		if(sym == 'i') {
			add_command(0x04, 0);
			return;
		}
		if(sym == 'e') {
			add_command(0x05, 0);
			return;
		}
		if(sym == 't') {
			add_command(0x06, 0);
			return;
		}
		if(sym == 'r') {
			add_command(0x07, 0);
			return;
		}
		if(sym == 'c') {
			add_command(0x08, 0);
			return;
		}
	}
	if(last_sym == 'x') {
		if(sym == 'a') {
			add_command(0xe0, 0);
			return;
		}
		if(sym == 'n') {
			add_command(0xe1, 0);
			return;
		}
		if(sym == 'i') {
			add_command(0xe2, 0);
			return;
		}
		if(sym == 'g') {
			add_command(0xe3, 0);
			return;
		}
		if(sym == 'j') {
			add_command(0xe4, 0);
			return;
		}
		if(sym == 'x') {
			add_command(0xe5, 0);
			return;
		}
		if(sym == 'y') {
			add_command(0xe6, 0);
			return;
		}
		if(sym == 'z') {
			add_command(0xe7, 0);
			return;
		}
	}
	last_sym = sym;
}
Esempio n. 28
0
  command_stream_t
make_command_stream (int (*get_next_byte) (void *),
    void *get_next_byte_argument)
{
  /* FIXME: Replace this with your implementation.  You may need to
     add auxiliary functions and otherwise modify the source code.
     You can also use external functions defined in the GNU C Library.  */

  // initialize memory allocation
  // count of characters
  int pt_count = 0;
  int cmd_count = 0;
  int i = 0;
  char input_byte;
  char prev_byte;
  char *tmp = NULL;
  char *tmp_ch = NULL;
  command_stream t = { 0, 0, NULL };
  command_stream_t result_stream = &t;

  // Initalize memory allocation for stream
  result_stream->command_list = (char**) malloc(sizeof(char**));
  result_stream->command_list[0] = NULL;

  // initialize stream
  input_byte = (char)get_next_byte(get_next_byte_argument);

  // Reallocate memory for stream characters
  // Record stream
  while (input_byte != EOF)
  {    
    if (is_valid_op(input_byte, prev_byte))
    {
      // Add command
      if (tmp_ch != NULL) 
      {
        add_command(&(result_stream->command_list), pt_count++, &tmp_ch, cmd_count);
      }
      // Operator Cases
      if (input_byte == '#') 
      {
        // Append # comment to next command
        tmp_ch = (char*) malloc(sizeof(char));
        tmp_ch[0] = input_byte;
      }
      else if (input_byte == '|' && prev_byte != '|')
      {
        printf("hello");
      }
      else if (input_byte != '|' && prev_byte == '|')
      {
        // Add operator 
        tmp = (char*) malloc(sizeof(char));
        tmp[0] = prev_byte;
        add_command(&(result_stream->command_list), pt_count++, &tmp, 1);
      }
      else if (input_byte == '|' && prev_byte == '|')
      {
        // Add operator 
        tmp = (char*) malloc(2*sizeof(char));
        tmp[0] = input_byte;
        tmp[1] = prev_byte;
        add_command(&(result_stream->command_list), pt_count++, &tmp, 2);
        // prevent from being read again
        input_byte = ' ';
      }
      else if (input_byte == '&' && prev_byte != '&')
      {
      }
      else if (input_byte != '&' && prev_byte == '&')
      {
        // Add operator 
        tmp = (char*) malloc(sizeof(char));
        tmp[0] = input_byte;
        add_command(&(result_stream->command_list), pt_count++, &tmp, 1);
      }
      else if (input_byte == '&' && prev_byte == '&')
      {
        // Add operator 
        tmp = (char*) malloc(2*sizeof(char));
        tmp[0] = input_byte;
        tmp[1] = prev_byte;
        add_command(&(result_stream->command_list), pt_count++, &tmp, 2);
        // prevent from being read again
        input_byte = ' ';
      }
      else
      {
        // Add operator 
        tmp = (char*) malloc(sizeof(char));
        tmp[0] = input_byte;
        add_command(&(result_stream->command_list), pt_count++, &tmp, 1);
      }

      // Reset for next add
      if(input_byte == '#')
      {
        cmd_count = 1;
      }
      else
      {
        cmd_count = 0;
      }
      prev_byte = input_byte;
      input_byte = get_next_byte(get_next_byte_argument);
      continue;
    }
    if (input_byte == '#') 
    {
            // Reset
      prev_byte = input_byte;
      input_byte = get_next_byte(get_next_byte_argument);
      continue;
    }
    // Allocate for command until delimiter found
    tmp_ch = (char*) realloc(tmp_ch, (cmd_count+1)*sizeof(char));
    tmp_ch[cmd_count] = input_byte;
    cmd_count++;

    prev_byte = input_byte;
    input_byte = get_next_byte(get_next_byte_argument);
  }

  result_stream->size = pt_count;

  // Test print
  for (i=0; i < pt_count; i++)
  {
    printf("%d: %s\n", i, result_stream->command_list[i]);
  }
  printf("\npt_count: %d \n", pt_count);
  
  // Returns stream as character array
  return result_stream;
}
Esempio n. 29
0
int main(int argc, char **argv)
{
    int readonly = 0;
    int growable = 0;
    const char *sopt = "hVc:d:rsnmgkt:T:";
    const struct option lopt[] = {
        { "help", 0, NULL, 'h' },
        { "version", 0, NULL, 'V' },
        { "offset", 1, NULL, 'o' },
        { "cmd", 1, NULL, 'c' },
        { "read-only", 0, NULL, 'r' },
        { "snapshot", 0, NULL, 's' },
        { "nocache", 0, NULL, 'n' },
        { "misalign", 0, NULL, 'm' },
        { "growable", 0, NULL, 'g' },
        { "native-aio", 0, NULL, 'k' },
        { "discard", 1, NULL, 'd' },
        { "cache", 1, NULL, 't' },
        { "trace", 1, NULL, 'T' },
        { NULL, 0, NULL, 0 }
    };
    int c;
    int opt_index = 0;
    int flags = BDRV_O_UNMAP;

    progname = basename(argv[0]);

    while ((c = getopt_long(argc, argv, sopt, lopt, &opt_index)) != -1) {
        switch (c) {
        case 's':
            flags |= BDRV_O_SNAPSHOT;
            break;
        case 'n':
            flags |= BDRV_O_NOCACHE | BDRV_O_CACHE_WB;
            break;
        case 'd':
            if (bdrv_parse_discard_flags(optarg, &flags) < 0) {
                error_report("Invalid discard option: %s", optarg);
                exit(1);
            }
            break;
        case 'c':
            add_user_command(optarg);
            break;
        case 'r':
            readonly = 1;
            break;
        case 'm':
            misalign = 1;
            break;
        case 'g':
            growable = 1;
            break;
        case 'k':
            flags |= BDRV_O_NATIVE_AIO;
            break;
        case 't':
            if (bdrv_parse_cache_flags(optarg, &flags) < 0) {
                error_report("Invalid cache option: %s", optarg);
                exit(1);
            }
            break;
        case 'T':
            if (!trace_backend_init(optarg, NULL)) {
                exit(1); /* error message will have been printed */
            }
            break;
        case 'V':
            printf("%s version %s\n", progname, VERSION);
            exit(0);
        case 'h':
            usage(progname);
            exit(0);
        default:
            usage(progname);
            exit(1);
        }
    }

    if ((argc - optind) > 1) {
        usage(progname);
        exit(1);
    }

    qemu_init_main_loop();
    bdrv_init();

    /* initialize commands */
    quit_init();
    help_init();
    add_command(&open_cmd);
    add_command(&close_cmd);
    add_command(&read_cmd);
    add_command(&readv_cmd);
    add_command(&write_cmd);
    add_command(&writev_cmd);
    add_command(&multiwrite_cmd);
    add_command(&aio_read_cmd);
    add_command(&aio_write_cmd);
    add_command(&aio_flush_cmd);
    add_command(&flush_cmd);
    add_command(&truncate_cmd);
    add_command(&length_cmd);
    add_command(&info_cmd);
    add_command(&discard_cmd);
    add_command(&alloc_cmd);
    add_command(&map_cmd);
    add_command(&break_cmd);
    add_command(&resume_cmd);
    add_command(&wait_break_cmd);
    add_command(&abort_cmd);

    add_args_command(init_args_command);
    add_check_command(init_check_command);

    /* open the device */
    if (!readonly) {
        flags |= BDRV_O_RDWR;
    }

    if ((argc - optind) == 1) {
        openfile(argv[optind], flags, growable);
    }
    command_loop();

    /*
     * Make sure all outstanding requests complete before the program exits.
     */
    bdrv_drain_all();

    if (bs) {
        bdrv_delete(bs);
    }
    return 0;
}
Esempio n. 30
0
void init()
{
  if (initialized) return;
  initialized = true;

  add_command(IR_Command::APPLE_PLAY, ApplePlay, COUNT_OF(ApplePlay), "ApplePlay");
  add_command(IR_Command::APPLE_MENU, AppleMenu, COUNT_OF(AppleMenu), "AppleMenu");
  add_command(IR_Command::APPLE_SELECT, AppleSelect, COUNT_OF(AppleSelect), "AppleSelect");
  add_command(IR_Command::APPLE_UP, AppleUp, COUNT_OF(AppleUp), "AppleUp");
  add_command(IR_Command::APPLE_DOWN, AppleDown, COUNT_OF(AppleDown), "AppleDown");
  add_command(IR_Command::APPLE_LEFT, AppleLeft, COUNT_OF(AppleLeft), "AppleLeft");
  add_command(IR_Command::APPLE_RIGHT, AppleRight, COUNT_OF(AppleRight), "AppleRight");

  add_command(IR_Command::SAMSUNG_VOLUME_UP, SamsungVolumeUp, COUNT_OF(SamsungVolumeUp), "SamsungVolumeUp");
  add_command(IR_Command::SAMSUNG_VOLUME_DOWN, SamsungVolumeDown, COUNT_OF(SamsungVolumeDown), "SamsungVolumeDown");

  add_command(IR_Command::SAMSUNG_UP, SamsungUp, COUNT_OF(SamsungUp), "SamsungUp");
  add_command(IR_Command::SAMSUNG_DOWN, SamsungDown, COUNT_OF(SamsungDown), "SamsungDown");
  add_command(IR_Command::SAMSUNG_LEFT, SamsungLeft, COUNT_OF(SamsungLeft), "SamsungLeft");
  add_command(IR_Command::SAMSUNG_RIGHT, SamsungRight, COUNT_OF(SamsungRight), "SamsungRight");
  add_command(IR_Command::SAMSUNG_OK, SamsungOK, COUNT_OF(SamsungOK), "SamsungOK");
  add_command(IR_Command::SAMSUNG_PLAY, SamsungPlay, COUNT_OF(SamsungPlay), "SamsungPlay");
  add_command(IR_Command::SAMSUNG_STOP, SamsungStop, COUNT_OF(SamsungStop), "SamsungStop");
  add_command(IR_Command::SAMSUNG_TOOLS, SamsungTools, COUNT_OF(SamsungTools), "SamsungTools");


}