コード例 #1
0
static void handle_query_response(DNSServiceRef sdr, ipc_msg_hdr *hdr, char *data)
    {
    DNSServiceFlags flags;
    uint32_t interfaceIndex, ttl;
    DNSServiceErrorType errorCode;
    char name[kDNSServiceMaxDomainName];
    uint16_t rrtype, rrclass, rdlen;
    char *rdata;
    int str_error = 0;
    (void)hdr;//Unused

    flags = get_flags(&data);
    interfaceIndex = get_long(&data);
    errorCode = get_error_code(&data);
    if (get_string(&data, name, kDNSServiceMaxDomainName) < 0) str_error = 1;
    rrtype = get_short(&data);
    rrclass = get_short(&data);
    rdlen = get_short(&data);
    rdata = get_rdata(&data, rdlen);
	ttl = get_long(&data);

	if (!errorCode && str_error) errorCode = kDNSServiceErr_Unknown;
	((DNSServiceQueryRecordReply)sdr->app_callback)(sdr, flags, interfaceIndex, errorCode, name, rrtype, rrclass,
													rdlen, rdata, ttl, sdr->app_context);
    return;
    }
コード例 #2
0
static char  *
match_string (ASDatabase * db, DBMatchType type, unsigned int index, Bool dup_strings)
{
	char         *res = NULL;
	register ASDatabaseRecord *db_rec;
	register int  i = 0;

	for( i = 0 ; db->match_list[i] >= 0 ; ++i ) 
	{
		db_rec = get_asdb_record (db, db->match_list[i]);
		if (get_flags (db_rec->set_data_flags, type))
		{
			switch (type)
			{
			 case MATCH_Icon:	 res = db_rec->icon_file;	 break;
			 case MATCH_Frame:	 res = db_rec->frame_name;	 break;
			 case MATCH_Windowbox: res = db_rec->windowbox_name; break;
			 case MATCH_MyStyle: res = db_rec->window_styles[(index < BACK_STYLES) ? index : 0];
				  break;
			 default:
				 break;
			}
		}
	}
	if (res != NULL && dup_strings)
		res = mystrdup (res);
	return res;
}
コード例 #3
0
ファイル: main.c プロジェクト: Remmy/afterstep
void redecorateVolumes() {
	ASVolumeCanvasPlacement placement;
	int width, height;
	
	placement.vertical = get_flags(Config->flags, ASMOUNT_Vertical);
	placement.tileWidth = DEFAULT_TILE_WIDTH;
	placement.tileHeight = DEFAULT_TILE_HEIGHT;
  placement.currPos = 0;
	
	iterate_asbidirlist (AppState.volumes, redecorateVolume, &placement, NULL, False);

	XMapSubwindows (dpy, AppState.mainCanvas->w);

  width = placement.tileWidth;
  height = placement.tileHeight;
	
	if (placement.vertical)
		height = placement.currPos;
	else 
		width = placement.currPos;

	setHints (width, height);
	/* setHints must happen first */
	show_progress ( "resizing main canvas to %dx%d", width, height);	
	resize_canvas (AppState.mainCanvas, width, height);
	ASSync (False);
}
コード例 #4
0
ファイル: dbus.c プロジェクト: afterstep/afterstep
static dbus_bool_t add_watch(DBusWatch *w, void *data)
{
    	if (!dbus_watch_get_enabled(w))
      		return TRUE;

	ASDBusFd *fd = safecalloc (1, sizeof(ASDBusFd));
	fd->fd =  dbus_watch_get_unix_fd(w);
	unsigned int flags = dbus_watch_get_flags(w);
	if (get_flags(flags, DBUS_WATCH_READABLE))
		fd->readable = True;
    /*short cond = EV_PERSIST;
    if (flags & DBUS_WATCH_READABLE)
        cond |= EV_READ;
    if (flags & DBUS_WATCH_WRITABLE)
        cond |= EV_WRITE; */

      // TODO add to the list of FDs
	dbus_watch_set_data(w, fd, NULL);
	if (ASDBus.watchFds == NULL)
		ASDBus.watchFds = create_asvector (sizeof(ASDBusFd*));

	append_vector(ASDBus.watchFds, &fd, 1);

	show_debug(__FILE__,__FUNCTION__,__LINE__,"added dbus watch fd=%d watch=%p readable =%d\n", fd->fd, w, fd->readable);
	return TRUE;
}
コード例 #5
0
ファイル: dumpdfs.c プロジェクト: DragonMinded/libdragon
/* Find the first file or directory in a directory listing.  Supports absolute
   and relative.  If the path is invalid, returns a negative DFS_errno.  If
   a file or directory is found, returns the flags of the entry and copies the
   name into buf. */
