예제 #1
0
파일: iprinit.c 프로젝트: bjking1/iprutils
int main(int argc, char *argv[])
{
	int i, rc, delay_secs, wait;

	ipr_sg_required = 1;

	openlog("iprinit", LOG_PERROR | LOG_PID | LOG_CONS, LOG_USER);

	for (i = 1; i < argc; i++) {
		if (parse_option(argv[i]))
			continue;
		else {
			printf("Usage: iprinit [options]\n");
			printf("  Options: --version [--daemon]   Print iprinit version\n");
			return -EINVAL;
		}
	}

	rc = check_sg_module();

	if (daemonize) {
		ipr_daemonize();

		if (!rc)
			rc = init_all();

		if (rc) {
			delay_secs = 2;
			sleep(delay_secs);

			for (wait = 0; rc && wait < 300; wait += delay_secs) {
				rc = check_sg_module();
				sleep(delay_secs);
				if (!rc)
					rc = init_all();
			}

			if (rc)
				syslog(LOG_ERR, "Timeout reached. Ensure the sg module is loaded, then "
				       "run iprinit manually to ensure all "
				       "ipr RAID adapters are running optimally\n");
		}
		return handle_events(poll_ioas, 60, kevent_handler);
	} else if (!rc)
		rc = init_all();

	if (rc)
		syslog(LOG_ERR, "iprinit failed. Ensure the sg module is loaded, then "
		       "run iprinit again to ensure all "
		       "ipr RAID adapters are running optimally\n");

	return rc;
}
예제 #2
0
int main()
{
        init_all();
        struct compact p;
        char board[STRLEN],path[STRLEN];
        strsncpy(board, getparm("board"), 20);
        sprintf(path,"compact/%s/compact",board);
        int   total=get_num_records(path,sizeof(p));
        if(total==0) {
                showinfo("该板尚无过刊.");
                return 1;
        }

        printf("<center>%s 过刊区<br>",board);
        printf("----------------------------------------------------------");
        printf("<table width=80% boarder=0 align=center>");
        printf("<tr><td>序号</td><td>名称</td><td>文章总数</td><td>建立日期</td></tr>");
        FILE *fp=fopen(path,"r");
        if(fp==0) {
                printf("文件读取错误,请重试.");
                return 1;
        }
        int  i=1;
        while(1) {
                if(fread(&p, sizeof(p), 1, fp)<=0)
                        break;
                printf("<tr><td>%d</td><td><a href=bbsdoc?board=%s&&mode=c&&num=%d>%s</a></td><td>%d</td><td>%6.6s</td></tr>\
                       ",i,board,i,p.name,p.total,ctime(&p.time)+4);
                i++;
        }

        printf("</table>");
        fclose(fp);
        return 0;
}
예제 #3
0
int main() {
    int i, total=0, mode;
    char  *ptr;
    struct boardheader *brd;
    init_all();
    printf("<b>删除信件 · %s </b><br>\n",BBSNAME);
    printpretable_lite();
    if(!loginok)
        http_fatal("请先登录");
    mode=atoi(getparm("mode"));
    if(mode<=0 || mode>1)
        http_fatal("错误的参数");
    printf("<table>");
    for(i=0; i<parm_num && i<40; i++)
    {
        if(!strncmp(parm_name[i], "box", 3))
        {
            total++;
            if(mode==1)
                do_del(parm_name[i]+3);
            /* for extension */
        }
    }
    printf("</table>");
    if(total<=0)
        printf("请先选定文章<br>\n");
    printposttable_lite();
    printf("<br><a href=bbsmail>返回信件模式</a>");
    http_quit();
}
예제 #4
0
int main()
{
        int i;
        int shift=1;	//wzk
        char board[80];
        init_all();
        if(!loginok)
                http_fatal("您尚未登录, 请先登录");
        strsncpy(board, getparm("board"), 30);
        if(!has_read_perm(&currentuser, board))
                http_fatal("错误的讨论区");
        if(!has_BM_perm(&currentuser, board))
                http_fatal("你无权进行本操作");
        loaddenyuser(board);
        printf("<center>\n");
        printf("%s -- 被封用户名单 [讨论区: %s]<hr color=green><br>\n", BBSNAME, board);
        printf("本板共有 %d 人被封<br>", denynum);
        printf("<table border=0><tr class=title><td>序号<td>用户帐号<td>被封原因<td>原定解封日期<td>管理\n");
        for(i=0; i<denynum; i++) {
                printf("<tr><td>%d", i+1);
                printf("<td><a href=bbsqry?userid=%s>%s</a>", denyuser[i].id, denyuser[i].id);
                printf("<td>%s\n", nohtml(denyuser[i].exp));
                printf("<td>%s\n", denyuser[i].free_time);
                printf("<td>[<a onclick='return confirm(\"确实解封吗?\")' href=bbsdenydel?board=%s&userid=%s>解封</a>]",
                       board, denyuser[i].id);
        }
        printf("</table><hr color=green>\n");
        printf("[<a href=bbsdenyadd?board=%s>设定新的不可POST用户</a>]</center>\n", board);
        http_quit();
}
예제 #5
0
int total_post_top10(unsigned int gid,char *board,char *title)
{
    struct userec deliveruser;
    unsigned int start,noref,noattach,ret;
    char ut_file[STRLEN];
    char post_title[ARTICLE_TITLE_LEN];
    unsigned char accessed[2] = "\0\0";

    if (init_all()) {
        printf("init data fail\n");
        return -1;
    }

    bzero(&deliveruser, sizeof(struct userec));
    strcpy(deliveruser.userid, "deliver");
    deliveruser.userlevel = -1;
    strcpy(deliveruser.username, "自动发信系统");
    setCurrentUser(&deliveruser);
    strcpy(getSession()->fromhost, "天堂");

    start = gid;
    noref = 0;
    noattach = 0; 
    //accessed[0] |= 0x08;  // m 
    
    ret=get_thread_forward_mail(board, gid, start, noref, noattach, title);
    if (ret > 0) {
        gettmpfilename(ut_file, "ut");
        snprintf(post_title, ARTICLE_TITLE_LEN, "[合集] [%s] %s", board,title);
        post_file_alt(ut_file, NULL, post_title, "ShiDa", NULL, 0x01|0x04, accessed);
        unlink(ut_file);
    }

    return 0;
}
예제 #6
0
int main()
{
        FILE *fp;
        struct fileheader f;
        char rpath[80],*id,path[80];
        init_all();
        if(loginok == 0)
                http_fatal("ÄúÉÐδµÇ¼");
        id=currentuser.userid;
        sprintf(rpath, "mail/%c/%s/.recycle", toupper(id[0]), id);
        fp=fopen(rpath, "r");
        if(fp==0)
                http_fatal("´íÎóµÄ²ÎÊý2");
        while(1) {
                if(fread(&f, sizeof(struct fileheader ), 1, fp)<=0)
                        break;
                sprintf(path, "mail/%c/%s/%s", toupper(id[0]), id, f.filename);
                unlink(path);
        }

        unlink(rpath);
        fp=fopen(rpath,"a+");
        if(fp!=0) {
                fclose(fp);
                redirect("bbsmailrecycle");
                //   printf("Çå¿Õ³É¹¦£¬<a href=bbsmailrecycle> ·µ»Ø</a>");
                http_quit();
        }
        fclose(fp);
        http_fatal("Çå¿Õ³ö´í");
}
예제 #7
0
int main()
{
        struct fileheader *x;
        char board[80], file[80], target[80];
        init_all();
        strsncpy(board, getparm("board"), 30);
        strsncpy(file, getparm("file"), 30);
        strsncpy(target, getparm("target"), 30);
        if(!loginok)
                http_fatal("匆匆过客不能进行本项操作");
        if(!has_read_perm(&currentuser, board))
                http_fatal("错误的讨论区");
        x=get_file_ent(board, file);
        if(x==0)
                http_fatal("错误的文件名");
        printf("<center>%s -- 转寄/推荐给好友 [使用者: %s]<hr color=green>\n", BBSNAME, currentuser.userid);
        if(target[0]) {
                if(!strstr(target, "@")) {
                        if(!getuser(target))
                                http_fatal("错误的使用者帐号");
                        strcpy(target, getuser(target)->userid);
                }
                return do_fwd(x, board, target);
        }
        printf("<table><tr><td>\n");
        printf("文章标题: %s<br>\n", nohtml(x->title));
        printf("文章作者: %s<br>\n", x->owner);
        printf("原讨论区: %s<br>\n", board);
        printf("<form action=bbsfwd method=post>\n");
        printf("<input type=hidden name=board value=%s>", board);
        printf("<input type=hidden name=file value=%s>", file);
        printf("把文章转寄给 <input name=target size=30 maxlength=30 value=%s> (请输入对方的id或email地址). <br>\n",
               currentuser.email);
        printf("<input type=submit value=确定转寄></form>");
}
예제 #8
0
void goalie(){
  init_all();//initializing all the rest

  //displaying two flashes to know robot is ready and waiting for start
  m_red(ON);
  m_green(ON);
  m_wait(750);
  m_green(OFF);
  m_red(OFF);
	m_wait(750);
  m_red(ON);
  m_green(ON);
  m_wait(750);
  m_red(OFF);
  m_green(OFF);
	wait(1);

  //initializing center ice
  set_position(1024/2,768/2);
  get_position(blobs, &x_center, &y_center, &theta_zero);

  // set voltage reference to 5V
  clear(ADMUX, REFS1);
  set(ADMUX, REFS0);

  m_disableJTAG();//allowing gpio of F pins

  //setting ADC prescaler
  set(ADCSRA,ADPS2);
  set(ADCSRA,ADPS1);
  set(ADCSRA,ADPS0);

  //setting pins to turn off digital circuitry
  set(DIDR0,ADC4D);//setting F4
  set(DIDR0,ADC6D);//setting F6
  set(DIDR2,ADC8D);//setting D4
  set(DIDR2,ADC9D);//setting D6

  set(ADCSRA,ADATE);//setting triggering to free running
  
  //setting pins for output & setting pins high to supply power to phototransistors
  set(DDRF,5);//F5
  set(PORTF,5);
  set(DDRF,7);//F7
  set(PORTF,7);
  set(DDRB,3);//B3
  set(PORTB,3);
  set(DDRD,3);//D3
  set(PORTD,3);

  set(DDRF,0);//setting  pins to turn the sprinner motors
  set(PORTF,0);
  set(DDRF,1);
  set(PORTF,1);

  int adc = 0;//declaring integer for adc status;
  int adc_values[4];//declaring adc array
    
	state_before_game();
}
예제 #9
0
파일: serveur.c 프로젝트: y0ja/ft_p
int		main(int ac, char **av, char **env)
{
	t_sess	server;
	pid_t	child;

	if (ac != 2)
		usage(av[0]);
	init_all(&server, atoi(av[1]));
	while (77)
	{
		server.client.sock = accept(server.sock, \
			(struct sockaddr*)&server.client.csin, &server.client.cslen);
		child = secure_fork();
		if (child == 0)
		{
			server.client.ip = inet_ntoa(server.client.csin.sin_addr);
			display_hour();
			printf("\nConnection from : %s\n", server.client.ip);
			session_start(server.dir_root, &server);
		}
	}
	close(server.client.sock);
	close(server.sock);
	return (0);
}
예제 #10
0
int main()
{
        FILE *fp;
        char *ptr, plan[256], buf[10000];
        init_all();
        printf("<center>\n");
        if(!loginok)
                http_fatal("匆匆过客不能设置说明档,请先登录");
        modify_mode(u_info,USERDEF+20000);	//bluetent
        sprintf(plan, "home/%c/%s/plans", toupper(currentuser.userid[0]), currentuser.userid);
        if(!strcasecmp(getparm("type"), "update"))
                save_plan(plan);
        printf("%s -- 设置个人说明档 [%s]<hr>\n", BBSNAME, currentuser.userid);
        printf("<form method=post action=bbsplan?type=update>\n");
        fp=fopen(plan, "r");
        if(fp) {
                fread(buf, 9999, 1, fp);
                ptr=strcasestr(buf, "<textarea>");
                if(ptr)
                        ptr[0]=0;
                fclose(fp);
        }
        printf("<table width=610 border=1><tr><td>");
        printf("<textarea name=text rows=20 cols=80 wrap=physicle>\n");
        printf(void1(buf));
        printf("</textarea></table>\n");
        printf("<input type=submit value=存盘> ");
        printf("<input type=reset value=复原>\n");
        printf("<hr>\n");
        http_quit();
}
예제 #11
0
int		exec_fct(SDL_Surface *screen, t_map *map)
{
  t_player	player;
  int		continuer;
  t_image	img;
  int		jump;
  t_npc		*monsters;

  SDL_EnableKeyRepeat(10, 10);
  continuer = 1;
  monsters = init_all(&img, &player, map);
  jump = 0;
  while (continuer > 0)
    {
      display_map(screen, map, &img);
      display_npcs(screen, monsters);
      display_player(screen, &player);
      display_life(screen, &player);
      SDL_Flip(screen);
      continuer = gravite(&player, map);
      if (continuer >= 0)
	player_act(&continuer, map, &player);
      if (continuer > 0)
	continuer = env_act(map, &player, monsters);
    }
  img_delete(&img);
  return (continuer);
}
예제 #12
0
void		window(char *file)
{
	int	loop;
	unsigned int	framelimit;

	framelimit = 0;
	loop = 0;
	game.file = file;
	if (init_all() == 0 && game.map != NULL)
	{
		load_audio();
		//load_intro();
		while (loop == 0)
		{
			loop = get_input_menu();
			load_menu();
			while (loop == 1)
			{
				loop = get_input_game();
				load_game();
				framelimit = delay(framelimit);
			}
			framelimit = delay(framelimit);
		}
	}
	exit_game();
}
예제 #13
0
파일: main.c 프로젝트: Mindc0re/FdF
int		main(int ac, char **av)
{
	t_all	all;

	if (ac >= 2)
	{
		all.mlx = mlx_init();
		all.win_x = (ac >= 4 && check_arg(av[2])) ? ft_atoi(av[2]) : 500;
		all.win_y = (ac >= 4 && check_arg(av[3])) ? ft_atoi(av[3]) : 500;
		all.win = mlx_new_window(all.mlx, all.win_x, all.win_y, "FdF");
		init_all(&all);
		if (ac == 5)
			check_color(av[4], &all);
		all.fd = open(av[1], O_RDONLY);
		if (all.fd == -1)
			exit(EXIT_FAILURE);
		parser(all.fd, &all);
		mlx_hook(all.win, 2, (1L << 0), key_hook_first, &all);
		draw_map_x(&all);
		mlx_loop(all.mlx);
	}
	else
		help_main();
	return (0);
}
예제 #14
0
파일: addr_compl.c 프로젝트: twolife/claws
/**
 * Prepare completion index. This function should be called prior to attempting
 * address completion.
 * \return The number of addresses in the completion list.
 */
