Esempio n. 1
0
/*
 * Remove the name from the UI and from the list if the calendar handle is NULL.
 * If the calendar handle is not null, tag it as deleted and it will be taken
 * care of later.
 */
static void
blist_removenames(Widget widget, XtPointer client_data, XtPointer call_data) {
	int		i, idx, valid_cnt, *pos_list, pos_cnt;
	Calendar	*c = (Calendar *)client_data;
	BlistData	*bd = NULL;
	Browselist	*bl = (Browselist *)c->browselist;
	int		rejected_name = 0;

	set_message(bl->message, " ");
	XmListGetSelectedPos(bl->browse_list, &pos_list, &pos_cnt);
	if (pos_cnt <= 0) {
		set_message(bl->message, catgets(calendar->DT_catd, 1, 17,
					      "Select a name to remove"));
		return;
	}

	for (i = 0; i < pos_cnt; i++) {
		if (pos_list[i] == 1) {
			set_message(bl->message, catgets(calendar->DT_catd, 1,
				16, "You may not remove the default calendar"));
			rejected_name++;
			continue;
		}

		XmListDeletePos(bl->browse_list, pos_list[i] - i + rejected_name);
		bd = (BlistData *)CmDataListGetData(bl->blist_data, pos_list[i]);

		if (bd)
		{
			bd->tag = BLIST_DELETE;
		}
	}
	blist_clean(bl, False);
	bl_list_is_changed(bl);
}
Esempio n. 2
0
void handle_key(struct wdata *data, int c)
{
	if (c == 27) {
		reset();
		states_pop();
	} else if (c == 9) {
		autocomplete_handle();
	} else if (c == 13) {
		execute(data);
		reset();
		states_pop();
	} else if (c == 263) {
		if (cmd_data.bufpos > 0) {
			autocomplete_clear();
			cmd_data.buf[--cmd_data.bufpos] = '\0';
			set_message(M_INFO, ":%s", cmd_data.buf);
		} else {
			set_message(M_INFO, "");
			states_pop();
		}
	} else if (c >= 32) {
		if (cmd_data.bufpos < CMD_BUFSIZE) {
			autocomplete_clear();
			cmd_data.buf[cmd_data.bufpos++] = c;
			cmd_data.buf[cmd_data.bufpos] = '\0';
			set_message(M_INFO, ":%s", cmd_data.buf);
		}
	}
}
Esempio n. 3
0
void execute(struct wdata *data)
{
	char tmp[CMD_BUFSIZE + 1];
	char *name;
	int i;
	struct arg arg;

	strcpy(tmp, cmd_data.buf);

	name = strtok(tmp, " ");
	arg.s = strtok(NULL, " ");

	if (!name) {
		/* no command entered, leave cmd state */
		set_message(M_INFO, "");
	} else {
		for (i = 0; i < ARRSIZE(cmds); i++) {
			if (streq(name, cmds[i].name)) {
				cmds[i].func(data, &arg);
				return;
			}
		}

		/* no command found, print error message */
		set_message(M_ERROR, "no such command: '%s' ", name);
	}
}
Esempio n. 4
0
bool
edit_interface_rep::set_hybrid_footer (tree st) {
  // WARNING: update edit_dynamic_rep::activate_hybrid when updating this
  if (is_atomic (st))
    if (is_func (subtree (et, path_up (tp, 2)), HYBRID, 1)) {
      string msg;
      // macro argument
      string name= st->label;
      path mp= search_upwards (MACRO);
      if (!is_nil (mp)) {
	tree mt= subtree (et, mp);
	int i, n= N(mt)-1;
	for (i=0; i<n; i++)
	  if (mt[i] == name) {
	    set_message (concat (kbd ("return"), ": insert argument ", name),
			 "hybrid command");
	    return true;
	  }
      }
      // macro application
      tree f= get_env_value (name);
      if (drd->contains (name) && (f == UNINIT))
	set_message (concat (kbd ("return"), ": insert primitive ", name),
		     "hybrid command");
      else if (is_func (f, MACRO) || is_func (f, XMACRO))
	set_message (concat (kbd ("return"), ": insert macro ", name),
		     "hybrid command");
      else if (f != UNINIT)
	set_message (concat (kbd ("return"), ": insert value ", name),
		     "hybrid command");
      else return false;
      return true;
    }
  return false;
}
Esempio n. 5
0
/*
 * Callback for the add name button.  This simply calls the blist_name_append
 * function and adds the name to the UI.
 */