int dfs_dir_findfirst(const char * const path, char *buf)
{
    directory_entry_t *dirent;
    int ret = recurse_path(path, WALK_OPEN, &dirent, TYPE_DIR);

    /* Ensure that if this fails, they can't call findnext */
    next_entry = 0;

    if(ret != DFS_ESUCCESS)
    {
        /* File not found, or other error */
        return ret;
    }

    /* We now have the pointer to the first entry */
    directory_entry_t t_node;
    grab_sector(dirent, &t_node);

    if(buf)
    {
        strcpy(buf, t_node.path);    
    }
    
    /* Set up directory to point to next entry */
    next_entry = get_next_entry(&t_node);

    return get_flags(&t_node);
}
コード例 #6
0
static int
match_int (ASDatabase * db, DBMatchType type)
{
	register ASDatabaseRecord *db_rec;
	register int  i = 0;
	int value = 0 ;

	for( i = 0 ; db->match_list[i] >= 0 ; ++i ) 
	{
		db_rec = get_asdb_record (db, db->match_list[i]);
		if (get_flags (db_rec->set_data_flags, type))
		{
			switch (type)
			{
			 case MATCH_Desk:		 	value = db_rec->desk; break;
			 case MATCH_layer:		 	value = db_rec->layer; break;
			 case MATCH_ViewportX:
				 LOCAL_DEBUG_OUT( "viewport_x = %d", db_rec->viewport_x );
				 value = db_rec->viewport_x;
				  break;
			 case MATCH_ViewportY:   	value = db_rec->viewport_y; break;
			 case MATCH_border_width: 	value = db_rec->border_width; break;
			 case MATCH_resize_width: 	value = db_rec->resize_width; break;
			 case MATCH_gravity:	 	value = db_rec->gravity; break;
			 case MATCH_window_opacity:	value = db_rec->window_opacity; break;
			 default:
				 break;
			}
		}
	}
	return value;
}
コード例 #7
0
void
asgtk_image_view_set_resize (ASGtkImageView * iv,
														 unsigned long resize_flags,
														 unsigned long set_mask)
{
	unsigned long new_flags;

	g_return_if_fail (ASGTK_IS_IMAGE_VIEW (iv));

	new_flags = (iv->flags & (~set_mask)) | (resize_flags & set_mask);
	if (new_flags == iv->flags)
		return;

	iv->flags = new_flags;
	if (get_flags
			(new_flags,
			 ASGTK_IMAGE_VIEW_SCALE_TO_VIEW | ASGTK_IMAGE_VIEW_TILE_TO_VIEW)) {
		gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW
																		(iv->scrolled_window),
																		GTK_POLICY_NEVER, GTK_POLICY_NEVER);
	} else {
		gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW
																		(iv->scrolled_window),
																		GTK_POLICY_AUTOMATIC,
																		GTK_POLICY_AUTOMATIC);
	}
	if (iv->image_entry) {
		display_image_view (iv);
	}
}
コード例 #8
0
ファイル: push_swap.c プロジェクト: Orycterope/push_swap
int			main(int ac, char *av[])
{
	char	*flags;
	char	*command;
	char	*op_list;
	t_pile	*pile_tab[2];

	command = av[0];
	if (ac < 2)
		display_usage(command);
	flags = get_flags(&ac, &av);
	if (ac < 1)
		display_usage(command);
	pile_tab[0] = save_param_to_pile(ac, av, command);
	pile_tab[1] = NULL;
	if (has_duplicate(pile_tab[0]))
		print_error();
	if (ft_strchr(flags, 'v'))
		print_piles(pile_tab);
	op_list = solve(pile_tab, flags);
	if (op_list == NULL)
		ft_putendl("Already sorted");
	else
		ft_putendl(op_list);
	return (0);
}
コード例 #9
0
ファイル: memmgr_info.c プロジェクト: vocho/openqnx
int 
memmgr_info(resmgr_context_t *ctp, PROCESS *prp, mem_info_t *msg) {
	OBJECT		*obp;
	int			r;
	unsigned	flags;
	paddr_t		size;

	if(msg->i.fd != NOFD) {
		r = memmgr_find_object(ctp, prp, msg->i.fd, NULL, &obp);
		switch(r) {
		case EOK:	
			if(obp != NULL) break;
			// fall through
		case ENOTSUP:
			r = ENODEV;
			// fall through
		default:
			return r;
		}
		switch(obp->hdr.type) {
		case OBJECT_MEM_TYPED:	
			flags = get_flags(ctp, msg->i.fd);
			if(flags & IMAP_TYMEM_ALLOCATE) {
				tymem_free_info(obp, &size, NULL);
			} else if(flags & IMAP_TYMEM_ALLOCATE_CONTIG) {
				tymem_free_info(obp, NULL, &size);
			} else {
				size = 0;
			}
			memset(&msg->o, 0x00, sizeof msg->o);
			msg->o.info.posix_tmi_length = size;
			memobj_unlock(obp);
			return _RESMGR_PTR(ctp, &msg->o, sizeof msg->o);
		default:
			break;
		}
		
		memobj_unlock(obp);
		return ENODEV;
	}
	if(!(msg->i.flags & MAP_ANON)) {
		switch(msg->i.flags & MAP_TYPE) {
		case MAP_PRIVATEANON:
		case MAP_PRIVATE:
			break;
		case MAP_SHARED:
			return EINVAL;
		default:
			break;
		}
	}
	if(msg->i.flags & MAP_PHYS) {
		/* @@@ Don't support returning largest chuck yet */
		return EINVAL;
	}

	memset(&msg->o, 0x00, sizeof msg->o);
	msg->o.info.posix_tmi_length = mem_free_size;
	return _RESMGR_PTR(ctp, &msg->o, sizeof msg->o);
}
コード例 #10
0
void ItemListPlugin::_get_property_list( List<PropertyInfo> *p_list) const {

	for(int i=0;i<get_item_count();i++) {

		String base=itos(i)+"/";

		p_list->push_back( PropertyInfo(Variant::STRING,base+"text") );
		p_list->push_back( PropertyInfo(Variant::OBJECT,base+"icon",PROPERTY_HINT_RESOURCE_TYPE,"Texture") );

		int flags = get_flags();

		if (flags&FLAG_CHECKABLE) {
			p_list->push_back( PropertyInfo(Variant::BOOL,base+"checkable") );
			p_list->push_back( PropertyInfo(Variant::BOOL,base+"checked") );
		}

		if (flags&FLAG_ID)
			p_list->push_back( PropertyInfo(Variant::INT,base+"id",PROPERTY_HINT_RANGE,"-1,4096") );

		if (flags&FLAG_ENABLE)
			p_list->push_back( PropertyInfo(Variant::BOOL,base+"enabled") );

		if (flags&FLAG_SEPARATOR)
			p_list->push_back( PropertyInfo(Variant::BOOL,base+"separator") );
	}
}
コード例 #11
0
void tomorrow() {
    dom = 1;
    leap = nyear = nmonth = false;
     
    get_flags();
    update();
}
コード例 #12
0
ファイル: mu-cmd-server.c プロジェクト: Popsch/mu
static MuError
move_msgid (MuStore *store, unsigned docid, const char* flagstr, GError **err)
{
	MuMsg *msg;
	MuError rv;
	MuFlags flags;

	rv  = MU_ERROR;
	msg = mu_store_get_msg (store, docid, err);

	if (!msg)
		goto leave;

	flags = flagstr ? get_flags (mu_msg_get_path(msg), flagstr) :
		mu_msg_get_flags (msg);
	if (flags == MU_FLAG_INVALID) {
		mu_util_g_set_error (err, MU_ERROR_IN_PARAMETERS,
				     "invalid flags");
		goto leave;
	}

	rv = do_move (store, docid, msg, NULL, flags, err);

leave:
	if (msg)
		mu_msg_unref (msg);
	if (rv != MU_OK)
		print_and_clear_g_error (err);

	return rv;
}
コード例 #13
0
ファイル: layout.c プロジェクト: Remmy/afterstep
/* fixed size handling :                                              */
static unsigned int
get_layout_fixed_width( ASLayout *layout, unsigned int start_col, unsigned int end_col )
{
    register int i ;
	unsigned int width = 0 ;

    for( i = start_col ; i < end_col ; ++i )
    {
        register ASLayoutElem *pelem = layout->cols[i];
        register int fw = 0 ;
        while ( pelem )
        {
            if( get_flags( pelem->flags, LF_FixedWidth ) )
			{
                LOCAL_DEBUG_OUT( " layout %lX found item with fixed width %d at %dx%d",
                                    (unsigned long)layout, pelem->fixed_width, pelem->row, pelem->column );
                if( pelem->fixed_width+pelem->bw > fw )
                    fw = pelem->fixed_width+pelem->bw ;
            }
			pelem = pelem->below ;
        }
        if( fw > 0 )
            width += fw+layout->v_spacing ;
    }
    if( width > 0 )
        width -= (int)layout->v_spacing ;
	return width ;
}
コード例 #14
0
ファイル: layout.c プロジェクト: Remmy/afterstep
static unsigned int
get_layout_fixed_height( ASLayout *layout, unsigned int start_row, unsigned int end_row )
{
    register int i ;
	unsigned int height = 0 ;

    for( i = start_row ; i < end_row ; i++ )
    {
        register ASLayoutElem *pelem = layout->rows[i];
        register int fh = 0 ;
        while ( pelem )
        {
            if( get_flags( pelem->flags, LF_FixedHeight ) )
			{
LOCAL_DEBUG_OUT( " layout %lX found item with fixed height %d at %dx%d", (unsigned long)layout, pelem->fixed_height, pelem->row, pelem->column );
                if( pelem->fixed_height+pelem->bw > fh )
                    fh = pelem->fixed_height+pelem->bw ;
			}
            pelem = pelem->right ;
        }
        if( fh > 0 )
            height += fh+layout->h_spacing ;
    }
    if( height >0 )
        height -= layout->h_spacing ;
	return height;
}
コード例 #15
0
static HRESULT WINAPI DispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
{
    DispatchEx *This = DISPATCHEX_THIS(iface);
    dispex_prop_t *iter;
    HRESULT hres;

    TRACE("(%p)->(%x %x %p)\n", This, grfdex, id, pid);

    if(id == DISPID_STARTENUM) {
        hres = fill_protrefs(This);
        if(FAILED(hres))
            return hres;
    }

    iter = get_prop(This, id+1);
    if(!iter) {
        *pid = DISPID_STARTENUM;
        return S_FALSE;
    }

    while(iter < This->props + This->prop_cnt) {
        if(iter->name && (get_flags(This, iter) & PROPF_ENUM)) {
            *pid = prop_to_id(This, iter);
            return S_OK;
        }
        iter++;
    }

    *pid = DISPID_STARTENUM;
    return S_FALSE;
}
コード例 #16
0
void ppp_recv_config (int unit,int mru,u_int32_t asyncmap,int pcomp,int accomp)
  {
    u_int x;

    MAINDEBUG ((LOG_DEBUG, "recv_config: mru = %d\n", mru));
/*
 * If we were called because the link has gone down then there is nothing
 * which may be done. Just return without incident.
 */
    if (!still_ppp())
      {
	return;
      }
/*
 * Set the receiver parameters
 */
    if (ioctl(fd, PPPIOCSMRU, (caddr_t) &mru) < 0)
      {
	syslog(LOG_ERR, "ioctl(PPPIOCSMRU): %m");
      }

    MAINDEBUG ((LOG_DEBUG, "recv_config: asyncmap = %lx\n", asyncmap));
    if (ioctl(fd, PPPIOCSRASYNCMAP, (caddr_t) &asyncmap) < 0)
      {
        syslog(LOG_ERR, "ioctl(PPPIOCSRASYNCMAP): %m");
	quit();
      }

    x = get_flags();
    x = accomp ? x & ~SC_REJ_COMP_AC : x | SC_REJ_COMP_AC;
    set_flags (x);
  }