gint start_address_completion(gchar *folderpath)
{
	gboolean different_book = FALSE;
	clear_completion_cache();

	if (strcmp2(completion_folder_path,folderpath))
		different_book = TRUE;

	g_free(completion_folder_path);
	if (folderpath != NULL)
		completion_folder_path = g_strdup(folderpath);
	else
		completion_folder_path = NULL;

	if (!g_ref_count) {
		init_all();
		/* open the address book */
		read_address_book(folderpath);
	} else if (different_book)
		read_address_book(folderpath);

	g_ref_count++;
	debug_print("start_address_completion(%s) ref count %d\n",
				folderpath?folderpath:"(null)", g_ref_count);

	return g_list_length(g_completion_list);
}
예제 #15
0
int main(int argc, char ** argv)
{
	int all = 0;
	struct boardheader *bp;
	struct userec* sysopuser;

    if (init_all()) {
        printf("init data fail\n");
        return -1;
    }

	getuser("SYSOP", &sysopuser);
	setCurrentUser(sysopuser);
	if (argc == 1)
		all = 1;
	else if (argc > 2)
	{
		printf("Usage: %s [boardid]\n", argv[0]);
		return -1;
	}
	if (all == 1)
	{
		apply_boards(cnv_board_dir,NULL);
	}
	else
	{
		if ((bp = getbcache(argv[1])) != NULL)
			cnv_board_dir(bp,NULL);
	}

	return 0;
}
예제 #16
0
int main()
{
        FILE *fp;
        int type;
        init_all();
        type=atoi(getparm("type"));
        if(!loginok)
                http_fatal("您尚未登录, 请重新登录。");
        printf("%s -- 填写注册单<hr color=green>\n", BBSNAME);
        check_if_ok();
        if(type==1) {
                check_submit_form();
                http_quit();
        }
        printf("您好, %s, 注册单通过确认后才可获得发表文章,发送信件和讯息的权利, 下面各项务必请认真真实填写<br><hr>\n", currentuser.userid);
        printf("<form method=post action=bbsform?type=1>\n");
        printf("真实姓名: <input name=realname type=text maxlength=80 size=8 value='%s'><br>\n",
               nohtml(currentuser.realname));
        printf("学校系级: <input name=dept type=text maxlength=320 size=32 value='%s'>(或工作单位)<br>\n",
               nohtml(currentuser.reginfo));
        printf("居住地址: <input name=address type=text maxlength=320 size=32 value='%s'><br>\n",
               nohtml(currentuser.address));
        printf("联络电话: <input name=phone type=text maxlength=320 size=32><br><hr><br>\n");
        printf("<input type=submit value=填好了> <input type=reset>");
        http_quit();
}
예제 #17
0
int main()
{
        char buf[512];
        char file[80];
        char keystr[80]; //关键字
        int has=1;
        init_all();
        if(!loginok)
                http_fatal("您尚未登录");
        modify_mode(u_info,FTPSEARCH);
        strsncpy(keystr, getparm("keystr"), 80);
        printf("<body background=/bg_1.gif bgproperties=fixed>");
        if(!strlen(keystr)) {
                printf("<table width=600 align=center><tr height=150><td align=center valign=bottom style='font-size:14px'><font color=blue>局域网FTP搜索引擎<p><p></font></td></tr>");
                printf("<tr><td align=center style='font-size:14px'><form name=ftpsearch>请输入关键字:<input name=keystr type=text size=50 maxlength=80><input type=submit value=搜索> (<font color=red>%d</font>人在线)</form><script language=javascript>document.ftpsearch.keystr.focus();</script></td></tr>", countuser());
                printf("<tr><td><table><tr>");
                printf("<td><a href=bbsmyftp?type=4>我要加盟</a></td>");
                if(SiteInList(fromhost))
                        printf("<td> | <a href=bbsmyftp>管理站点数据</a> | <a href=bbsmyftp?type=3>已上传数据的站点列表</a></td>");
                printf("</tr></table></td></tr>");
                printf("</tr><tr><td width=80%%>【说明】 本搜索引擎用来查找南开大学校内教育网和宿舍网FTP站点的数据。<br>各位站长可以自行上传自己的站点数据,服务器端对原始数据进行重新编码以供搜索。<br>因该引擎仅依照编码后的数据进行搜索,故不会对网络负载产生影响。</td></tr>");
                printf("</table>");
        } else {
                sprintf(file, "tmp/%d.tmp", getpid());
                search(keystr, file);
                printf("</pre>");
                unlink(file);
        }
        http_quit();
}
예제 #18
0
int main()
{
        struct shortfile data[MAXBOARD], *x;
        int i, total=0;
        int all=0;//所有品味文章的用户数
        init_all();
        getdatestring(time(0), NA);
        printf("<body background=/bg_1.gif bgproperties=fixed>");
        printf("<center>%s -- 当前板面在线人数排行 (%s)\n<hr>\n", BBSNAME, datestring);
        for(i=0; i<MAXBOARD; i++) {
                x=&(shm_bcache->bcache[i]);
                if(x->filename[0]<=32 || x->filename[0]>'z')
                        continue;
                if(!has_read_perm(&currentuser, x->filename))
                        continue;
                memcpy(&data[total], x, sizeof(struct shortfile));
                total++;
                all+=*((int*)(x->filename+72));
        }
        qsort(data, total, sizeof(struct shortfile), cmpboard);
        printf("<table><tr><td>排名<td>板面名称<td>中文名称<td>在线人数<td>百分比");
        for(i=0; i<total; i++) {
                printf("<tr><td>%3d", i+1);
                printf("<td>%s", data[i].filename);
                printf("<td>%s", data[i].title+8);
                printf("<td align=right>%d", *((int*)(data[i].filename+72)));
                printf("<td align=right>%5.2f%%", (*((int*)(data[i].filename+72)))*100.0/all);
        }

        return 1;
}
예제 #19
0
int main()
{
        int type;
        char pw1[20], pw2[20], pw3[20];
        init_all();
        if(!loginok)
                http_fatal("����δ��¼, ���ȵ�¼");
        modify_mode(u_info,USERDEF+20000);	//bluetent
        type=atoi(getparm("type"));
        if(type==0) {
                printf("%s -- �޸����� [�û�: %s]<hr color=green>\n",
                       BBSNAME, currentuser.userid);
                printf("<form action=bbspwd?type=1 method=post>\n");
                printf("��ľ�����: <input maxlength=12 size=12 type=password name=pw1><br>\n");
                printf("���������: <input maxlength=12 size=12 type=password name=pw2><br>\n");
                printf("������һ��: <input maxlength=12 size=12 type=password name=pw3><br><br>\n");
                printf("<input type=submit value=ȷ���޸�>\n");
                http_quit();
        }
        strsncpy(pw1, getparm("pw1"), 13);
        strsncpy(pw2, getparm("pw2"), 13);
        strsncpy(pw3, getparm("pw3"), 13);
        if(strcmp(pw2, pw3))
                http_fatal("�������벻��ͬ");
        if(strlen(pw2)<2)
                http_fatal("������̫��");
        if(!checkpasswd(currentuser.passwd, pw1))
                http_fatal("���벻��ȷ");
        strcpy(currentuser.passwd, crypt1(pw2, pw2));
        save_user_data(&currentuser);
        printf("[%s] �����޸ijɹ�.", currentuser.userid);
}
예제 #20
0
void main(void)
{
	//All Var declarations
	unsigned char cmd = 0;
	unsigned char instrument = 1;
	unsigned char note = 0x40;
	int i = 0;
	unsigned char buf[] = {0xB0, 0x07, 0x79, 0xB0, 0x00, 0x78, 0xD0, 0x00, 0x00, 0x90, 0x40, 0x3C};

    init_all();

    EA=TRUE;

	midiReset();
	midiVolSet(120); //set channel volume to near max (127)
	midiBankSet(MELODY); //0x79 = melodious instruments
	//talkMIDI(0xD0, instrument, 0); //Set instrument number. 0xC0 is a 1 data byte command
	midiPatchSet(PIANO_AC);
	noteOn(0, note, 0x3D);

    while(1)
    {
    	cmd = getchar();
    	if (cmd == '`') {
    		putchar('1');
    		instrument = getchar();
    		midiPatchSet(instrument-0x30);
    	}
    	else {
    		noteOn(0, cmd, 0x3D);
    	}
    }
}
예제 #21
0
파일: iprinit.c 프로젝트: leitao/iprutils
int main(int argc, char *argv[])
{
	int i;

	ipr_sg_required = 1;

	openlog("iprinit", LOG_PERROR | LOG_PID | LOG_CONS, LOG_USER);

	for (i = 1; i < argc; i++) {
		if (parse_option(argv[i]))
			continue;
		else {
			printf("Usage: iprinit [options]\n");
			printf("  Options: --version [--daemon]   Print iprinit version\n");
			return -EINVAL;
		}
	}

	init_all();

	if (daemonize) {
		ipr_daemonize();
		return handle_events(poll_ioas, 60, kevent_handler);
	}

	return 0;
}
예제 #22
0
int main() {
	init_all();
	//eye_exam();
	while (1) {
		state();
		_delay_ms(300);
	}
}
예제 #23
0
파일: app.c 프로젝트: odrevet/gmtograph
void
app_init (App * app)
{
  GError *err = NULL;
    
  app->definitions = gtk_builder_new ();
    
  gtk_builder_add_from_file (app->definitions,
			     UI_DEFINITIONS_FILE, &err);
    
  if (err != NULL) {
    g_printerr
      ("Error while loading app definitions file: %s\n",
       err->message);
    g_error_free (err);
    gtk_main_quit ();
  }
    
  gtk_builder_connect_signals (app->definitions, app);
  
  app_init_colors (app);

  app->filename = NULL;
  
  app->display_level = FALSE;
  app->display_weight = FALSE;




   GtkCellRenderer *renderer=gtk_cell_renderer_text_new();
  GET_UI_ELEMENT(GtkComboBox, combobox_from);  
        gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combobox_from),renderer,FALSE);
        gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combobox_from),renderer,
				       "text",0,
				       NULL);
        gtk_combo_box_set_active(GTK_COMBO_BOX(combobox_from),0);

  GET_UI_ELEMENT(GtkComboBox, combobox_to);  
        gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combobox_to),renderer,FALSE);
        gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combobox_to),renderer,
				       "text",0,
				       NULL);
        gtk_combo_box_set_active(GTK_COMBO_BOX(combobox_to),0);

	
  //init non graphical units
  app->p_graph = malloc(sizeof(graph));

  app->p_matrix = malloc(sizeof(matrix));
  app->p_matrix->i_size = 3;
  matrix_malloc(app->p_matrix);
  matrix_zero(app->p_matrix);
  
  //construct the graph from the matrix
  init_all(app->p_graph, app->p_matrix);
  
}
예제 #24
0
파일: List_old.c 프로젝트: seyko2/cfront-3
Lizt_old_ATTLC&
Lizt_old_ATTLC::operator=(const Lizt_old_ATTLC& a)
{
	if (this == &a) return *this;
	delete_all();
	init_all(a);
	reset_all_iters();
	return *this;
}
예제 #25
0
int
v4l_capture::init(size_t _width, size_t _height, unsigned int devId)
{
  width = _width;
  height = _height;
  if (!init_all(width, height, devId)) return -1;
  frame = cv::Mat(height, width, CV_8UC3);
  return 0;
}
예제 #26
0
파일: post_brdlog.c 프로젝트: wyat/kbs
int main(int argc,char **argv)
{
    char path[256];
    char title[256];
    time_t now;
    int before;

    if (argc > 1)
        before = atoi(argv[1]);
    else
        before = 0;

    chdir(BBSHOME);
    bzero(&x[0], sizeof(x));

    if (init_all()) {
        printf("init data fail\n");
        return -1;
    }

    mysql_init(&s);

    if (! my_connect_mysql(&s)) {
        printf("Mysql connect error: %s\n",mysql_error(&s));
        return 0;
    }

    now=time(0) - 86400 - 86400*before;
    localtime_r(&now, &t);

    fillboard();

    mysql_close(&s);

    qsort(x, n, sizeof(x[0]), online_cmp);
    /* generate boards usage result in xml format */
    gen_board_rank_xml();

    sprintf(path,"tmp/brdlog.%d.out",getpid());
    putout(path);

    sprintf(title, "%d年%2d月%2d日版面统计数据(在线排序)", t.tm_year + 1900, t.tm_mon + 1, t.tm_mday);
    post_file(NULL, "", path, "SysTrace", title, 0, 1, getSession());
    unlink(path);

    qsort(x, n, sizeof(x[0]), id_cmp);

    sprintf(path,"tmp/brdlog.%d.out",getpid());
    putout(path);

    sprintf(title, "%d年%2d月%2d日版面统计数据(文章数排序)", t.tm_year + 1900, t.tm_mon + 1, t.tm_mday);
    post_file(NULL, "", path, "SysTrace", title, 0, 1, getSession());
    unlink(path);

    return 0;
}
예제 #27
0
파일: rarpd.c 프로젝트: mosconi/openbsd
int
main(int argc, char *argv[])
{
	extern char *__progname;
	extern int optind, opterr;
	int op, devnull, f;
	pid_t pid;

	/* All error reporting is done through syslogs. */
	openlog(__progname, LOG_PID | LOG_CONS, LOG_DAEMON);

	opterr = 0;
	while ((op = getopt(argc, argv, "adflt")) != -1) {
		switch (op) {
		case 'a':
			++aflag;
			break;
		case 'd':
			++dflag;
			break;
		case 'f':
			++fflag;
			break;
		case 'l':
			++lflag;
			break;
		case 't':
			++tflag;
			break;
		default:
			usage();
			/* NOTREACHED */
		}
	}
	argc -= optind;
	argv += optind;

	if ((aflag && argc > 0) || (!aflag && argc == 0))
		usage();

	if (aflag)
		init_all();
	else
		while (argc > 0) {
			init_one(argv[0]);
			argc--;
			argv++;
		}

	if ((!fflag) && (!dflag)) {
		if (daemon(0, 0) == -1)
			error(FATAL, "failed to daemonize: %s", strerror(errno));
	}
	rarp_loop();
	exit(0);
}
예제 #28
0
int main()
{
        FILE *fp;
        char board[80], dir[80], *ptr, flag[80];
        struct shortfile *x1;
        struct fileheader x;
        int i, start, total, my_t_lines=0, chart=0, showhead=0;
        init_all();
        strsncpy(board, getparm("board"), 32);
        my_t_lines=atoi(getparm("my_t_lines"));
        if(my_t_lines<10 || my_t_lines>40)
                my_t_lines=20;
        x1=getbcache(board);
        if(x1==0)
                http_fatal("错误的讨论区");
        strcpy(board, x1->filename);
        board_ban_ip(board);
        if (!canenterboard (currentuser.userid, board) && !HAS_PERM(PERM_SYSOP))
                http_fatal ("您已经被取消进入本板的权限");
        if(!has_read_perm(&currentuser, board) && !HAS_PERM(PERM_SYSOP))
                http_fatal("错误的讨论区");
        if(!has_BM_perm(&currentuser, board))
                http_fatal("您没有权限访问本页");

        modify_mode(u_info,READING);	//bluetent
        sprintf(dir, "boards/%s/.DIR", board);
        fp=fopen(dir, "r");
        if(fp==0)
                http_fatal("错误的讨论区目录");
        total=file_size(dir)/sizeof(struct fileheader);
        start=atoi(getparm("start"));
        if(strlen(getparm("start"))==0 || start>total-my_t_lines)
                start=total-my_t_lines;
        if(start<0)
                start=0;
        printf("<nobr><center>\n");
        strcpy(u_info->board, board);
        /*	printf("%s -- [讨论区: %s] 板主[%s] 文章数[%d]<hr color=green>\n",
        		BBSNAME, board, userid_str(x1->BM), total);
        	if(total<=0) http_fatal("本讨论区目前没有文章");
        	printf("<form name=form1 method=post action=bbsman>\n");
              	printf("<table width=613>\n");
              	printf("<tr><td>序号<td>管理<td>状态<td>作者<td>日期<td>标题\n");
        	fseek(fp, start*sizeof(struct fileheader), SEEK_SET);*/
        printf("<script language=JavaScript>\
               \
               function MM_jumpMenu(selObj){\
               eval(\"window.location='\"+selObj.options[selObj.selectedIndex].value+\"'\");\
       }\
               function SubmitFlag(flagmode){\
               document.form1.mode.value=flagmode;\
               document.form1.submit();\
       }\
       function selrange(x)\
       {if(event.shiftKey){var min=x;var max=document.getElementById('lastsel').value;if(min>max){var tmp=min;min=max;max=tmp;}var stt=document.getElementById('chk'+x).checked;for(var i=min;i<=max;i++)document.getElementById('chk'+i).checked=stt;}document.getElementById('lastsel').value=x;}\
               </script>\
예제 #29
0
파일: ops5.c 프로젝트: mpw/p2
void main(void)
{
   /* Step 1: initialize all containers and cursors */

   init_all();

   /* Step 2: initialize data and start up production system */

   init_data() ; 
   execute_production_system();
}
예제 #30
0
파일: main.c 프로젝트: Sleli42/minishell_2
int		main(int ac, char **av, char **env)
{
	t_all	*all;

	(void)ac;
	(void)av;
	all = init_all(env);
	//ft_catch_sig();
	loop(all);
	return (0);
}