コード例 #1
0
ファイル: main.c プロジェクト: Zomega/6.115-Final-Project
int main() {
	spaceship* s = malloc(sizeof(spaceship));
	s->speed = 1;
	set_identity( &(s->heading) );
	
	int i = 0;
	for(; i < 10; i++) {
		print_spaceship( s );

		float yaw = 0.0;
		float pitch = 0.0;
		float roll = 0.2;

		rotation3 d_heading = get_rotation( yaw, pitch, roll );
		update_spaceship( s, d_heading );
		printf("\n");
		//gameloop( s, (circle3*)s );
	}

	vector2 v;
	v.x = 1;
	v.y = 10;
	vector2* w = clip_to_screen( &v, 6, 4 );
	printf( "%f \t%f\n", w->x, w->y );

	return;
};
コード例 #2
0
ファイル: camera_matrix.cpp プロジェクト: 03050903/godot
void CameraMatrix::set_frustum(float p_left, float p_right, float p_bottom, float p_top, float p_near, float p_far) {
#if 0
	///@TODO, give a check to this. I'm not sure if it's working.
	set_identity();

	matrix[0][0]=(2*p_near) / (p_right-p_left);
	matrix[0][2]=(p_right+p_left) / (p_right-p_left);
	matrix[1][1]=(2*p_near) / (p_top-p_bottom);
	matrix[1][2]=(p_top+p_bottom) / (p_top-p_bottom);
	matrix[2][2]=-(p_far+p_near) / ( p_far-p_near);
	matrix[2][3]=-(2*p_far*p_near) / (p_far-p_near);
	matrix[3][2]=-1;
	matrix[3][3]=0;
#else
	float *te = &matrix[0][0];
	float x = 2 * p_near / ( p_right - p_left );
	float y = 2 * p_near / ( p_top - p_bottom );

	float a = ( p_right + p_left ) / ( p_right - p_left );
	float b = ( p_top + p_bottom ) / ( p_top - p_bottom );
	float c = - ( p_far + p_near ) / ( p_far - p_near );
	float d = - 2 * p_far * p_near / ( p_far - p_near );

	te[0] = x;	te[4] = 0;	te[8] = a;	te[12] = 0;
	te[1] = 0;	te[5] = y;	te[9] = b;	te[13] = 0;
	te[2] = 0;	te[6] = 0;	te[10] = c;	te[14] = d;
	te[3] = 0;	te[7] = 0;	te[11] = - 1;	te[15] = 0;

#endif

}
コード例 #3
0
ファイル: gameswf_types.cpp プロジェクト: JamesLinus/nui3
	void	matrix::read(stream* in)
	// Initialize from the stream.
	{
		in->align();

		set_identity();

		int	has_scale = in->read_uint(1);
		if (has_scale)
		{
			int	scale_nbits = in->read_uint(5);
			m_[0][0] = in->read_sint(scale_nbits) / 65536.0f;
			m_[1][1] = in->read_sint(scale_nbits) / 65536.0f;
		}
		int	has_rotate = in->read_uint(1);
		if (has_rotate)
		{
			int	rotate_nbits = in->read_uint(5);
			m_[1][0] = in->read_sint(rotate_nbits) / 65536.0f;
			m_[0][1] = in->read_sint(rotate_nbits) / 65536.0f;
		}

		int	translate_nbits = in->read_uint(5);
		if (translate_nbits > 0)
		{
			m_[0][2] = (float) in->read_sint(translate_nbits);
			m_[1][2] = (float) in->read_sint(translate_nbits);
		}

		//IF_VERBOSE_PARSE(log_msg("  mat: has_scale = %d, has_rotate = %d\n", has_scale, has_rotate));
	}
コード例 #4
0
ファイル: gameswf_types.cpp プロジェクト: JamesLinus/nui3
	void	matrix::set_inverse(const matrix& m)
	// Set this matrix to the inverse of the given matrix.
	{
		assert(this != &m);

		// Invert the rotation part.
		float	det = m.m_[0][0] * m.m_[1][1] - m.m_[0][1] * m.m_[1][0];
		if (det == 0.0f)
		{
			// Not invertible.
			//assert(0);	// castano: this happens sometimes! (ie. sample6.swf)

			// Arbitrary fallback.
			set_identity();
			m_[0][2] = -m.m_[0][2];
			m_[1][2] = -m.m_[1][2];
		}
		else
		{
			float	inv_det = 1.0f / det;
			m_[0][0] = m.m_[1][1] * inv_det;
			m_[1][1] = m.m_[0][0] * inv_det;
			m_[0][1] = -m.m_[0][1] * inv_det;
			m_[1][0] = -m.m_[1][0] * inv_det;

			m_[0][2] = -(m_[0][0] * m.m_[0][2] + m_[0][1] * m.m_[1][2]);
			m_[1][2] = -(m_[1][0] * m.m_[0][2] + m_[1][1] * m.m_[1][2]);
		}
	}