static void
blist_addname(Widget widget, XtPointer client_data, XtPointer cbs) {
	char		*new_name, *end_ptr, buf[MAXNAMELEN];
	XEvent		*e = ((XmAnyCallbackStruct *)cbs)->event;
	XmString	xmstr;
	Calendar	*c = (Calendar *)client_data;
	Browselist	*bl = (Browselist *)c->browselist;
	int		insert_location;


	XtVaSetValues(bl->form, XmNresizePolicy, XmRESIZE_NONE, NULL);
	bl_clear_pending_change(bl);
	bl_list_is_changed(bl);
	set_message(bl->message, " ");
	new_name = XmTextFieldGetString(bl->username);

	/* crush out leading white space for the name 
	   comparison/insert process */
	
	while ((*new_name == ' ') || (*new_name == '\t'))
		new_name++;

	/* compress off trailing whitespace */

	end_ptr = new_name;
	while (*end_ptr)
		end_ptr++;
	while ((end_ptr > new_name) && 
	       ((*(end_ptr - 1) == ' ') || (*(end_ptr - 1) == '\t')))
		end_ptr--;

	*end_ptr = NULL;


	if (blank_buf(new_name)) {
		set_message(bl->message, catgets(c->DT_catd, 1, 603,
			"Type a name to add in the User Name field"));
		return;
	}

	if (embedded_blank(new_name)) {
                set_message(bl->message, catgets(c->DT_catd, 1, 684,
                        "User Names may not have embedded blanks or tabs"));
                return;
        }


	if ((insert_location = blist_name_append(c, new_name, BLIST_INSERT)) != -1) {
		xmstr = XmStringCreateLocalized(new_name);
		XmListAddItem(bl->browse_list, xmstr, insert_location);
		XmStringFree(xmstr);
		cm_select_text(bl->username, e->xbutton.time);
	} else {
		sprintf(buf, "%s %s", new_name,
			catgets(c->DT_catd, 1, 604, "is already in the list"));
		set_message(bl->message, buf);
	}
	XtVaSetValues(bl->form, XmNresizePolicy, XmRESIZE_ANY, NULL);
}
Esempio n. 6
0
creation_message_erreur(char nom[]) {
	int fd = creation_fichier_liste("erreur.txt");
	set_message("le fichier suivant n'existe pas : "******"\n\n");
	write(fd,get_message(),size_message());
	ajout_info_liste(fd);
}
Esempio n. 7
0
void cmd_set_sort(struct wdata *data, const struct arg *arg)
{
	if (arg->i < 0 || arg->i >= N_SORTMETHODS)
		return;
	set_message(M_INFO, "");

	dwindow_set_sort(data->wsel, arg->i);

	set_message(M_INFO, "sorted by: %s", strsort(data->wsel->sort));
}
Esempio n. 8
0
/**
 * gwy_tip_estimate_partial:
 * @tip: Tip data to be refined (allocated).
 * @surface: Surface data.
 * @threshold: Threshold for noise supression.
 * @use_edges: Whether use also edges of image.
 * @count: Where to store the number of places that produced refinements to.
 * @set_fraction: Function that sets fraction to output (or %NULL).
 * @set_message: Function that sets message to output (or %NULL).
 *
 * Performs partial blind estimation algorithm published by Villarrubia. This
 * function converts all fields into form requested by "morph_lib.c" library,
 * that is almost identical with original Villarubia's library. Note that the
 * threshold value must be chosen sufficently high value to supress small
 * fluctulations due to noise (that would lead to very sharp tip) but
 * sufficiently low value to put algorithm at work. A value similar to 1/10000
 * of surface range can be good. Otherwise we recommend to start with zero
 * threshold and increase it slowly to observe changes and choose right value.
 *
 * Returns: Estimated tip.  May return %NULL if aborted.
 **/