コード例 #17
0
ファイル: time.cpp プロジェクト: thefightingferret/tfe-1.0
void do_time( char_data* ch, char* argument )
{
  player_data*    pc;
  int          flags;

  if( !get_flags( ch, argument, &flags, "z", "Time" ) )
    return;

  if( flags == 0 ) {
    send( ch, "Minute: %d  Hour: %d  Day: %d  Month: %s\r\n",
      weather.minute, weather.hour, weather.day,
      month_name[weather.month] );
    send( ch, "[This is temporary]\r\n" );
    return;
    }

  if( ( pc = player( ch ) ) == NULL )
    return;

  class type_field zonetype =
    { "timezone", 24, &timezones[0], &timezones[1], &pc->timezone };

  zonetype.set( ch, empty_string, argument );

  return;
}
コード例 #18
0
static void handle_resolve_response(DNSServiceRef sdr, ipc_msg_hdr *hdr, char *data)
    {
    DNSServiceFlags flags;
    char fullname[kDNSServiceMaxDomainName];
    char target[kDNSServiceMaxDomainName];
    uint16_t txtlen;
    union { uint16_t s; u_char b[2]; } port;
    uint32_t ifi;
    DNSServiceErrorType err;
    unsigned char *txtrecord;
    int str_error = 0;
    (void)hdr; 		//unused

    flags = get_flags(&data);
    ifi = get_long(&data);
    err = get_error_code(&data);
    if (get_string(&data, fullname, kDNSServiceMaxDomainName) < 0) str_error = 1;
    if (get_string(&data, target, kDNSServiceMaxDomainName) < 0) str_error = 1;
    port.b[0] = *data++;
    port.b[1] = *data++;
    txtlen = get_short(&data);
    txtrecord = (unsigned char *)get_rdata(&data, txtlen);

	if (!err && str_error) err = kDNSServiceErr_Unknown;
    ((DNSServiceResolveReply)sdr->app_callback)(sdr, flags, ifi, err, fullname, target, port.s, txtlen, txtrecord, sdr->app_context);
    }