コード例 #5
0
ファイル: camera_matrix.cpp プロジェクト: Max-Might/godot
void CameraMatrix::set_perspective(real_t p_fovy_degrees, real_t p_aspect, real_t p_z_near, real_t p_z_far, bool p_flip_fov) {

	if (p_flip_fov) {
		p_fovy_degrees = get_fovy(p_fovy_degrees, 1.0 / p_aspect);
	}

	real_t sine, cotangent, deltaZ;
	real_t radians = p_fovy_degrees / 2.0 * Math_PI / 180.0;

	deltaZ = p_z_far - p_z_near;
	sine = Math::sin(radians);

	if ((deltaZ == 0) || (sine == 0) || (p_aspect == 0)) {
		return;
	}
	cotangent = Math::cos(radians) / sine;

	set_identity();

	matrix[0][0] = cotangent / p_aspect;
	matrix[1][1] = cotangent;
	matrix[2][2] = -(p_z_far + p_z_near) / deltaZ;
	matrix[2][3] = -1;
	matrix[3][2] = -2 * p_z_near * p_z_far / deltaZ;
	matrix[3][3] = 0;
}
コード例 #6
0
ファイル: camera_matrix.cpp プロジェクト: Max-Might/godot
void CameraMatrix::make_scale(const Vector3 &p_scale) {

	set_identity();
	matrix[0][0] = p_scale.x;
	matrix[1][1] = p_scale.y;
	matrix[2][2] = p_scale.z;
}
コード例 #7
0
ファイル: SWFMatrix.cpp プロジェクト: sunarto/gnash
// invert this SWFMatrix and return the result.
SWFMatrix&
SWFMatrix::invert()
{
    const boost::int64_t det = determinant();

    if (det == 0) {
        set_identity();
        return *this;
    }

    const double dn = 65536.0 * 65536.0 / det;
    
    const boost::int32_t t0 = (boost::int32_t)(d() * dn);
    _d = (boost::int32_t)(a() * dn);
    _c = (boost::int32_t)(-c() * dn);
    _b = (boost::int32_t)(-b() * dn);

    const boost::int32_t t4 = -(multiplyFixed16(_tx, t0) + multiplyFixed16(_ty, _c));
    _ty = -(multiplyFixed16(_tx, _b) + multiplyFixed16(_ty, _d));

    _a = t0;
    _tx = t4;

    return *this;
}
コード例 #8
0
void VSObjectTransformation::yzRotate(double angle /*deg*/) {
	double theta=angle*PI/180;
	double44 hold;
	set_identity(hold);
	hold[1][1]=cos(theta); hold[1][2]=-sin(theta);
	hold[2][1]=sin(theta); hold[2][2]=cos(theta);
	left_multiply_by(hold);
}
コード例 #9
0
ファイル: Mat4.cpp プロジェクト: clucasa/MPMViz
void Mat4::set_translate( GLfloat tx, GLfloat ty, GLfloat tz )
{
    // "this" is a pointer to this class's mat4  (this->name)
    
    set_identity( );

    this->m[0][3] = tx;
    this->m[1][3] = ty;
    this->m[2][3] = tz;
}
コード例 #10
0
ファイル: Mat4.cpp プロジェクト: clucasa/MPMViz
void Mat4::set_scale( GLfloat sx, GLfloat sy, GLfloat sz )
{
    // "this" is a pointer to this class's mat4  (this->name)

    set_identity( );

    this->m[0][0] = sx;
    this->m[1][1] = sy;
    this->m[2][2] = sz;
}
コード例 #11
0
ファイル: camera_matrix.cpp プロジェクト: Max-Might/godot
void CameraMatrix::set_orthogonal(real_t p_left, real_t p_right, real_t p_bottom, real_t p_top, real_t p_znear, real_t p_zfar) {

	set_identity();

	matrix[0][0] = 2.0 / (p_right - p_left);
	matrix[3][0] = -((p_right + p_left) / (p_right - p_left));
	matrix[1][1] = 2.0 / (p_top - p_bottom);
	matrix[3][1] = -((p_top + p_bottom) / (p_top - p_bottom));
	matrix[2][2] = -2.0 / (p_zfar - p_znear);
	matrix[3][2] = -((p_zfar + p_znear) / (p_zfar - p_znear));
	matrix[3][3] = 1.0;
}
コード例 #12
0
ファイル: Mat4.cpp プロジェクト: clucasa/MPMViz
void Mat4::set_rotateZ( GLfloat deg )
{
    // "this" is a pointer to this class's mat4  (this->name)
    
    GLfloat theta = deg * D2R;

    set_identity( );
    
    this->m[0][0] = cos(theta);
    this->m[1][1] = cos(theta);
    this->m[1][0] = sin(theta);
    this->m[0][1] = -sin(theta);
}
コード例 #13
0
ファイル: Mat4.cpp プロジェクト: clucasa/MPMViz
void Mat4::set_perspective( GLfloat fovy, GLfloat ratio, GLfloat znear, GLfloat zfar)
{
    GLfloat top   = tan(fovy*D2R/2.0f) * znear;
    GLfloat right = top * ratio;

    set_identity();
    m[0][0] = znear/right;
    m[1][1] = znear/top;
    m[2][2] = -(zfar + znear)/(zfar - znear);
    m[2][3] = -2.0*zfar*znear/(zfar - znear);
    m[3][2] = -1.0;
    m[3][3] = 0.0;
}
コード例 #14
0
ファイル: gvpectrl.C プロジェクト: TradeHill2011/gvpe
int
main (int argc, char **argv, char **envp)
{
  set_identity (argv[0]);
  log_to (LOGTO_STDERR);

  setlocale (LC_ALL, "");
  bindtextdomain (PACKAGE, LOCALEDIR);
  textdomain (PACKAGE);

  parse_options (argc, argv, envp);

  if (show_version)
    {
      printf (_("%s version %s (built %s %s, protocol version %d.%d)\n"), get_identity (),
              VERSION, __DATE__, __TIME__, PROTOCOL_MAJOR, PROTOCOL_MINOR);
      printf (_("Built with kernel interface %s/%s.\n"), IFTYPE, IFSUBTYPE);
      printf (_
              ("Copyright (C) 2003-2008 Marc Lehmann <*****@*****.**> and others.\n"
               "See the AUTHORS file for a complete list.\n\n"
               "vpe comes with ABSOLUTELY NO WARRANTY.  This is free software,\n"
               "and you are welcome to redistribute it under certain conditions;\n"
               "see the file COPYING for details.\n"));

      return 0;
    }

  if (show_help)
    usage (0);

  {
    configuration_parser (conf, false, 0, 0);
  }

  if (generate_keys)
    {
      RAND_load_file ("/dev/urandom", 1024);
      exit (keygen (generate_keys));
    }

  if (kill_gvpe)
    exit (kill_other (kill_gvpe));

  if (show_config)
    {
      conf.print ();
      exit (EXIT_SUCCESS);
    }

  usage (1);
}
コード例 #15
0
ファイル: su.c プロジェクト: htchoi1995/Superuser
static __attribute__ ((noreturn)) void allow(struct su_context *ctx) {
    char *arg0;
    int argc, err;

    umask(ctx->umask);
    // No send to UI accepted requests for shell and root users (they are in the log)
    // if( ctx->from.uid != AID_SHELL && ctx->from.uid != AID_ROOT ) {
        send_result(ctx, ALLOW);
    // }

    arg0 = strrchr (ctx->to.shell, '/');
    arg0 = (arg0) ? arg0 + 1 : ctx->to.shell;
    if (ctx->to.login) {
        int s = strlen(arg0) + 2;
        char *p = malloc(s);

        if (!p)
            exit(EXIT_FAILURE);

        *p = '-';
        strcpy(p + 1, arg0);
        arg0 = p;
    }

    populate_environment(ctx);
    set_identity(ctx->to.uid);

#define PARG(arg)                                    \
    (ctx->to.optind + (arg) < ctx->to.argc) ? " " : "",                    \
    (ctx->to.optind + (arg) < ctx->to.argc) ? ctx->to.argv[ctx->to.optind + (arg)] : ""

    LOGD("%u %s executing %u %s using shell %s : %s%s%s%s%s%s%s%s%s%s%s%s%s%s",
            ctx->from.uid, ctx->from.bin,
            ctx->to.uid, get_command(&ctx->to), ctx->to.shell,
            arg0, PARG(0), PARG(1), PARG(2), PARG(3), PARG(4), PARG(5),
            (ctx->to.optind + 6 < ctx->to.argc) ? " ..." : "");

    argc = ctx->to.optind;
    if (ctx->to.command) {
        ctx->to.argv[--argc] = ctx->to.command;
        ctx->to.argv[--argc] = "-c";
    }
    ctx->to.argv[--argc] = arg0;
    execv(ctx->to.shell, ctx->to.argv + argc);
    err = errno;
    PLOGE("exec");
    fprintf(stderr, "Cannot execute %s: %s\n", ctx->to.shell, strerror(err));
    exit(EXIT_FAILURE);
}
コード例 #16
0
ファイル: acct_init.c プロジェクト: Firstyear/ds
/*
  Master init function for the account plugin
*/
int
acct_policy_init( Slapi_PBlock *pb )
{
	void *plugin_id;
	int enabled;

	slapi_pblock_get(pb, SLAPI_PLUGIN_ENABLED, &enabled);

	if (!enabled) {
		/* not enabled */
		return( CALLBACK_OK );
	}


	if ( slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION,
				SLAPI_PLUGIN_VERSION_01 ) != 0 ||
		slapi_pblock_set( pb, SLAPI_PLUGIN_DESCRIPTION,
				(void *)&plugin_desc ) != 0 || 
		slapi_pblock_set( pb, SLAPI_PLUGIN_CLOSE_FN,
				(void *)&acct_policy_close ) != 0 ||
		slapi_pblock_set( pb, SLAPI_PLUGIN_START_FN,
				(void *)acct_policy_start ) != 0 ) {
			slapi_log_err(SLAPI_LOG_ERR, PLUGIN_NAME,
					"acct_policy_init - Registration failed\n" );
			return( CALLBACK_ERR );
	}

	if( slapi_pblock_get( pb, SLAPI_PLUGIN_IDENTITY, &plugin_id ) != 0 ) {
		slapi_log_err(SLAPI_LOG_ERR, PLUGIN_NAME,
				"acct_policy_init - Failed to get plugin identity\n" );
		return( CALLBACK_ERR );
	}

	set_identity( plugin_id );

	/* Register the pre and postop plugins */
	if( slapi_register_plugin("preoperation", 1, "acct_preop_init",
		acct_preop_init, PRE_PLUGIN_DESC, NULL, plugin_id) != 0 ||
		slapi_register_plugin("postoperation", 1, "acct_postop_init",
		acct_postop_init, POST_PLUGIN_DESC, NULL, plugin_id) != 0 ) {
		slapi_log_err(SLAPI_LOG_ERR, PLUGIN_NAME,
			"acct_policy_init  - Failed to register callbacks\n" );
		return( CALLBACK_ERR );
	}

	return( CALLBACK_OK );
}
コード例 #17
0
ファイル: identityFixed.c プロジェクト: clenk/School-Projects
main() {
    int matrix[SIZE][SIZE];

    set_identity(matrix);
    print_identity(matrix);
    if(test_identity(matrix)) {
        printf("is identity matrix\n");
    } else {
        printf("is NOT identity matrix\n");
    }
    matrix[0][3] = 1;
    print_identity(matrix);
    if(test_identity(matrix)) {
        printf("is identity matrix\n");
    } else {
        printf("is NOT identity matrix\n");
    }
}
コード例 #18
0
void VSObjectTransformation::invert() {
	double44 result;
	set_identity(result);
	double d33=det33(m_data);
	result[0][0]=(m_data[1][1]*m_data[2][2]-m_data[2][1]*m_data[1][2])*(+1)/d33;
	result[1][0]=(m_data[1][0]*m_data[2][2]-m_data[2][0]*m_data[1][2])*(-1)/d33;
	result[2][0]=(m_data[1][0]*m_data[2][1]-m_data[2][0]*m_data[1][1])*(+1)/d33;
	result[0][1]=(m_data[0][1]*m_data[2][2]-m_data[2][1]*m_data[0][2])*(-1)/d33;
	result[1][1]=(m_data[0][0]*m_data[2][2]-m_data[2][0]*m_data[0][2])*(+1)/d33;
	result[2][1]=(m_data[0][0]*m_data[2][1]-m_data[2][0]*m_data[0][1])*(-1)/d33;
	result[0][2]=(m_data[0][1]*m_data[1][2]-m_data[1][1]*m_data[0][2])*(+1)/d33;
	result[1][2]=(m_data[0][0]*m_data[1][2]-m_data[1][0]*m_data[0][2])*(-1)/d33;
	result[2][2]=(m_data[0][0]*m_data[1][1]-m_data[1][0]*m_data[0][1])*(+1)/d33;
	
	result[0][3]=-result[0][0]*m_data[0][3]-result[0][1]*m_data[1][3]-result[0][2]*m_data[2][3];
	result[1][3]=-result[1][0]*m_data[0][3]-result[1][1]*m_data[1][3]-result[1][2]*m_data[2][3];
	result[2][3]=-result[2][0]*m_data[0][3]-result[2][1]*m_data[1][3]-result[2][2]*m_data[2][3];
	
	set_data(result);
}
コード例 #19
0
ファイル: activity.c プロジェクト: AlfSimen/Superuser
// TODO: leverage this with exec_log?
static int silent_run(char* command) {
    char *args[] = { "sh", "-c", command, NULL, };
    set_identity(0);
    pid_t pid;
    pid = fork();
    /* Parent */
    if (pid < 0) {
        PLOGE("fork");
        return -1;
    }
    else if (pid > 0) {
        return 0;
    }
    int zero = open("/dev/zero", O_RDONLY | O_CLOEXEC);
    dup2(zero, 0);
    int null = open("/dev/null", O_WRONLY | O_CLOEXEC);
    dup2(null, 1);
    dup2(null, 2);
    execv(_PATH_BSHELL, args);
    PLOGE("exec am");
    _exit(EXIT_FAILURE);
    return -1;
}
コード例 #20
0
/**
 * Sets matrix to the identity matrix
 */
