예제 #1
0
파일: fash.c 프로젝트: dfritter4/Fash-Shell
int check_builtin(char *cmd)
{
	/* Arguments:
			cmd = program to run
			
		Purpose:
			this function checks to see if the 
			cmd specified is a built in command
			(in this case only "cd" is built-in)
		
		Returns:
			0  -- if the cmd is built in
			-1 -- if the cmd is NOT built in
	*/

	if(!strcmp(cmd,"cd")) {
		//command was "cd" which is a builtin, so
		//lets handle it
		add_nav_history(fullPath);
		chdir(args[1]); //change directory to first argument
		get_path();
	}
	else if(cmd[0] == '!') {
		//theyre requesting some sort of history
		exec_history(cmd); //execute the argument number 
	}
	else if(cmd[0] == '@') {
		//requesting nav history
		exec_nav_history(cmd);
		get_path();
	}
	else if(!strcmp(cmd,"history")) {
		print_history();
	}
	else if(!strcmp(cmd, "navhist")) {
		print_nav_history();
	}
	else if(!strcmp(cmd,"alias")) {
		//trying to set an alias
		if(args[1] == NULL) {
			//no argument, so just print all
			print_aliases();
		} else {
			add_alias(args[1]);
		}
	}
	else if(!strcmp(cmd,"unalias")) {
		//trying to remove an alias (args[1] is what is being removed)
		remove_alias(args[1]);
	}
	else if(!strcmp(cmd,"cinterp")) {
		//want to use the C interpreter
		//quit raw mode first (will make the cinterp easier)
		quit_raw_mode();
		cinterp();
		tty_raw_mode(); //reenter raw mode
	}
	else { return -1; }
	return 0;
}
예제 #2
0
int			builtin_unalias(t_info *info, t_tree *cmd)
{
	char	**tmp;

	if (!(tmp = cmd->cmd + 1))
	{
		ft_fdprint(2, "unalias: not enough arguments");
		exit(1);
	}
	while (tmp && *tmp)
	{
		remove_alias(info, *tmp);
		tmp++;
	}
	return (0);
}
예제 #3
0
address_book_aliases::address_book_aliases (const QString email,
						QWidget *parent) :
  QWidget(parent)
{
  m_email = email;
  Q3BoxLayout* top_layout = new Q3VBoxLayout (this);
  top_layout->setMargin (4);
  top_layout->setSpacing (3);
  Q3HBox* hb = new Q3HBox (this);
  top_layout->addWidget (hb);

  Q3VBox* box_left = new Q3VBox (hb);
  Q3VBox* box_middle = new Q3VBox (hb);
  Q3VBox* box_right = new Q3VBox (hb);

  // left pane: search criteria and results
  Q3GroupBox* search_box = new Q3GroupBox (3, Qt::Horizontal, tr("Search"), box_left);
  Q3VBox* labels_box = new Q3VBox(search_box);
  Q3VBox* fields_box = new Q3VBox(search_box);
  m_email_search_w = new QLineEdit (fields_box);
  (void)new QLabel (tr("Address"), labels_box);

  m_name_search_w = new QLineEdit (fields_box);
  (void)new QLabel (tr("Name"), labels_box);

  m_nick_search_w = new QLineEdit (fields_box);
  (void)new QLabel (tr("Nickname"), labels_box);

  QPushButton* button_search = new QPushButton (tr("Search"), search_box);
  connect (button_search, SIGNAL(clicked()), this, SLOT(search()));

  Q3GroupBox* result_box = new Q3GroupBox (1, Qt::Vertical, tr("Results"), box_left);
  m_result_list_w = new Q3ListView (result_box);
  m_result_list_w->addColumn (tr("Email address"));
  m_result_list_w->addColumn (tr("# msgs"), 50);
  m_result_list_w->setMultiSelection (true);

  // middle pane: the "Add" and "Remove" buttons
  QPushButton* b_add = new QPushButton (tr("Add ->"), box_middle);
  connect (b_add, SIGNAL(clicked()), this, SLOT(add_aliases()));

  QPushButton* b_remove = new QPushButton (tr("Remove"), box_middle);
  connect (b_remove, SIGNAL(clicked()), this, SLOT(remove_alias()));

  // right pane: aliases
  Q3GroupBox* aliases_box = new Q3GroupBox (1, Qt::Vertical, tr("Aliases"), box_right);
  m_aliases_list_w = new Q3ListView (aliases_box);
  m_aliases_list_w->addColumn(tr("Email address"));
  init_aliases_list ();

  // buttons at the bottom of the window
  Q3HBox* buttons_box = new Q3HBox (this);
  buttons_box->setSpacing (4);
  top_layout->addWidget (buttons_box);

  new Q3HBox (buttons_box);	// takes the left space
  QPushButton* b2 = new QPushButton (tr("Reset"), buttons_box);
  QPushButton* b3 = new QPushButton (tr("OK"), buttons_box);
  connect (b3, SIGNAL(clicked()), this, SLOT(OK()));
  QPushButton* b4 = new QPushButton (tr("Cancel"), buttons_box);
  connect (b4, SIGNAL(clicked()), this, SLOT(close()));

  QString title = tr("Other email addresses for ");
  title += email;
  setWindowTitle (title);
}
예제 #4
0
파일: startunix.c 프로젝트: sussman/twisty
static void code_unalias(const char *string)
#line 61 "nitfol.opt"
{ if(string) remove_alias(string); }