示例#1
0
int main ()
{
	 pthread_t tid1,tid2,tid3;
	
	 struct my_thread t1,t2,t3;
	 sigemptyset(&set);
	 my_init(&t1,1,"First Thread");
	 my_init(&t2,2,"Second Thread");
	 my_init(&t3,3,"Third Thread");
	 	
	 printf("\n In Default Thread "); 
	 
	
	 sigemptyset(&set);
	
	 // Register handler1 as signal handler for signal 1
	 if(signal(1,handler1)==SIG_ERR)
	 	perror("sig1");
	 // Add signal 1 to sigset object
	 if(sigaddset(&set,1)==-1)
		perror("add1");

	 // Register handler2 as signal handler for signal 2
	 if(signal(2,handler2)==SIG_ERR)
	 	perror("sig2");
	 // Add signal 2 to sigset object
	 if(sigaddset(&set,2)==-1)
	 	perror("add2");

	 // Block signal 1 & 2 in default thread
	 pthread_sigmask(SIG_BLOCK|SIG_SETMASK,&set,NULL);

	 // Create threads
	 printf("\n First thread created \n");	
	 pthread_create(&tid1, NULL, PrintHello,(void *)&t1);
	 pthread_join(tid1,NULL);
	 
	 printf("\n Second thread created\n");	
	 pthread_create(&tid2, NULL, PrintHello,(void *)&t2);
	 pthread_join(tid2,NULL);
	
	 getchar();
	 // Unblock signals before thread 3 is created 
	 pthread_sigmask(SIG_UNBLOCK,&set,NULL);

	 printf("\n Third thread created\n");	
	 pthread_create(&tid3, NULL, PrintHello,(void *)&t3);
	 
	 // send signal 2 to thread 3
	 pthread_kill(tid3,2);
	 pthread_join(tid3,NULL);

	 printf("\n Exit From main Thread\n");
	 pthread_exit(NULL);
}
示例#2
0
int		main(int ac, char **av)
{
  t_ptr		*ptr;
  t_col		*color;
  t_sc		*scene;

  if (ac > 1)
    my_parse(av[1]);
  (void)av;
  if (ac != 1)
    my_putstr_error(ARG_ERROR);
  if ((ptr = my_init()) == NULL)
    {
      my_putstr_error(INIT_ERROR);
      return (EXIT_ERROR);
    }
  if ((color = my_init_color(0, 0, 0)) == NULL)
    {
      my_putstr_error(INIT_ERROR);
      return (EXIT_ERROR);
    }
  if ((scene = my_init_scene()) == NULL)
    return (EXIT_ERROR);
  my_fill_image(ptr->pic, color, scene);
  mlx_expose_hook(ptr->win->ptr, &my_expose, ptr);
  mlx_key_hook(ptr->win->ptr, &my_key, ptr);
  mlx_loop(ptr->mlx);
  return (SUCCESS);
}
示例#3
0
int main(int argc, char **argv) {
  const char *the_set = NULL;
  int argcnt = 1;
  CHARSET_INFO *cs;

  if (getenv("SCRIPT_NAME"))
  {
    printf("Content-Type: text/html\r\n\r\n");
  }
  my_init();

  if (argc > argcnt && argv[argcnt][0] == '-' && argv[argcnt][1] == '#')
    DBUG_PUSH(argv[argcnt++]+2);

  if (argc > argcnt)
    the_set = argv[argcnt++];

  if (argc > argcnt)
    charsets_dir = argv[argcnt++];

  if (!the_set)
  {
    print_index();
    return 0;
  }
  
  if (!(cs= get_charset_by_name(the_set, MYF(MY_WME))))
    return 1;

  print_cs(cs);

  return 0;
}
示例#4
0
static void dbd_mysql_init(apr_pool_t *pool)
{
    my_init();
    /* FIXME: this is a guess; find out what it really does */ 
    apr_pool_cleanup_register(pool, NULL, apr_pool_cleanup_null,
                              (void*)mysql_thread_end);
}
示例#5
0
main()
{
  int i, j;

  my_init(MEMORY_SIZE, PHYSICAL_MEM_LIMIT);
	/* The MEMORY SIZE is in megabytes */
	/* PHYSICAL MEMORY SIZE is in number of system pages */
	/* The page size on Sparc 4 and Sparc 5 is 4Kb */

  dump_out();
  for (i = 0; i < NUM_BUFS; i++)
    {
      sbuf[i] = (char *)my_malloc(SMALL_BUF_SIZE);
      lbuf[i] = (char *)my_malloc(LARGE_BUF_SIZE);
      printf("The buffer small pointers is %x and large pointer is %x.\n",(unsigned)sbuf[i],(unsigned)lbuf[i] );
      dump_out();
    }
 
  for (i = 0; i < NUM_BUFS; i++)
    {
      memset(temp_buffer, 'A'+i, LARGE_BUF_SIZE);
      my_write(sbuf[i], SMALL_BUF_SIZE, temp_buffer);
      my_write(lbuf[i], LARGE_BUF_SIZE, temp_buffer);
      my_read(lbuf[i], LARGE_BUF_SIZE, temp_buffer);
    }

  read_start();

  my_read(lbuf[NUM_BUFS-1], LARGE_BUF_SIZE, temp_buffer);
  my_write(lbuf[0], LARGE_BUF_SIZE, temp_buffer);

  my_read(lbuf[NUM_BUFS - 1], LARGE_BUF_SIZE, temp_buffer);
  my_write(lbuf[1]+5, 3, temp_buffer);

  my_read(sbuf[NUM_BUFS-1], SMALL_BUF_SIZE, temp_buffer);
  my_write(sbuf[0], SMALL_BUF_SIZE, temp_buffer);

  my_read(sbuf[NUM_BUFS - 1], SMALL_BUF_SIZE, temp_buffer);
  my_write(sbuf[1]+5, 3, temp_buffer);

  read_start();

  for (i = 0; i < NUM_BUFS; i++)
    {
      memset(temp_buffer, 'Z'-i, LARGE_BUF_SIZE);
      my_write(sbuf[i] + 5, SMALL_BUF_SIZE - 5, temp_buffer);
      my_read(sbuf[i], SMALL_BUF_SIZE, temp_buffer);
      my_write(lbuf[i] + 5, LARGE_BUF_SIZE - 5, temp_buffer);
    }

  read_start();

  for (i = 0; i < NUM_BUFS; i++) {
    my_free((void *) sbuf[i]);
    my_free((void *) lbuf[i]);
  }
  dump_out();

  my_terminate();
}
示例#6
0
bool DBI_MySQL::SDK_OnLoad(char *error, size_t maxlength, bool late)
{
	dbi->AddDriver(&g_MyDriver);

	my_init();

	return true;
}
示例#7
0
文件: ndb_init.c 项目: isleon/Jaxer
int
ndb_init()
{
  if (my_init()) {
    const char* err = "my_init() failed - exit\n";
    write(2, err, strlen(err));
    exit(1);
  }
  return 0;
}
示例#8
0
int main(int argc,char *argv[])
{
  MY_INIT(argv[0]);
  my_init();
  if (key_cacheing)
    init_key_cache(dflt_key_cache,KEY_CACHE_BLOCK_SIZE,IO_SIZE*16,0,0);
  get_options(argc,argv);

  exit(run_test("test1"));
}
示例#9
0
int		main()
{
  t_wolf	*wolf;

  if ((wolf = malloc(sizeof(t_wolf))) == NULL)
    my_error("Error with a memory allocation");
  my_init(wolf);
  my_parsing(wolf->ptr);
  my_hook(wolf);
  return (0);
}
示例#10
0
int main()
{
    freopen("out.txt","w",stdout);
    my_init();
    while(scanf("%s",op), strcmp(op,".EOP")){
        solve();
    }
    my_print();
    //system("pause");
    return 0;
}
示例#11
0
int 
main(int argc, char *argv[])
{
	MY_INIT(argv[0]);
	my_init();
	if (key_cacheing)
		init_key_cache(IO_SIZE * 16, (uint) IO_SIZE * 4 * 10);
	get_options(argc, argv);

	exit(run_test("test1"));
}
示例#12
0
文件: main.cpp 项目: s-alexander/UPGM
void PayguideInit()
{
	/* Init variables from payguide namespace */
	payguide::namespace_init();

	ReloadConfigIfImportant();
	
	if (curl_global_init(CURL_GLOBAL_ALL)!=0)
	{
		printf("CURL init failed! Payguide shutdown.\n");
		exit(1);
	}
	
	/* Deatch from console */
	if (payguide::daemonize==1)
	{
		if (Daemonize()!=0) 
		{
			LogWrite(LOGMSG_ERROR, "Daemonize failed!");
		}
	}


	
	my_init();
	DBVeryFirstInit();
	
	OperatorsInit();
	OpenSSLInit();

	StatisticInit();
	
	/* Catching TERM signal - shut down server */
	struct sigaction sterm;
	memset (&sterm, 0, sizeof(sterm));
	sterm.sa_handler=&SigHandler;
	sigaction(SIGTERM, &sterm, NULL);
	
	/* Catching INT signal - shut down server */
	struct sigaction sint;
	memset (&sint, 0, sizeof(sint));
	sint.sa_handler=&SigHandler;
	sigaction(SIGINT, &sint, NULL);
	
	atexit (CleanUp);

	/* Init backtrace */
	#ifdef ENABLE_BACKTRACE
		open_backtrace_fd(payguide::backtrace_file.c_str());
		install_handlers() ;
	#endif
	
}
示例#13
0
int
main(int argc, char **argv)
{
    char * fontFilePath;

    glutInitWindowSize(600, 600);
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_RGB|GLUT_DOUBLE);

    glutCreateWindow("FTGL demo");

    if (argc >= 2)
    {
        if (!file_exists(argv[ 1 ]))
        {
            usage(argv[ 0 ]);
            std::cerr << "Couldn't open file '" << argv[ 1 ] << "'" << std::endl;
            exit(-1);
        }
        fontFilePath = argv[ 1 ];
    }
    else
    {
        // try a default font
        fontFilePath = DEFAULT_FONT;

        if (!file_exists(fontFilePath))
        {
            usage(argv[ 0 ]);
            std::cerr << "Couldn't open default file '" << fontFilePath << "'" << std::endl;
            exit(-1);
        }
    }

    my_init(fontFilePath);

    glutDisplayFunc(my_display);
    glutReshapeFunc(my_reshape);
    glutIdleFunc(my_idle);
    glutKeyboardFunc(my_handle_key);

    glutMainLoop();

    for(int x = 0; x < 5; ++x)
    {
        delete fonts[x];
    }

    return 0;
}
示例#14
0
文件: my.c 项目: macroxue/const-pi
unsigned long my_div_estimate_threshold()
{
    const double log10 = 3.321928;
    clock_t begin, end, diff1, diff2;
    mpz_t y, x;
    unsigned long digits = 100, min_digits, max_digits, prec, stage = 1;
    div_threshold = 0;
    for (;;) {
        if (stage == 1)
            digits *= 2;
        else
            digits = (min_digits + max_digits)/2;
        prec = (unsigned long) (digits * log10) + 32;
        my_init(prec);
        mpz_init(y);
        mpz_init(x);
        mpz_ui_pow_ui(y, 10, digits);
        mpz_ui_pow_ui(x, 10, digits/10);
        begin = clock();
        my_divexact(y, y, x);
        end = clock();
        diff1 = end - begin;

        mpz_ui_pow_ui(y, 10, digits);
        begin = clock();
        mpz_divexact(y, y, x);
        end = clock();
        diff2 = end - begin;
        my_clear();
        mpz_clear(y);
        mpz_clear(x);

        printf("digits %ld, my %ld, mpz %ld\n", digits, diff1, diff2);
        if (stage == 1) {
            if (diff1 >= 10 && diff1 < diff2) {
                stage = 2;
                min_digits = digits/2;
                max_digits = digits;
            }
        } else {
            if (diff1 < diff2)
                max_digits = digits;
            else
                min_digits = digits;
            if (max_digits - min_digits < 100)
                break;
        }
    }
    return (unsigned long) (digits * log10);
}
示例#15
0
int
main(int argc, char **argv)
{
	//!!ELLERS  -- cleaned up
	const char * filename;

	glutInitWindowSize(600, 600);
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_RGB|GLUT_DOUBLE);

	glutCreateWindow("FTGL demo");

	if ( argc >= 2 ) 
	{
		if ( !file_exists( argv[ 1 ] ))
		{
			usage( argv[ 0 ]);
            fprintf(stderr, "Couldn't open file '%s'\n", argv[1]);
			exit( -1 );
		}
		filename = argv[ 1 ];

        if ( argc >= 3 ) 
          {
          point_size = atoi(argv[2]);
          }
	}
	else 
	{
		// try a default font
		filename = DEFAULT_FONT;

		if ( !file_exists( filename ))
		{
			usage( argv[ 0 ]);
            fprintf(stderr, "Couldn't open default file '%s'\n", filename);
			exit( -1 );
		}
	}

	my_init( filename );

	glutDisplayFunc(my_display);
	glutReshapeFunc(my_reshape);
	glutKeyboardFunc(my_handle_key);

	glutMainLoop();
	return 0;
}
示例#16
0
文件: main.c 项目: mizielr/my_cat
int	read_cat(t_opt opts)
{
  int	nl;
  int	nb;
  char	str[BUFF_SIZE + 1];

  my_init(&nl, &nb);
  clean_str(&str[0]);
  while (read(0, &str, BUFF_SIZE) > 0)
    {
      str[BUFF_SIZE] = 0;
      exec_cat(str, opts, &nb, &nl);
      clean_str(&str[0]);
    }
  return (0);
}
示例#17
0
文件: CG.cpp 项目: fuopen/cg_teeth
int main(int argc,char** argv){
	if(argc!=3){
		perror("Error arguments number!");
	}

	my_rwfile = new Crwobj(argv[1],argv[2]);
	my_cg = new cdeal(*my_rwfile);
	if_draw=true;
	//my_cg->print_point();
	//exit(0);
	glutInit(&argc,argv);
	//glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB|GLUT_DEPTH);
	glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB|GLUT_DEPTH);
	glEnable(GL_DEPTH_TEST);
	glutInitWindowSize(1500,1000);
	glutInitWindowPosition(0,0);
	glutCreateWindow("F**K");
	//my_init();
	GLfloat light1_position[]={-0.86,0.87,0.8,0.0};
	GLfloat light1_ambient[] ={0.98,0.91,0.97,1.0};
	GLfloat light1_diffuse[] ={0.12,0.94,0.14,1.0};
	GLfloat light1_specular[]={0.92,0.12,0.19,1.0};
	glLightfv(GL_LIGHT1,GL_POSITION,light1_position);
	glLightfv(GL_LIGHT1,GL_AMBIENT,light1_ambient);
	glLightfv(GL_LIGHT1,GL_DIFFUSE,light1_diffuse);
	glLightfv(GL_LIGHT1,GL_SPECULAR,light1_specular);
	glLightf(GL_LIGHT1,GL_QUADRATIC_ATTENUATION,0.05);
	GLfloat spotdir[]={0.8,-0.87,-0.75};
	glLightfv(GL_LIGHT1,GL_SPOT_DIRECTION,spotdir);
	glLightf(GL_LIGHT1,GL_SPOT_CUTOFF,30);
	glLightf(GL_LIGHT1,GL_SPOT_EXPONENT,0.7);
	glEnable(GL_LIGHT1);
	//glutReshapeFunc(my_reshape);
	glutDisplayFunc(my_display);
	glutReshapeFunc(my_reshape);
	//glEnable(GL_DEPTH_TEST);
	//glClear(GL_COLOR_BUFFER_BIT);
	//glClearColor(1.0,1.0,1.0,1.0);
	glutIdleFunc(spin_obj);
	glutMouseFunc(mouseButton);
	glutMotionFunc(mouseMotion);
	my_init();
	glutMainLoop();
	delete my_rwfile;
	delete my_cg;
	return 0;
}
示例#18
0
int
ndb_init()
{
  if (ndb_init_called == 0)
  {
    ndb_init_called = 1;
    if (my_init())
    {
      const char* err = "my_init() failed - exit\n";
      int res = write(2, err, strlen(err));
      (void)res;
      exit(1);
    }
    ndb_init_internal();
  }
  return 0;
}
示例#19
0
文件: dll.c 项目: Coco-wan/git-1
void libmysql_init(void)
{
  if (libmysql_inited)
    return;
  libmysql_inited=1;
  my_init();
  {
    DBUG_ENTER("libmysql_init");
#ifdef LOG_ALL
    DBUG_PUSH("d:t:S:O,c::\\tmp\\libmysql.log");
#else
    if (getenv("LIBMYSQL_LOG") != NULL)
      DBUG_PUSH(getenv("LIBMYSQL_LOG"));
#endif
    DBUG_VOID_RETURN;
  }
}
void main(void) {
        int ldv_s_misc_fops_file_operations = 0;
 my_init();
        while(__VERIFIER_nondet_int()) {

                switch(__VERIFIER_nondet_int()) {

                        case 0: {
                                if(ldv_s_misc_fops_file_operations==0) {
                                misc_open();
                                ldv_s_misc_fops_file_operations++;
                                }
                        }
   break;

                        case 1: {
                                if(ldv_s_misc_fops_file_operations==1) {
                                misc_read();
                                ldv_s_misc_fops_file_operations++;
                                }
                        }
                        break;

                        case 2: {
                                if(ldv_s_misc_fops_file_operations==2) {
                                misc_llseek();
                                ldv_s_misc_fops_file_operations++;
                                }
                        }
                        break;

                        case 3: {
                                if(ldv_s_misc_fops_file_operations==3) {
                                misc_release();
                                ldv_s_misc_fops_file_operations=0;
                                }
                        }
                        break;

                        default: break;
                }
        }
        check_final_state();
 return;
}
示例#21
0
文件: demo2.c 项目: cosmos72/twin
int main(int argc, char *argv[]) {
    byte ok;
    
    if ((ok = my_init())) {
	/*
	 * ok = TTMainLoop();
	 */
	/* do it the hard way instead: */
	ok = my_mainloop();
    }
    
    if (!ok)
	fprintf(stderr, "ttdemo: libTT error: %s%s\n", TTStrError(TTErrno), TTStrErrorDetail(TTErrno, TTErrnoDetail));
    
    TTClose();
    
    return !ok;
}
示例#22
0
void grab_window(const char *fileName, g_save_type type)
{
	my_init();
	int x, y, w, h;
//	grab_pointer_position(&x, &y, &w, &h);
	grab_window_position(&x, &y, &w, &h);
   	XWindowAttributes window_attr;
	Window window = DefaultRootWindow(dpy);
	GPixbuf *dest = g_pixbuf_x_get_from_drawable(dpy, window, x, y, w, h);
	FILE *fp;
	fp = fopen(fileName, "wba");

	g_pixbuf_save(dest, fp, type);
	if (fp) fclose(fp);
	free(dest->pixels);
	free(dest);
	my_close();
}
示例#23
0
文件: main.c 项目: mizielr/my_cat
int	my_cat(char *filename, t_opt opts)
{
  int	nl;
  int	nb;
  int	file;
  char	str[BUFF_SIZE + 1];

  file = open(filename, O_RDONLY, BUFF_SIZE);
  if (file == -1)
    return (my_error(filename));
  my_init(&nl, &nb);
  while (read(file, &str, BUFF_SIZE) > 0)
    {
      str[BUFF_SIZE] = 0;
      exec_cat(str, opts, &nb, &nl);
    }
  close(file);
  return (0);
}
int 
main(int argc, char **argv)
{

   glutInitWindowSize(500, 250);
   glutInit(&argc, argv);
   glutInitDisplayMode(GLUT_RGB|GLUT_DOUBLE);

   glutCreateWindow("GLUT fonts");

   my_init();

   glutDisplayFunc(my_display);
   glutReshapeFunc(my_reshape);
   glutKeyboardFunc(my_handle_key);

   glutMainLoop();

   return 0;
}
示例#25
0
文件: main.c 项目: Stargateur/corewar
static int	my_create_champion(header_t *header, char *champion)
{
  char		*champ;
  int		fd;

  my_putstr(champion, 1);
  my_putchar('\n', 1);
  if ((champ = my_init(header, champion)) == NULL)
    return (1);
  if ((fd = my_create_s(champion)) == -1)
    return (1);
  my_dump_champ(header, champ);
  if (my_write_header(header, fd))
    return (1);
  if (my_write_ins(header, champ, fd))
    return (1);
  close(fd);
  free(champ);
  return (0);
}
示例#26
0
main()
{
  int i, j;

  my_init(MEMORY_SIZE, PHYSICAL_MEM_LIMIT);
  dump_out();
  for (i = 0; i < NUM_BUFS; i++) {
    sbuf[i] = (char *)my_malloc(SMALL_BUF_SIZE);
    lbuf[i] = (char *)my_malloc(LARGE_BUF_SIZE);
    printf("The buffer small pointers is %x, and large pointer is %x\n", (unsigned)sbuf[i], (unsigned)lbuf[i]);
  }
  dump_out();
  
  for (i = 0; i < NUM_BUFS; i++) {
    my_free((void *) sbuf[i]);
    my_free((void *) lbuf[i]);
  }
  dump_out();

  my_terminate();
}
示例#27
0
/**
 * FSAL_Init : Initializes the FileSystem Abstraction Layer.
 *
 * \param init_info (input, fsal_parameter_t *) :
 *        Pointer to a structure that contains
 *        all initialization parameters for the FSAL.
 *        Specifically, it contains settings about
 *        the filesystem on which the FSAL is based,
 *        security settings, logging policy and outputs,
 *        and other general FSAL options.
 *
 * \return Major error codes :
 *         ERR_FSAL_NO_ERROR     (initialisation OK)
 *         ERR_FSAL_FAULT        (init_info pointer is null)
 *         ERR_FSAL_SERVERFAULT  (misc FSAL error)
 *         ERR_FSAL_ALREADY_INIT (The FS is already initialized)
 *         ERR_FSAL_BAD_INIT     (FS specific init error,
 *                                minor error code gives the reason
 *                                for this error.)
 *         ERR_FSAL_SEC_INIT     (Security context init error).
 */