GwyDataField*
gwy_tip_estimate_partial(GwyDataField *tip,
                         GwyDataField *surface,
                         gdouble threshold,
                         gboolean use_edges,
                         gint *count,
                         GwySetFractionFunc set_fraction,
                         GwySetMessageFunc set_message)
{
    gint **ftip;
    gint **fsurface;
    gdouble tipmin, surfacemin, step;
    gint cnt;

    if (set_message && !set_message(N_("Converting fields")))
        return NULL;

    tipmin = gwy_data_field_get_min(tip);
    surfacemin = gwy_data_field_get_min(surface);
    step = (gwy_data_field_get_max(surface)-surfacemin)/10000;

    ftip = i_datafield_to_field(tip, TRUE,  tipmin, step);
    fsurface = i_datafield_to_field(surface, FALSE, surfacemin, step);

    if (set_message && !set_message(N_("Starting partial estimation"))) {
        _gwy_morph_lib_ifreematrix(ftip, tip->xres);
        _gwy_morph_lib_ifreematrix(fsurface, surface->xres);
        return NULL;
    }

    cnt = _gwy_morph_lib_itip_estimate0(fsurface, surface->yres, surface->xres,
                                        tip->yres, tip->xres,
                                        tip->yres/2, tip->xres/2,
                                        ftip, threshold/step, use_edges,
                                        set_fraction, set_message);
    if (cnt == -1 || (set_fraction && !set_fraction(0.0))) {
        _gwy_morph_lib_ifreematrix(ftip, tip->xres);
        _gwy_morph_lib_ifreematrix(fsurface, surface->xres);
        return NULL;
    }
    gwy_debug("Converting fields");
    if (set_message)
        set_message(N_("Converting fields"));

    tip = i_field_to_datafield(ftip, tip, tipmin, step);
    gwy_data_field_add(tip, -gwy_data_field_get_min(tip));

    _gwy_morph_lib_ifreematrix(ftip, tip->xres);
    _gwy_morph_lib_ifreematrix(fsurface, surface->xres);
    if (count)
        *count = cnt;

    return tip;
}
Esempio n. 9
0
static void probe_monitors(GtkWidget *widget, gpointer data) {
	if (combo_box_changed_handler_id)
		g_signal_handler_disconnect(G_OBJECT(combo_box), combo_box_changed_handler_id);
	
	gtk_list_store_clear(GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(combo_box))));
	
	set_message(_(
	"Probing for available monitors..."
		   ));
	
	if (widget == NULL)
		monlist = ddcci_load_list();
	else
		monlist = NULL;
		
	if (!monlist) {
		monlist = ddcci_probe();
	
		ddcci_save_list(monlist);
	}
	
	struct monitorlist* current;
	
	char buffer[256];
	
	for (current = monlist; current != NULL; current = current->next)
	{
		snprintf(buffer, 256, "%s: %s",
			current->filename, current->name);
		gtk_combo_box_append_text(GTK_COMBO_BOX(combo_box), buffer);
	}
	
	combo_box_changed_handler_id = g_signal_connect(G_OBJECT(combo_box), "changed", G_CALLBACK(combo_change), NULL);
	
	currentid = -1;
	nextid = -1;
	
	if (monlist) {
		widgets_set_sensitive(TRUE);
		gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box), 0);
	}
	else {
		widgets_set_sensitive(FALSE);
		gtk_widget_set_sensitive(close_button, TRUE);
		gtk_widget_set_sensitive(refresh_controls_button, TRUE);
		set_message(_(
			"No monitor supporting DDC/CI available.\n\n"
			"If your graphics card need it, please check all the required kernel modules are loaded (i2c-dev, and your framebuffer driver)."
			   ));
	}
}
Esempio n. 10
0
/* load metadata file */
int load_metadata() {
  FILE *f;
  unsigned int stp;
mylog("::load_metadata()\n");
  if (metaurl[0] != '@') {
    /* not for @ code: it is not updated */
    f = fopen(tpl, "w");
    if (f == NULL) {
      update_ok = UP_INT;
      set_message("Failed to create local metadata file (check /tmp).");
      return(0);
    }
  }
  
  if (metaurl[0] == '@') {
    /* user ask for a local program to update file */
    /* run it with "system". may change */
    if (system(metaurl+1) != 0) {
      update_ok = UP_404; /* fail. same error than 404 */
      set_message("Failed to execute updater program for metadata.");
      return(0);
    }
    return(1);
  } else {
    /* we just dl the metadata file from website */
    if (!wget_meta(metaurl, f)) {
      fclose(f);
      update_ok = UP_404;
      return(0);
    }
    fclose(f);
  }
  
  /* now check for timestamp value */
  f = fopen(tpl, "r");
  if (f == NULL) {
    update_ok = UP_INT;
    set_message("Failed to open local metadata file (check /tmp).");
    return(0);
  }
  if (fscanf(f, "%u", &stp) != 1) {
    fclose(f);
    update_ok = UP_TREE;
    set_message("Failed to find timestamp in metadata file (bad format?).");
    return(0);
  }
  fclose(f);
  set_message(NULL);
  
  return(1);
}
Esempio n. 11
0
void show_message(char message[]){
	window_stack_pop(true);
	window_stack_push(message_window, true);
	set_message(message);
	last_screen = current_screen;
	current_screen = SCREEN_MESSAGE_KEY;
}
Esempio n. 12
0
BOOL cli_setatr(struct cli_state *cli, const char *fname, uint16 attr, time_t t)
{
	char *p;

	memset(cli->outbuf,'\0',smb_size);
	memset(cli->inbuf,'\0',smb_size);

	set_message(cli->outbuf,8,0,True);

	SCVAL(cli->outbuf,smb_com,SMBsetatr);
	SSVAL(cli->outbuf,smb_tid,cli->cnum);
	cli_setup_packet(cli);

	SSVAL(cli->outbuf,smb_vwv0, attr);
	put_dos_date3(cli->outbuf,smb_vwv1, t);

	p = smb_buf(cli->outbuf);
	*p++ = 4;
	p += clistr_push(cli, p, fname, -1, STR_TERMINATE);
	*p++ = 4;

	cli_setup_bcc(cli, p);

	cli_send_smb(cli);
	if (!cli_receive_smb(cli)) {
		return False;
	}
	
	if (cli_is_error(cli)) {
		return False;
	}

	return True;
}
Esempio n. 13
0
BOOL cli_rmdir(struct cli_state *cli, const char *dname)
{
	char *p;

	memset(cli->outbuf,'\0',smb_size);
	memset(cli->inbuf,'\0',smb_size);

	set_message(cli->outbuf,0, 0, True);

	SCVAL(cli->outbuf,smb_com,SMBrmdir);
	SSVAL(cli->outbuf,smb_tid,cli->cnum);
	cli_setup_packet(cli);

	p = smb_buf(cli->outbuf);
	*p++ = 4;      
	p += clistr_push(cli, p, dname, -1, STR_TERMINATE);

	cli_setup_bcc(cli, p);

	cli_send_smb(cli);
	if (!cli_receive_smb(cli)) {
		return False;
	}

	if (cli_is_error(cli)) {
		return False;
	}

	return True;
}
Esempio n. 14
0
BOOL cli_nt_hardlink(struct cli_state *cli, const char *fname_src, const char *fname_dst)
{
	char *p;

	memset(cli->outbuf,'\0',smb_size);
	memset(cli->inbuf,'\0',smb_size);

	set_message(cli->outbuf, 4, 0, True);

	SCVAL(cli->outbuf,smb_com,SMBntrename);
	SSVAL(cli->outbuf,smb_tid,cli->cnum);
	cli_setup_packet(cli);

	SSVAL(cli->outbuf,smb_vwv0,aSYSTEM | aHIDDEN | aDIR);
	SSVAL(cli->outbuf,smb_vwv1, RENAME_FLAG_HARD_LINK);

	p = smb_buf(cli->outbuf);
	*p++ = 4;
	p += clistr_push(cli, p, fname_src, -1, STR_TERMINATE);
	*p++ = 4;
	p += clistr_push(cli, p, fname_dst, -1, STR_TERMINATE);

	cli_setup_bcc(cli, p);

	cli_send_smb(cli);
	if (!cli_receive_smb(cli))
		return False;

	if (cli_is_error(cli))
		return False;

	return True;
}
Esempio n. 15
0
void setup(void) {
   bank_init();
   set_message("The following commands are available at the bank:\n" +
      "\tbalance    : Get your balance.\n" +
      "\tdeposit #  : Deposit # coins in the bank.\n" +
      "\twithdraw # : Withdraw # coins from the bank.\n");
}
Esempio n. 16
0
/****************************************************************************
send a message 
****************************************************************************/
int cli_message_text_build(struct cli_state *cli, char *msg, int len, int grp)
{
	char *msgdos;
	int lendos;
	char *p;

	memset(cli->outbuf,'\0',smb_size);
	set_message(cli->outbuf,1,0,True);
	SCVAL(cli->outbuf,smb_com,SMBsendtxt);
	SSVAL(cli->outbuf,smb_tid,cli->cnum);
	cli_setup_packet(cli);

	SSVAL(cli->outbuf,smb_vwv0,grp);
	
	p = smb_buf(cli->outbuf);
	*p++ = 1;

	if ((lendos = (int)convert_string_allocate(NULL,CH_UNIX, CH_DOS, msg,len, (void **)(void *)&msgdos, True)) < 0 || !msgdos) {
		DEBUG(3,("Conversion failed, sending message in UNIX charset\n"));
		SSVAL(p, 0, len); p += 2;
		memcpy(p, msg, len);
		p += len;
	} else {
		SSVAL(p, 0, lendos); p += 2;
		memcpy(p, msgdos, lendos);
		p += lendos;
		SAFE_FREE(msgdos);
	}

	cli_setup_bcc(cli, p);

	return(PTR_DIFF(p, cli->outbuf));
}
Esempio n. 17
0
/****************************************************************************
  reply to a read and X

  This code is basically stolen from reply_read_and_X with some
  wrinkles to handle pipes.
****************************************************************************/
int reply_pipe_read_and_X(char *inbuf,char *outbuf,int length,int bufsize)
{
	pipes_struct *p = get_rpc_pipe_p(inbuf,smb_vwv2);
	int smb_maxcnt = SVAL(inbuf,smb_vwv5);
	int smb_mincnt = SVAL(inbuf,smb_vwv6);
	int nread = -1;
	char *data;
	/* we don't use the offset given to use for pipe reads. This
           is deliberate, instead we always return the next lump of
           data on the pipe */
#if 0
	uint32 smb_offs = IVAL(inbuf,smb_vwv3);
#endif

	if (!p)
		return(ERROR(ERRDOS,ERRbadfid));

	set_message(outbuf,12,0,True);
	data = smb_buf(outbuf);

	nread = (int)read_from_pipe(p, data, (size_t)smb_maxcnt);

	if (nread < 0)
		return(UNIXERROR(ERRDOS,ERRnoaccess));
  
	SSVAL(outbuf,smb_vwv5,nread);
	SSVAL(outbuf,smb_vwv6,smb_offset(data,outbuf));
	SSVAL(smb_buf(outbuf),-2,nread);
  
	DEBUG(3,("readX-IPC pnum=%04x min=%d max=%d nread=%d\n",
		 p->pnum, smb_mincnt, smb_maxcnt, nread));

	return chain_reply(inbuf,outbuf,length,bufsize);
}
Esempio n. 18
0
void Articles::remove(const std::string slug) {

    CHECK_PERMISSION_OR_GO_TO_LOGIN();

    const bool success = articlesModel->remove(
        get_interface_lang(),
        slug
    );
    
    if (success) {
        set_message(_("The article has been removed"));
    } else {
        set_message(_("A problem occured while trying to remove"));
    }
    go_to_main_page();
}
Esempio n. 19
0
void cli_negprot_send(struct cli_state *cli)
{
	char *p;
	int numprots;

	memset(cli->outbuf,'\0',smb_size);

	/* setup the protocol strings */
	set_message(cli->outbuf,0,0,True);

	p = smb_buf(cli->outbuf);
	for (numprots=0;
	     prots[numprots].name && prots[numprots].prot<=cli->protocol;
	     numprots++) {
		*p++ = 2;
		p += clistr_push(cli, p, prots[numprots].name, -1, STR_CONVERT|STR_TERMINATE);
	}

	SCVAL(cli->outbuf,smb_com,SMBnegprot);
	cli_setup_bcc(cli, p);
	cli_setup_packet(cli);

	SCVAL(smb_buf(cli->outbuf),0,2);

	cli_send_smb(cli);
}
Esempio n. 20
0
void set_priority_proc(void) {
	
	/*sends message to kcd to register the command types*/
	ENVELOPE *msg = (ENVELOPE *)request_memory_block();
	msg->message_type = MSG_COMMAND_REGISTRATION;
	msg->sender_pid = SET_PRIORITY_PID;
	msg->destination_pid = KCD_PID;
	set_message(msg, "%C" + '\0', 4*sizeof(char));
	send_message(KCD_PID, msg);
	while(1){
		int priority, pid;
		ENVELOPE * rec_msg = (ENVELOPE*) receive_message(NULL);
		char * char_message = (char *) rec_msg->message;
		if ((char_message[3] >= '1')&&(char_message[3] <= '6')&&(char_message[4] == ' ')&&(char_message[5] >= '0')&&(char_message[5] <= '3') && (char_message[6] == '\0')){
			pid = char_message[3] - '0';
			priority = char_message[5] - '0';
			//printf("message %s", char_message);
			//printf("pid %d priority %d", pid, priority);
			set_process_priority(pid, priority);	
		}
		else {				
			ENVELOPE * error_msg = (ENVELOPE*) request_memory_block();
			error_msg->sender_pid = SET_PRIORITY_PID;
			error_msg->destination_pid = CRT_PID;
			error_msg->message_type = MSG_CRT_DISPLAY;

			error_msg->message = error_msg + HEADER_OFFSET;
			sprintf(error_msg->message, "You have entered an invalid input\n\r"); 

			send_message(CRT_PID, error_msg);
		}
		release_memory_block(rec_msg);
	}
	
}
Esempio n. 21
0
void kcd_proc(void) 
{
	ENVELOPE* msg;
	int i;
	while(1)
	{
		msg = (ENVELOPE*) receive_message(NULL);
		if (msg != NULL)
		{
			if (msg->message_type == MSG_COMMAND_REGISTRATION)
			{
				for (i = 0; i < KC_MAX_COMMANDS; i++)
				{
					if (g_kc_reg[i].pid == -1)
					{
						g_kc_reg[i].pid = msg->sender_pid;
						strcpy(g_kc_reg[i].command, msg->message);
						break;
					}
				}
			}
			else if (msg->message_type == MSG_CONSOLE_INPUT)
			{
				int i = 0;
				int j;
				char command[KC_MAX_CHAR];
				char* message_curr = msg->message;
				while ((i < KC_MAX_CHAR)&&(message_curr[i] != ' ')&&(message_curr[i] != '\0'))
				{
					command[i] = message_curr[i];
					i++;
				}
				command[i] = '\0';
				
				// find end of message 
				while (message_curr[i] != '\0')
				{
					i++;
				}
				
				for (j = 0; j < KC_MAX_COMMANDS; j++)
				{
					if ((strcmp(command,g_kc_reg[j].command) == 0)&&(g_kc_reg[j].pid != -1))
					{
						ENVELOPE* kcd_msg = (ENVELOPE*) request_memory_block();
						kcd_msg->sender_pid = KCD_PID;
						kcd_msg->destination_pid = g_kc_reg[j].pid;
						kcd_msg->nextMsg = NULL;
						kcd_msg->message_type = MSG_KCD_DISPATCH;
						kcd_msg->delay = 0;
						set_message(kcd_msg, message_curr, i*sizeof(char));	
						send_message(g_kc_reg[j].pid, kcd_msg);
						break;
					}
				}
			}
		}
		release_memory_block(msg);
	}
}
Esempio n. 22
0
void set_condemn_building( string building ) {
   object ob;

   if( ob = single_present(building, environment(this_player())) ) {
      string bname = ob->query_distant();
      if( !ob->query_is_building() ) {
         msg( "That's not a building, and may not be condemned." );
         return;
      }
      if( ob->query_name() == "foundstone" ) {
         msg( "Condemnation signs may not be used to destroy a foundstone." );
         return;
      }
      condemn_time = time() + 2 * 365 * 24 * 120; // 120 seconds per hour on Walraven...
      condemn_time = (condemn_time/2880) * 2880; // Round to an even date.
      condemn_obj = to_objectref(ob);
      drop_interface();
      set_message( "This building, "+ob->query_distant()+", was ~CWRNcondemned~CDEF by ~CBRT" +
      capitalize(this_player()->query_name()) + "~CDEF on " +
      "/daemon/time"->query_date() + ". To remove "
      "the condemnation, simply raze this sign. To enforce the condemnation, you "
      "should ~CCOMuse sign~CDEF after the warning time expires. Warning expires two years from the date posted." );
      msg( "OK, you'll condemn " + bname + ". Come back when the warning expires!" ) ;
      return;
   }
   else if( building == "cancel" ) {
      msg( "Never mind, then." );
      destruct(this_object());
      return;
   }
   else {
      msg( "Couldn't identify that building. Try again, or type 'cancel' to quit." );
      return;
   }
}
/****************************************************************************
  reply to a write on a pipe
****************************************************************************/
int reply_pipe_write(char *inbuf,char *outbuf,int length,int dum_bufsize, int threadid)
{
	pipes_struct *p = get_rpc_pipe_p(inbuf,smb_vwv0, threadid);
	uint32 numtowrite = SVAL(inbuf,smb_vwv1);
	int nwritten;
	int outsize;
	char *data;

	if (!p)
		return(ERROR(ERRDOS,ERRbadfid));

	data = smb_buf(inbuf) + 3;

	if (numtowrite == 0)
		nwritten = 0;
	else
		nwritten = write_to_pipe(p, data, numtowrite);

	if ((nwritten == 0 && numtowrite != 0) || (nwritten < 0))
//0507		return (UNIXERROR(ERRDOS,ERRnoaccess));
      	return 0;
	outsize = set_message(outbuf,1,0,True);

	SSVAL(outbuf,smb_vwv0,nwritten);
  
//0507	DEBUG(3,("write-IPC pnum=%04x nwritten=%d\n",
//0507		 p->pnum, nwritten));

	return(outsize);
}
Esempio n. 24
0
/****************************************************************************
  reply to a sendtxt
****************************************************************************/
int reply_sendtxt(connection_struct *conn,
		  char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
{
  int len;
  int outsize = 0;
  char *msg;
  START_PROFILE(SMBsendtxt);

  if (! (*lp_msg_command())) {
    END_PROFILE(SMBsendtxt);
    return(ERROR_DOS(ERRSRV,ERRmsgoff));
  }

  outsize = set_message(outbuf,0,0,True);

  msg = smb_buf(inbuf) + 1;

  len = SVAL(msg,0);
  len = MIN(len,sizeof(msgbuf)-msgpos);

  memcpy(&msgbuf[msgpos],msg+2,len);
  msgpos += len;

  DEBUG( 3, ( "SMBsendtxt\n" ) );

  END_PROFILE(SMBsendtxt);
  return(outsize);
}
Esempio n. 25
0
/****************************************************************************
send a message 
****************************************************************************/
BOOL cli_message_text(struct cli_state *cli, char *msg, int len, int grp)
{
	return False;
#if 0
	char *p;

	memset(cli->outbuf,'\0',smb_size);
	set_message(cli->outbuf,1,len+3,True);
	CVAL(cli->outbuf,smb_com) = SMBsendtxt;
	SSVAL(cli->outbuf,smb_tid,cli->cnum);
	cli_setup_packet(cli);

	SSVAL(cli->outbuf,smb_vwv0,grp);
	
	p = smb_buf(cli->outbuf);
	*p = 1;
	SSVAL(p,1,len);
	memcpy(p+3,msg,len);
	cli_send_smb(cli);

	if (!cli_receive_smb(cli)) {
		return False;
	}

	if (cli_error(cli, NULL, NULL, NULL)) return False;

	return True;
#endif
}      
Esempio n. 26
0
/****************************************************************************
 Check for existance of a dir.
****************************************************************************/
BOOL cli_chkpath(struct cli_state *cli, const char *path)
{
	pstring path2;
	char *p;
	
	pstrcpy(path2,path);
	trim_char(path2,'\0','\\');
	if (!*path2)
		*path2 = '\\';
	
	memset(cli->outbuf,'\0',smb_size);
	set_message(cli->outbuf,0,0,True);
	SCVAL(cli->outbuf,smb_com,SMBchkpth);
	SSVAL(cli->outbuf,smb_tid,cli->cnum);
	cli_setup_packet(cli);
	p = smb_buf(cli->outbuf);
	*p++ = 4;
	p += clistr_push(cli, p, path2, -1, STR_TERMINATE);

	cli_setup_bcc(cli, p);

	cli_send_smb(cli);
	if (!cli_receive_smb(cli)) {
		return False;
	}

	if (cli_is_error(cli)) return False;

	return True;
}
Esempio n. 27
0
static void
bl_pending_change(Widget w, XtPointer data, XtPointer cbs) {
	Calendar *c = (Calendar *) data;
	Browselist	*bl = (Browselist *)c->browselist;

	if (bl->bl_pending_message_up == False) {
		/* NL_COMMENT
		   Attention Translator:

		   Message 841 is used in the Menu Editor's footer.  The
		   Menu Editor is accessed through the browse menu.  The 
		   message is displayed when something is typed into the User
		   Name field in the editor.  If the translated footer message 
		   is too long it causes the menu editor to grow horizontally
		   which we do not want.  If you notice that the translated
		   string causes the editor to grow horizontally please
		   insert a newline (\n) character somewhere in the middle
		   of the string so the footer will use two lines and the
		   editor will grow vertically.
		*/
		set_message(bl->message, catgets(c->DT_catd, 1, 841, "Click on \"Add Name\" to add a name, \"Apply\" to commit changes."));
		bl->bl_pending_message_up = True;
		XtSetSensitive(bl->add_button, True);
	}
}
Esempio n. 28
0
/* 
   send a raw ioctl - used by the torture code
*/
NTSTATUS cli_raw_ioctl(struct cli_state *cli, int fnum, uint32 code, DATA_BLOB *blob)
{
	memset(cli->outbuf,'\0',smb_size);
	memset(cli->inbuf,'\0',smb_size);

	set_message(cli->outbuf, 3, 0, True);
	SCVAL(cli->outbuf,smb_com,SMBioctl);
	cli_setup_packet(cli);

	SSVAL(cli->outbuf, smb_vwv0, fnum);
	SSVAL(cli->outbuf, smb_vwv1, code>>16);
	SSVAL(cli->outbuf, smb_vwv2, (code&0xFFFF));

	cli_send_smb(cli);
	if (!cli_receive_smb(cli)) {
		return NT_STATUS_UNEXPECTED_NETWORK_ERROR;
	}

	if (cli_is_error(cli)) {
		return cli_nt_error(cli);
	}

	*blob = data_blob(NULL, 0);

	return NT_STATUS_OK;
}
Esempio n. 29
0
void
edit_main_rep::footer_eval (string s) {
  // s= unslash (s); // FIXME: dirty fix; should not be necessary
  s= tm_decode (s);
  string r= object_to_string (eval (s));
  set_message (verbatim (r), "evaluate expression");
}
Esempio n. 30
0
/****************************************************************************
  reply to a sendstrt
****************************************************************************/
int reply_sendstrt(connection_struct *conn,
		   char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
{
  int outsize = 0;
  char *p;

  START_PROFILE(SMBsendstrt);

  if (! (*lp_msg_command())) {
    END_PROFILE(SMBsendstrt);
    return(ERROR_DOS(ERRSRV,ERRmsgoff));
  }

  outsize = set_message(outbuf,1,0,True);

  memset(msgbuf,'\0',sizeof(msgbuf));
  msgpos = 0;

  p = smb_buf(inbuf)+1;
  p += srvstr_pull_buf(inbuf, msgfrom, p, sizeof(msgfrom), STR_TERMINATE) + 1;
  p += srvstr_pull_buf(inbuf, msgto, p, sizeof(msgto), STR_TERMINATE) + 1;

  DEBUG( 3, ( "SMBsendstrt (from %s to %s)\n", msgfrom, msgto ) );

  END_PROFILE(SMBsendstrt);
  return(outsize);
}