コード例 #19
0
void
write_standard_options_source( FILE *f )
{
	int i = 0;
	fprintf( f, "<anchor id=\"standard_options_list\"/>\n"
				"<refsect1>\n"
				"<title>STANDARD OPTIONS</title>\n"
				"<para>The following is the list of command line options supported by"
				" all AfterStep modules and applications.</para>" 
				"<variablelist>\n" );

	while( as_standard_cmdl_options[i].long_opt ) 
	{
		fprintf( f, "	<varlistentry>\n" );
		if( as_standard_cmdl_options[i].short_opt  )
  			fprintf( f, "	<term>-%s | --%s", as_standard_cmdl_options[i].short_opt, as_standard_cmdl_options[i].long_opt );
		else
  			fprintf( f, "	<term>     --%s", as_standard_cmdl_options[i].long_opt );
        
		if( get_flags( as_standard_cmdl_options[i].flags, CMO_HasArgs ) )
			fprintf( f, " <replaceable>val</replaceable>" );	

		fprintf( f, "</term>\n" 
					"	<listitem>\n" ); 
		fprintf( f, "   <para>%s. ", as_standard_cmdl_options[i].descr1 );
		if( as_standard_cmdl_options[i].descr2 )
			fprintf( f, " %s.", as_standard_cmdl_options[i].descr2 );
		fprintf( f, "   </para>\n"
					"   </listitem>\n"
					"	</varlistentry>\n" );
		++i ;
	}	 
	fprintf( f, "</variablelist>\n"
				"</refsect1>\n" );
}
コード例 #20
0
ファイル: exit.cpp プロジェクト: thefightingferret/tfe-1.0
void do_dedit( char_data* ch, char* argument )
{
  wizard_data*    imm  = (wizard_data*) ch;
  exit_data*     exit;
  int           flags;
  int             dir;

  if( !get_flags( ch, argument, &flags, "1", "dedit" ) )
    return;

  if( matches( argument, "delete" ) ) {
    if( ( exit = (exit_data*) one_thing( ch, argument, "dedit delete", 
      (thing_array*) &ch->in_room->exits ) ) != NULL )
      delete_exit( imm, exit, is_set( &flags, 0 ) );
    return;
    }

  if( matches( argument, "new" ) ) {
    if( ( dir = direction_arg( argument ) ) != -1 ) 
      create_exit( imm, dir, argument, is_set( &flags, 0 ) );
    return;
    }

  if( ( exit = (exit_data*) one_thing( ch, argument, "dedit", 
    (thing_array*) &ch->in_room->exits ) ) == NULL )
    return;

  imm->exit_edit = exit;

  send( ch, "Dflag and dset now act on the exit %s.\n\r",
    dir_table[ exit->direction ].where );
}
コード例 #21
0
ファイル: print_header.c プロジェクト: Raphy/nmobjdump
static void	print_flags(t_dumper *dumper)
{
  size_t	flags;

  flags = get_flags(dumper);
  printf("flags 0x%08lx:\n", flags);
  printf("\n");
}
コード例 #22
0
ファイル: thread_x86.c プロジェクト: winksaville/sadie
/**
 * Create a thread and invoke the entry passing entry_arg. If
 * the entry routine returns the thread is considered dead
 * and will not be rescheduled and its stack is reclamined.
 * Any other global memory associated with the thread still
 * exists and is left untouched.
 *
 * @param stack_size is 0 a "default" stack size will be used.
 * @param entry is the routine to run
 * @param entry_arg is the argument passed to entry.
 *
 * @return a ac_thread_rslt contains a status and an opaque ac_thread_hdl_t.
 *         if rslt.status == 0 the thread was created and ac_thread_hdl_t
 *         is valid.
 */