fsal_status_t POSIXFSAL_Init(fsal_parameter_t * init_info       /* IN */
    )
{
#if defined(_USE_PGSQL)
  posixfs_specific_initinfo_t * posix_init
    = (posixfs_specific_initinfo_t *)&init_info->fs_specific_info;
  int rc = 0 ;
#endif
  fsal_status_t status;

  /* sanity check.  */
  if(!init_info)
    Return(ERR_FSAL_FAULT, 0, INDEX_FSAL_Init);

  /* proceeds FSAL internal initialization */

  status = fsal_internal_init_global(&(init_info->fsal_info),
                                     &(init_info->fs_common_info),
                                     &(init_info->fs_specific_info));

  if(FSAL_IS_ERROR(status))
    Return(status.major, status.minor, INDEX_FSAL_Init);

  /* FS Specific initialization. */

  /* Define the password file path used by PostgreSQL */
#if defined(_USE_PGSQL)
  if(!posix_init->dbparams.passwdfile[0] == '\0')
    {
      rc = setenv("PGPASSFILE", posix_init->dbparams.passwdfile, 1);
      if(rc != 0)
        LogMajor(COMPONENT_FSAL, "FSAL INIT: *** WARNING: Could not set POSTGRESQL keytab path.");
    }
#elif defined (_USE_MYSQL)
  my_init();
#endif

  Return(ERR_FSAL_NO_ERROR, 0, INDEX_FSAL_Init);

}
// more general initialization which includes the keyboard listener
void glut_setup(int iArgc, char** cppArgv)
{
	std::string font_name_str = "fixed";
	char* font_name = (char*)font_name_str.c_str();

	glutInit(&iArgc, cppArgv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
	glutInitWindowSize((int) (SCREEN_WIDTH), (int) (SCREEN_HEIGHT));
	glutInitWindowPosition(SCREEN_POSITION_X, SCREEN_POSITION_Y);
	glutCreateWindow(WINDOWS_NAME);

	initialize();
	my_init(font_name);

	if (FULLSCREEN)
		glutFullScreen();
	glutDisplayFunc(draw_all);	// function called to display
	// glutReshapeFunc(my_reshape);

	glutKeyboardFunc(keyPressed);
	glutKeyboardUpFunc(keyUp);
	glutSpecialFunc(keySpecial);
	glutSpecialUpFunc(keySpecialUp);
}
示例#29
0
文件: get_next_line.c 项目: plean/PSU
char		*get_next_line(const int fd)
{
  static char	*buffer = NULL;
  t_gnl		*line;
  int		i;

  i = -1;
  if ((line = malloc(sizeof(t_gnl))) == NULL)
    return (NULL);
  line->line = NULL;
  line->line = my_init(line->line, buffer);
  if (line->line != NULL)
    while (line->line[++i])
      if (line->line[i] == '\n')
	{
	  line->line[i] = 0;
	  return (line->line);
	}
  i = -1;
  if ((buffer = malloc(sizeof(char) * (READ_SIZE + 1))) == NULL)
    return (NULL);
  buffer = get_next_line_suite(line, (char *)buffer, i, fd);
  return (line->line);
}
int main(int argc, char **argv) {

	// init GLUT and create Window
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
	
	glutInitWindowPosition(100,100);
	glutInitWindowSize(500,500); 
	glutCreateWindow("Graphics_Project_3_lighting");

	// register callbacks
	glutDisplayFunc(render_scene_func);
	glutIdleFunc(spinSunAndCamera);
	//glutReshapeFunc(myReshape);

	//set attributes
	my_init();
	
	// enter GLUT event processing cycle
	glutMainLoop();

	return 0;

}