TRANSFORM2::TRANSFORM2()
{
  set_identity();
}
コード例 #21
0
VSObjectTransformation::VSObjectTransformation() 
{
	set_identity(m_data);
}
コード例 #22
0
void VSObjectTransformation::translate(double dx,double dy,double dz) {
	double44 hold;
	set_identity(hold);
	hold[0][3]=dx; hold[1][3]=dy; hold[2][3]=dz;
	left_multiply_by(hold);
}
コード例 #23
0
void VSObjectTransformation::scale(double sx,double sy,double sz) {
	double44 hold;
	set_identity(hold);
	hold[0][0]=sx; hold[1][1]=sy; hold[2][2]=sz;
	left_multiply_by(hold);
}
コード例 #24
0
ファイル: camera_matrix.cpp プロジェクト: Max-Might/godot
CameraMatrix::CameraMatrix() {

	set_identity();
}
コード例 #25
0
ファイル: gameswf_types.cpp プロジェクト: JamesLinus/nui3
	matrix::matrix()
	{
		// Default to identity.
		set_identity();
	}
コード例 #26
0
ファイル: elevate_matcheshh.c プロジェクト: Fahdben/imscript
int main(int c, char *v[])
{
	if (c != 5 && c != 6 && c != 7) {
		fprintf(stderr, "usage:\n\t"
		"%s Axyz.tiff Bxyx.tiff homA homB [pairs2d [pairs3d]]\n",*v);
		//0 1         2         3    4     5        6
		return 1;
	}
	char *filename_a = v[1];
	char *filename_b = v[2];
	char *homstring_a = v[3];
	char *homstring_b = v[4];
	char *filename_in  = c > 5 ? v[5] : "-";
	char *filename_out = c > 6 ? v[6] : "-";

	double Ha[9], Hb[9], iHa[3][3], iHb[3][3];
	int nHa = read_n_doubles_from_string(Ha, homstring_a, 9);
	int nHb = read_n_doubles_from_string(Hb, homstring_b, 9);
	if (nHa != 9) set_identity(Ha);
	if (nHb != 9) set_identity(Hb);
	invert_homography(iHa, (void*)Ha);
	invert_homography(iHb, (void*)Hb);

	int wa, ha, pda, wb, hb, pdb;
	float *a = iio_read_image_float_vec(filename_a, &wa, &ha, &pda);
	float *b = iio_read_image_float_vec(filename_b, &wb, &hb, &pdb);
	FILE *fi = xfopen(filename_in, "r");
	FILE *fo = xfopen(filename_out, "w");
	if (pda != pdb)
		return fprintf(stderr, "input images dimension mismatch\n");
	if (pda != 1 && pda != 3)
		return fprintf(stderr, "input images should be h or xyz\n");

	int n, lmax = 10000;
	char line[lmax];
	while (n = getlinen(line, lmax, fi))
	{
		double m[4], p[2], q[2];
		int r = sscanf(line, "%lf %lf %lf %lf", m, m + 1, m + 2, m + 3);
		if (r != 4) continue;
		apply_homography(p, iHa, m);
		apply_homography(q, iHb, m + 2);
		int ia = lrint(p[0]);
		int ja = lrint(p[1]);
		int ib = lrint(q[0]);
		int jb = lrint(q[1]);
		if (!insideP(wa, ha, ia, ja)) continue;
		if (!insideP(wb, hb, ib, jb)) continue;
		float *va = a + pda * (wa * ja + ia);
		float *vb = b + pda * (wb * jb + ib);
		if (!isfinite(*va)) continue;
		if (!isfinite(*vb)) continue;
		if (pda == 1) // heights
			fprintf(fo, "%lf %lf %lf %lf %lf %lf\n",
				p[0], p[1], *va, q[0], q[1], *vb);
		else // xyz
			fprintf(fo, "%lf %lf %lf %lf %lf %lf\n",
				va[0], va[1], va[2], vb[0], vb[1], vb[2]);
	}

	free(a);
	free(b);
	xfclose(fo);
	xfclose(fi);
	return 0;
}
コード例 #27
0
ファイル: su.c プロジェクト: phhusson/Superuser
static __attribute__ ((noreturn)) void allow(struct su_context *ctx) {
    char *arg0;
    int argc, err;

    hacks_update_context(ctx);

    umask(ctx->umask);
    int send_to_app = 1;

    // no need to log if called by root
    if (ctx->from.uid == AID_ROOT)
        send_to_app = 0;

    // dumpstate (which logs to logcat/shell) will spam the crap out of the system with su calls
    if (strcmp("/system/bin/dumpstate", ctx->from.bin) == 0)
        send_to_app = 0;

    if (send_to_app)
        send_result(ctx, ALLOW);

    if(ctx->bind.from[0] && ctx->bind.to[0])
        allow_bind(ctx);

    if(ctx->init[0])
        allow_init(ctx);

    char *binary;
    argc = ctx->to.optind;
    if (ctx->to.command) {
        binary = ctx->to.shell;
        ctx->to.argv[--argc] = ctx->to.command;
        ctx->to.argv[--argc] = "-c";
    }
    else if (ctx->to.shell) {
        binary = ctx->to.shell;
    }
    else {
        if (ctx->to.argv[argc]) {
            binary = ctx->to.argv[argc++];
        }
        else {
            binary = DEFAULT_SHELL;
        }
    }

    arg0 = strrchr (binary, '/');
    arg0 = (arg0) ? arg0 + 1 : binary;
    if (ctx->to.login) {
        int s = strlen(arg0) + 2;
        char *p = malloc(s);

        if (!p)
            exit(EXIT_FAILURE);

        *p = '-';
        strcpy(p + 1, arg0);
        arg0 = p;
    }

    populate_environment(ctx);
    set_identity(ctx->to.uid);

#define PARG(arg)                                    \
    (argc + (arg) < ctx->to.argc) ? " " : "",                    \
    (argc + (arg) < ctx->to.argc) ? ctx->to.argv[argc + (arg)] : ""

    LOGD("%u %s executing %u %s using binary %s : %s%s%s%s%s%s%s%s%s%s%s%s%s%s",
            ctx->from.uid, ctx->from.bin,
            ctx->to.uid, get_command(&ctx->to), binary,
            arg0, PARG(0), PARG(1), PARG(2), PARG(3), PARG(4), PARG(5),
            (ctx->to.optind + 6 < ctx->to.argc) ? " ..." : "");

	if(ctx->to.context && strcmp(ctx->to.context, "u:r:su_light:s0") == 0) {
		setexeccon(ctx->to.context);
	} else {
		setexeccon("u:r:su:s0");
    }

    ctx->to.argv[--argc] = arg0;
    execvp(binary, ctx->to.argv + argc);
    err = errno;
    PLOGE("exec");
    fprintf(stderr, "Cannot execute %s: %s\n", binary, strerror(err));
    exit(EXIT_FAILURE);
}
コード例 #28
0
ファイル: Mat4.cpp プロジェクト: clucasa/MPMViz
Mat4::Mat4( )
{
    set_identity( );
}