当前位置: 首页>>代码示例>>C++>>正文


C++ p_error函数代码示例

本文整理汇总了C++中p_error函数的典型用法代码示例。如果您正苦于以下问题:C++ p_error函数的具体用法?C++ p_error怎么用?C++ p_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了p_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: set_edit_chars

/*
 * Trade edit characters with the other talk. By agreement
 * the first three characters each talk transmits after
 * connection are the three edit characters.
 */
void
set_edit_chars(void)
{
	char buf[3];
	int cc;
	struct termios tty;
	
	tcgetattr(0, &tty);
	my_win.cerase = tty.c_cc[VERASE];
	my_win.kill = tty.c_cc[VKILL];
	if (tty.c_cc[VWERASE] == (unsigned char) -1)
		my_win.werase = '\027';	 /* control W */
	else
		my_win.werase = tty.c_cc[VWERASE];
	buf[0] = my_win.cerase;
	buf[1] = my_win.kill;
	buf[2] = my_win.werase;
	cc = write(sockt, buf, sizeof(buf));
	if (cc != sizeof(buf) )
		p_error("Lost the connection");
	cc = read(sockt, buf, sizeof(buf));
	if (cc != sizeof(buf) )
		p_error("Lost the connection");
	his_win.cerase = buf[0];
	his_win.kill = buf[1];
	his_win.werase = buf[2];
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:32,代码来源:init_disp.c

示例2: sininv

/* Sinusoidal inverse equations--mapping x,y to lat,long 
  -----------------------------------------------------*/
int sininv(
double x,		/* (I) X projection coordinate */
double y,		/* (I) Y projection coordinate */
double *lon,		/* (O) Longitude */
double *lat)		/* (O) Latitude */
{
  double temp;		/* Re-used temporary variable */
  double mu, ml;
  double sin_phi, cos_phi;
/* Inverse equations
  -----------------*/
  x -= false_easting;
  y -= false_northing;
  
  if (ind != 0) /* Spherical */
    {
      *lat = y / R;
      if (fabs(*lat) > HALF_PI) 
	{
	  p_error("Input data error","sinusoidal-inverse");
	  return(164);
	}
      temp = fabs(*lat) - HALF_PI;
      if (fabs(temp) > EPSLN)
	{
	  temp = lon_center + x / (R * cos(*lat));
	  *lon = adjust_lon(temp);
	}
      else *lon = lon_center;
      return(OK);
    }
  else /* Ellipsoidal */
    {
      ml = y;
      mu = ml / (r_major * imu);
      *lat = mu + 
	(e2 * sin(2.0 * mu)) + 
	(e3 * sin(4.0 * mu)) + 
	(e4 * sin(6.0 * mu)) + 
	(e5 * sin(8.0 * mu));

      if (fabs(*lat) > HALF_PI) 
	{
	  p_error("Input data error","sinusoidal-inverse");
	  return(164);
	}
      temp = fabs(*lat) - HALF_PI;
      if (fabs(temp) > EPSLN)
	{
	  sin_phi = sin(*lat);
	  cos_phi = cos(*lat);
	  temp = lon_center + 
	    x * sqrt(1.0 - es * SQUARE(sin_phi)) / (r_major * cos_phi);
	  *lon = adjust_lon(temp);
	}
     else *lon = lon_center;
     return(OK);
   }
}
开发者ID:OPENDAP,项目名称:hdf5_handler,代码行数:61,代码来源:sininv.c

示例3: invite_remote

int
invite_remote (void)
{
  int new_sockt;
  struct itimerval itimer;
  CTL_RESPONSE response;

  itimer.it_value.tv_sec = RING_WAIT;
  itimer.it_value.tv_usec = 0;
  itimer.it_interval = itimer.it_value;
  if (listen (sockt, 5) != 0)
    p_error ("Error on attempt to listen for caller");

  msg.addr.sa_family = htons (my_addr.sin_family);
  memcpy (msg.addr.sa_data,
	  ((struct sockaddr *) &my_addr)->sa_data,
	  sizeof ((struct sockaddr *) & my_addr)->sa_data);

  msg.id_num = htonl (-1);	/* an impossible id_num */
  invitation_waiting = 1;
  announce_invite ();
  /*
   * Shut off the automatic messages for a while,
   * so we can use the interupt timer to resend the invitation
   */
  end_msgs ();
  setitimer (ITIMER_REAL, &itimer, (struct itimerval *) 0);
  message ("Waiting for your party to respond");
  signal (SIGALRM, re_invite);
  setjmp (invitebuf);
  while ((new_sockt = accept (sockt, 0, 0)) < 0)
    {
      if (errno == EINTR)
	continue;
      p_error ("Unable to connect with your party");
    }
  close (sockt);
  sockt = new_sockt;

  /*
   * Have the daemons delete the invitations now that we
   * have connected.
   */
  current_state = "Waiting for your party to respond";
  start_msgs ();

  msg.id_num = htonl (local_id);
  ctl_transact (my_machine_addr, msg, DELETE, &response);
  msg.id_num = htonl (remote_id);
  ctl_transact (his_machine_addr, msg, DELETE, &response);
  invitation_waiting = 0;

  return 0;
}
开发者ID:antoine1fr,项目名称:inetutils,代码行数:54,代码来源:invite.c

示例4: p_close

int p_close(p_team_t team)
{
    struct team *pteam = p_to_team(team);

    if (p_error(pteam))
            p_error(pteam);

    if (pteam->dev->dev_ops->close)
	    return pteam->dev->dev_ops->close(pteam->dev, pteam);

    return 0;
}
开发者ID:parallella,项目名称:pal,代码行数:12,代码来源:p_close.c

示例5: getpayload

/*
 * Get simple payload from file
 */
int getpayload(char *path) {
    FILE *file;

    // open file
    if((file=fopen(path, "r"))==NULL)
        p_error("\nError opening payload file.\n");

    if(!fread(progopt.payload, 1, MAX_ARG*4-1, file))
        p_error("\nError reading  payload from file.\n");

    fclose(file);

    return 1;
}
开发者ID:olemoudi,项目名称:toolbox,代码行数:17,代码来源:argparser.cpp

示例6: check_local

/*
 * See if the local daemon has an invitation for us.
 */
int
check_local(void)
{
	CTL_RESPONSE response;
	CTL_RESPONSE *rp = &response;
	struct sockaddr addr;

	/* the rest of msg was set up in get_names */
#ifdef MSG_EOR
	/* copy new style sockaddr to old, swap family (short in old) */
	msg.ctl_addr = *(struct osockaddr *)&ctl_addr;
	msg.ctl_addr.sa_family = htons(ctl_addr.sin_family);
#else
	msg.ctl_addr = *(struct sockaddr *)&ctl_addr;
#endif
	/* must be initiating a talk */
	if (!look_for_invite(rp))
		return (0);
	/*
	 * There was an invitation waiting for us,
	 * so connect with the other (hopefully waiting) party
	 */
	current_state = "Waiting to connect with caller";
	do {
		if (rp->addr.sa_family != AF_INET)
			p_error("Response uses invalid network address");
		(void)memcpy(&addr, &rp->addr.sa_family, sizeof(addr));
		addr.sa_family = rp->addr.sa_family;
		addr.sa_len = sizeof(addr);
		errno = 0;
		if (connect(sockt, &addr, sizeof(addr)) != -1)
			return (1);
	} while (errno == EINTR);
	if (errno == ECONNREFUSED) {
		/*
		 * The caller gave up, but his invitation somehow
		 * was not cleared. Clear it and initiate an
		 * invitation. (We know there are no newer invitations,
		 * the talkd works LIFO.)
		 */
		ctl_transact(his_machine_addr, msg, DELETE, rp);
		close(sockt);
		open_sockt();
		return (0);
	}
	p_error("Unable to connect with initiator");
	/*NOTREACHED*/
	return (0);
}
开发者ID:JabirTech,项目名称:Source,代码行数:52,代码来源:look_up.c

示例7: open_ctl

/* open the ctl socket */
open_ctl() 
{
    int length;

    ctl_addr.sin_port = 0;
    ctl_addr.sin_addr = my_machine_addr;
    ctl_sockt = socket(AF_INET, SOCK_DGRAM, 0);
    if (ctl_sockt <= 0)
	p_error("Bad socket");
    if (bind(ctl_sockt, (struct sockaddr *)&ctl_addr, sizeof(ctl_addr)) != 0)
	p_error("Couldn't bind to control socket");
    length = sizeof(ctl_addr);
    if (getsockname(ctl_sockt, (struct sockaddr *)&ctl_addr, &length) == -1)
	p_error("Bad address for ctl socket");
}
开发者ID:catufunwa,项目名称:4.4BSD-Lite,代码行数:16,代码来源:ctl.c

示例8: open_sockt

open_sockt()
{
    int length;

    my_addr.sin_addr = my_machine_addr;
    my_addr.sin_port = 0;
    sockt = socket(AF_INET, SOCK_STREAM, 0);
    if (sockt <= 0)
	p_error("Bad socket");
    if (bind(sockt, (struct sockaddr *)&my_addr, sizeof(my_addr)) != 0)
	p_error("Binding local socket");
    length = sizeof(my_addr);
    if (getsockname(sockt, (struct sockaddr *)&my_addr, &length) == -1)
	p_error("Bad address for socket");
}
开发者ID:catufunwa,项目名称:4.4BSD-Lite,代码行数:15,代码来源:ctl.c

示例9: write

/** Trade edit characters with the other talk. By agreement
 * the first three characters each talk transmits after
 * connection are the three edit characters.
 * A normal talk client uses tcgetattr() to get the chars,
 * but the daemon isn't connected to a terminal, so we can't call it.
 * We just send dummy chars, to disable control chars. */
void TalkConnection::set_edit_chars()
{
	char buf[3];
        int cc;
        buf[0] = buf[1] = buf[2] = (char)0xff;
        /* Write our config to the caller */
	cc = write(sockt, buf, sizeof(buf));
	if (cc != sizeof(buf) )
		p_error("Lost the connection");
        /* Read the caller configuration */
	cc = read(sockt, buf, sizeof(buf));
	if (cc != sizeof(buf) )
		p_error("Lost the connection");
	char_erase = buf[0]; // store it in TalkConnection
}
开发者ID:serghei,项目名称:kde3-kdenetwork,代码行数:21,代码来源:talkconn.cpp

示例10: longitude

/* Lambert Azimuthal Equal Area forward equations--mapping lat,long to x,y
  -----------------------------------------------------------------------*/
long lamazfor
(
    double lon,			/* (I) Longitude */
    double lat,			/* (I) Latitude */
    double *x,			/* (O) X projection coordinate */
    double *y			/* (O) Y projection coordinate */
)
{
double delta_lon;	/* Delta longitude (Given longitude - center 	*/
double sin_delta_lon;	/* Sine of the delta longitude 			*/
double cos_delta_lon;	/* Cosine of the delta longitude 		*/
double sin_lat;		/* Sine of the given latitude 			*/
double cos_lat;		/* Cosine of the given latitude 		*/
double g;		/* temporary varialbe				*/
double ksp;		/* heigth above elipsiod			*/
char mess[60];

/* Forward equations
  -----------------*/
delta_lon = adjust_lon(lon - lon_center);
gctp_sincos(lat, &sin_lat, &cos_lat);
gctp_sincos(delta_lon, &sin_delta_lon, &cos_delta_lon);
g = sin_lat_o * sin_lat + cos_lat_o * cos_lat * cos_delta_lon;
if (g == -1.0) 
   {
   sprintf(mess, "Point projects to a circle of radius = %f\n", 2.0 * R);
   p_error(mess, "lamaz-forward");
   return(113);
   }
ksp = R * sqrt(2.0 / (1.0 + g));
*x = ksp * cos_lat * sin_delta_lon + false_easting;
*y = ksp * (cos_lat_o * sin_lat - sin_lat_o * cos_lat * cos_delta_lon) + 
	false_northing;
return(GCTP_OK);
}
开发者ID:Kylia669,项目名称:DiplomWork,代码行数:37,代码来源:lamazfor.c

示例11: atan

/* Function to compute the latitude angle, phi2, for the inverse of the
   Lambert Conformal Conic and Polar Stereographic projections.
----------------------------------------------------------------*/
double phi2z
(
    double eccent,		/* Spheroid eccentricity		*/
    double ts,		/* Constant value t			*/
    long *flag		/* Error flag number			*/
)
{
    double eccnth;
    double phi;
    double con;
    double dphi;
    double sinpi;
    long i;

    *flag = 0;
    eccnth = .5 * eccent;
    phi = HALF_PI - 2 * atan(ts);
    for (i = 0; i <= 15; i++)
    {
        sinpi = sin(phi);
        con = eccent * sinpi;
        dphi = HALF_PI - 2 * atan(ts *(pow(((1.0 - con)/(1.0 + con)),eccnth))) 
             - phi;
        phi += dphi; 
        if (fabs(dphi) <= .0000000001)
            return(phi);
    }
    p_error ("Convergence error","phi2z-conv");
    *flag = 002;
    return(002);
}
开发者ID:davidh-ssec,项目名称:polar2grid,代码行数:34,代码来源:cproj.c

示例12: ctl_transact

/** Look for an invitation on remote machine */
int TalkConnection::look_for_invite(int mandatory)
{
    /* Check for invitation on caller's machine */
    ctl_transact(LOOK_UP, 0);

    uint8_t answer;
    uint32_t id_num;
    getResponseItems(&answer, &id_num, &lookup_addr);

    if (!mandatory) return 0;

    /* the switch is for later options, such as multiple invitations */
    switch (answer) {

	case SUCCESS:
            new_msg.id_num = htonl(id_num);
            old_msg.id_num = htonl(id_num);
            ktalk_debug("TalkConnection::look_for_invite : got SUCCESS");
            if (lookup_addr.ta_family != AF_INET)
                p_error("Response uses invalid network address");
            return (1);

	default:
            /* there wasn't an invitation waiting for us */
            ktalk_debug("TalkConnection::look_for_invite : didn't get SUCCESS");
            return (0);
    }
}
开发者ID:serghei,项目名称:kde3-kdenetwork,代码行数:29,代码来源:talkconn.cpp

示例13: utmConversionInit

/* **************************************************************** */
long utmConversionInit(PointLla point)
{
	long zone = 0;
	double r_maj = 6378137;			// Magic Number: These are the values
	double r_min = 6356752.3142;	// needed for the UTM ellipsoid
	double scale_fact = .9996;
//	long val;
	
	if(point->longitudeRadians > PI || point->longitudeRadians < -PI)
	{
		p_error("Invalid Seed Point for UTM Init. Check Radians??","");
		return(-1);
	}

	zone = calc_utm_zone(point->longitudeRadians*R2D);

	// Check if the zone is different than what was done before
	if(zone != utmLibZone)
	{		
		if(utmforint(r_maj, r_min, scale_fact, zone) != OK) return -1;
		if(utminvint(r_maj, r_min, scale_fact, zone) != OK) return -1;
		
		utmLibInitFlag = 1;
		utmLibZone = zone;
		return OK;
	}
	else
	{
		// Zone is the same, no need to re-init
		return OK;
	}
}
开发者ID:OpenJAUS,项目名称:openjaus,代码行数:33,代码来源:utmLib.c

示例14: p_error

// Sinusoidal inverse equations--mapping x,y to lat,long 
long Projectoid::sininv(
double x,               // (I) X projection coordinate
double y,               // (I) Y projection coordinate
double *lon,            // (O) Longitude
double *lat)            // (O) Latitude
{
double temp;            // Re-used temporary variable

// Inverse equations
x -= false_easting;
y -= false_northing;
*lat = y / R;
if (fabs(*lat) > HALF_PI) 
	{
	p_error("Input data error", "sinusoidal-inverse");
	return(164);
	}
temp = fabs(*lat) - HALF_PI;
if (fabs(temp) > EPSLN)
	{
	temp = lon_center + x / (R * cos(*lat));
	*lon = adjust_lon(temp);
	}
else
	*lon = lon_center;

return(OK);

}
开发者ID:AlphaPixel,项目名称:3DNature,代码行数:30,代码来源:sininv.cpp

示例15: is_dir

int is_dir(char *url)
{
	struct stat st;
	if(stat(url,&st)<0)
		p_error("error in is_dir logic error",5);
	return S_ISDIR(st.st_mode)?1:0;
}
开发者ID:ztmhsj,项目名称:webserver,代码行数:7,代码来源:server_function.c


注:本文中的p_error函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。