ac_thread_rslt_t ac_thread_create(ac_size_t stack_size,
    void*(*entry)(void*), void* entry_arg) {
  ac_thread_rslt_t rslt;

  rslt.hdl = (ac_thread_hdl_t)thread_create(stack_size, get_flags(), entry, entry_arg);
  rslt.status = (rslt.hdl != 0) ? 0 : 1;
  return rslt;
}
コード例 #23
0
ファイル: WinList.c プロジェクト: cooljeanius/AfterStep
ASFlagType DigestWinListAlign( WinListConfig *Config, ASFlagType align )
{
	LOCAL_DEBUG_OUT( "Align = 0x%8.8lx, IconAlign = 0x%8.8lx, Location = %d", align, Config->IconAlign, Config->IconLocation );

	if( !get_flags( Config->set_flags, WINLIST_IconLocation ) )
	{
		if( get_flags(align, PAD_H_MASK) == ALIGN_RIGHT ) 
			Config->IconLocation = 6 ; 
		else if( get_flags(align, PAD_H_MASK) == ALIGN_LEFT ) 
			Config->IconLocation = 4 ; 
	}		
	if( !get_flags( Config->set_flags, WINLIST_IconAlign ) )
	{
		if( get_flags(align, PAD_H_MASK) == PAD_H_MASK )
		{
			if( Config->IconLocation == 0 || Config->IconLocation == 4  )
			{
				Config->IconAlign = ALIGN_RIGHT ; 
				align = (align&(~PAD_H_MASK))|ALIGN_LEFT ; 
			}else if( Config->IconLocation == 6  )
			{
				Config->IconAlign = ALIGN_LEFT ; 
				align = (align&(~PAD_H_MASK))|ALIGN_RIGHT ; 
			}
		}else if( get_flags(align, PAD_H_MASK) == ALIGN_LEFT && (Config->IconLocation == 0 || Config->IconLocation == 4) )
			Config->IconAlign = ALIGN_VCENTER ;
		else if( get_flags(align, PAD_H_MASK) == ALIGN_RIGHT && Config->IconLocation == 6 )
			Config->IconAlign = ALIGN_VCENTER ;
	}
	LOCAL_DEBUG_OUT( "Align = 0x%8.8lx, IconAlign = 0x%8.8lx, Location = %d", align, Config->IconAlign, Config->IconLocation );
	return align ;

}
コード例 #24
0
ファイル: uxctty.c プロジェクト: tali713/mit-scheme
static void
save_external_state (struct terminal_state_recording * s)
{
  (s -> recorded_p) =
    (scheme_in_foreground
     && (isatty (s -> fd))
     && ((get_terminal_state ((s -> fd), (& (s -> state)))) >= 0)
     && ((get_flags ((s -> fd), (& (s -> flags)))) >= 0));
}
コード例 #25
0
ファイル: sys-linux.c プロジェクト: WiseMan787/ralink_sdk
void ccp_flags_set (int unit, int isopen, int isup)
{
    if (still_ppp()) {
	int x = get_flags(ppp_dev_fd);
	x = isopen? x | SC_CCP_OPEN : x &~ SC_CCP_OPEN;
	x = isup?   x | SC_CCP_UP   : x &~ SC_CCP_UP;
	set_flags (ppp_dev_fd, x);
    }
}
コード例 #26
0
ファイル: layout.c プロジェクト: Remmy/afterstep
void grid_coords2real (ASGrid *g, ASGridLine *l, int *band,  int *start, int *end)
{
	*band = l->band;
	*start = l->start;
	*end = l->end;
	if (!get_flags(l->flags, ASGL_Absolute)) {
		if (get_flags(l->flags, ASGL_Vertical)) {
			*band -= g->curr_vx;
			*start -= g->curr_vy;
			*end -= g->curr_vy;
		} else {
			*band -= g->curr_vy;
			*start -= g->curr_vx;
			*end -= g->curr_vx;
		}
LOCAL_DEBUG_OUT ("virtual: %d, %d-%d, real %d, %d-%d", l->band, l->start, l->end, *band, *start, *end);
	}
} 
コード例 #27
0
ファイル: layout.c プロジェクト: Remmy/afterstep
ASFlagType
set_layout_context_fixed_size( ASLayout *layout, int context, unsigned int width, unsigned int height, unsigned short flags )
{
    if( layout && layout->count > 0 )
    {
        ASLayoutElem **pelem = get_layout_context_ptr( layout, context );
		LOCAL_DEBUG_OUT( "setting fixedsize of context %d(%p) to %dx%d", context, pelem?*pelem:NULL, width, height );
		if( pelem != NULL )
		{
            register ASLayoutElem *elem = *pelem ;
			if( get_flags( flags, LF_FixedWidth ) )
				elem->fixed_width = width ;
			if( get_flags( flags, LF_FixedHeight ) )
				elem->fixed_height = height ;
			return elem->flags&LF_FixedSize&flags;
		}
    }
	return 0;
}
コード例 #28
0
ファイル: xmlproc.c プロジェクト: Remmy/afterstep
Bool 
convert_xml_file( const char *syntax_dir, const char *file, ASXMLInterpreterState *state )
{
	char *source_file ;
	char *doc_str ; 
	Bool empty_file = False ;
	
	source_file = make_file_name( syntax_dir, file );
	doc_str = load_file(source_file);
	LOCAL_DEBUG_OUT( "file %s loaded", source_file );
	/*LOCAL_DEBUG_OUT( "file %s loaded into {%s}", source_file, doc_str ); */
	if( doc_str != NULL )
	{
		xml_elem_t* doc;
		xml_elem_t* ptr;
		
		if( file[0] == '_' && !get_flags( state->flags, ASXMLI_ProcessingOptions )) 
			state->pre_options_size += strlen(doc_str) ;
		else
			set_flags( state->flags, ASXMLI_ProcessingOptions );

		doc = xml_parse_doc(doc_str, DocBookVocabulary);
		LOCAL_DEBUG_OUT( "file %s parsed, child is %p", source_file, doc->child );
		if( doc->child ) 
		{
			LOCAL_DEBUG_OUT( "child tag = \"%s\", childs child = %p", doc->child->tag, doc->child->child);
			empty_file  = ( doc->child->tag_id == DOCBOOK_section_ID && 
							doc->child->child == NULL );
			if( doc->child->child ) 
			{
				empty_file  = ( doc->child->child->tag_id == XML_CDATA_ID && doc->child->child->next == NULL ); 
				LOCAL_DEBUG_OUT( "childs child tag = \"%s\", parm = \"%s\"", doc->child->child->tag, doc->child->child->parm);
			}	 
	   	}	 
		LOCAL_DEBUG_OUT( "file %s %s", source_file, empty_file?"empty":"not empty" );
		if( !empty_file )
		{	
			for (ptr = doc->child ; ptr ; ptr = ptr->next) 
			{
				LOCAL_DEBUG_OUT( "converting child <%s>", ptr->tag );
	  			convert_xml_tag( ptr, NULL, state );
				LOCAL_DEBUG_OUT( "done converting child <%s>", ptr->tag );
			}
		}
		/* Delete the xml. */
		LOCAL_DEBUG_OUT( "deleting xml %p", doc );
		xml_elem_delete(NULL, doc);
		LOCAL_DEBUG_OUT( "freeing doc_str %p", doc_str );
		free( doc_str );		
	}	 	   
	LOCAL_DEBUG_OUT( "done with %s", source_file );
	free( source_file );
	fprintf( state->dest_fp, "\n" );
	return !empty_file;
}
コード例 #29
0
inline osmium::util::MemoryMapping::MemoryMapping(size_t size, mapping_mode mode, int fd, off_t offset) :
    m_size(check_size(size)),
    m_offset(offset),
    m_fd(resize_fd(fd)),
    m_mapping_mode(mode),
    m_addr(::mmap(nullptr, m_size, get_protection(), get_flags(), m_fd, m_offset)) {
    assert(!(fd == -1 && mode == mapping_mode::readonly));
    if (!is_valid()) {
        throw std::system_error(errno, std::system_category(), "mmap failed");
    }
}
コード例 #30
0
ファイル: user.cpp プロジェクト: pombreda/main
	void User::set_flags(const ustring& name, DWORD in, bool value, const ustring& dom) {
		const DWORD level = 1008;
		DWORD dwFlags = get_flags(name, dom);
		if (value)
			bits::Flags::set(dwFlags, in);
		else
			bits::Flags::unset(dwFlags, in);
		USER_INFO_1008 info;
		info.usri1008_flags = dwFlags;
		set_info(name, dom, level, &info);
	}