Exemple #1
0
int sqvalidate(char *name,FILE *sfd,FILE *ifd)
{
  struct _sqbase sqbase;
  int x,y;

  if (fread((char *)&sqbase,1,sizeof(struct _sqbase),sfd) !=
         sizeof(struct _sqbase))
  {
    printf("\asqvalidate: unable to read sqbase header\n");
    return -1;
  }
  
  divider();
  
  printf("\nGlobal data for %s:\n\n",name);

  if (!quiet)
  {
    printf("len=         %d\n",sqbase.len);
    printf("num_msg=     %ld\n", (unsigned long) sqbase.num_msg);
    printf("high_msg=    %ld", (unsigned long) sqbase.high_msg);
  }

  if (sqbase.high_msg != sqbase.num_msg)
    printf("\a (should be %ld!)", (unsigned long) sqbase.num_msg);

  if (!quiet)
  {
    printf("\n");

    printf("uid=         %ld\n", (unsigned long) sqbase.uid);
    printf("base=        %s\n",sqbase.base);
    printf("begin_frame= %#010lx\n", (unsigned long) sqbase.begin_frame);
    printf("last_frame=  %#010lx\n", (unsigned long) sqbase.last_frame);
    printf("last_free_fr=%#010lx\n", (unsigned long) sqbase.last_free_frame);
    printf("free_frame=  %#010lx\n", (unsigned long) sqbase.free_frame);
    printf("end_frame=   %#010lx\n", (unsigned long) sqbase.end_frame);
    printf("sz_sqhdr=    %d\n",sqbase.sz_sqhdr);
/*  printf("sz_sqidx=    %d\n",sqbase.sz_sqidx);*/
    printf("max_msg=     %ld\n", (unsigned long) sqbase.max_msg);
    printf("skip_msg=    %ld\n", (unsigned long) sqbase.skip_msg);
    printf("keep_days=   %u\n", sqbase.keep_days);
    printf("high_water=  %ld\n\n", (unsigned long) sqbase.high_water);
  }

  divider();
  
  x=debug_chain(name, sfd, ifd,  &sqbase, sqbase.begin_frame,
                sqbase.last_frame, "message", &sqbase, (int)sqbase.num_msg,
                FALSE);

  y=debug_chain(name, sfd, NULL, &sqbase, sqbase.free_frame,
                sqbase.last_free_frame, "free", NULL, -1,
                TRUE);

  return ((x || y) ? 1 : 0);
}
Exemple #2
0
int main(void) {
    puts("0");
    for (int i = 1; i <= 100; i++) {
        if (divider(i, 5) && divider(i, 3))
            puts("FizzBuzz");
        else if (divider(i, 5))
            puts("Buzz");
        else if (divider(i, 3))
            puts("Fizz");
        else
            printf("%d\n", i);
    }
    return 0;
}
void ContentUI::setPanelDisplayingPath(const QString &name, EPath path, EPanels panel)
{
    QLabel* label = getPanelLabel(panel);
    QString pathDividerSign(QDir::toNativeSeparators("/"));
    int labelTextlength = label->text().length();
    int discStrLength = getDiscLength(panel);

    switch(path)
    {
    case EForward:
    {
        QString divider((labelTextlength == discStrLength) ? "" : pathDividerSign);
        label->setText(label->text() += (divider + name));
    }
        break;
    case EBackward:
    {
        int pos = label->text().lastIndexOf(pathDividerSign);
        int removeCount = labelTextlength - (pos + 1) + 1;

        if(pos == (discStrLength - 1)) ++pos;

        label->setText(label->text().remove(pos,  removeCount));
    }
        break;
    }
}
void GUI::draw(sf::RenderTarget& target, sf::RenderStates states) const
{
    target.draw(m_Player1, states);
    target.draw(m_Player2, states);

    sf::VertexArray divider(sf::Lines, 2);
    divider[0] = sf::Vertex(sf::Vector2f(Constant::windowWidth - (Constant::windowWidth - Constant::windowHeight),
                                        Constant::windowHeight / 2),
                                        sf::Color(200, 200, 200));
    divider[1] = sf::Vertex(sf::Vector2f(Constant::windowWidth,
                                        Constant::windowHeight / 2),
                                        sf::Color(200, 200, 200));
    target.draw(divider, states);
}
Exemple #5
0
int main()
{
    int x, i;
    scanf("%d", &x);
    for (i = 2; i <= x; i++)
    {
        if (divider(i) == 0)
        {
            printf("%d ", i);
        }
    }
    system("pause");
    return 0;
}
Exemple #6
0
void  divider(int n)
{
 if (n==1)
 {
  a[0][0]=1;
  return;
 }
 else
 {
      divider(n/2);
   int m=n/2;
   for(int i=0;i<m;i++)
    for(int j=0;j<m;j++)
    {
     a[i][j+m]=a[i][j]+m;
     a[i+m][j]=a[i][j+m];
     a[i+m][j+m]=a[i][j];
    }
 }
}
Exemple #7
0
int main(int argc, char* argv[])
{
	int i = 1;
	int file = 0;
	if(argc == 1)
	{
		std_input();
	}
	else
	{
		while(argc > i) 
		{
			if(argc >= 3)
			{
				if((divider(argc, argv[i])) < 0)
				{
					return -1;
				}
			}
			if ((argv[i])[0] == 45 && strlen(argv[i]) == 1)  // Checking if the argument is a "-"
			{
				std_input();
			}
			else
			{
				if ((file = opener(argv[i])) >= 0)
				{
					read_and_output(file);
				}
			}
			i = i + 1;
		}
	}
	
	return 0;
}
/* This test should be used to verify the TRE modifications work.
 * It probably should not be added to a core canon of tests, but
 * it is useful to test any changes with the TRE API
 */
int main(int argc, char **argv)
{
    try
    {
        std::string divider(
            "---------------------------------------------------------");

        //create an ACFTA TRE
        nitf::TRE tre("ACFTA");
        //tre.print(); //print it
        std::cout << divider << std::endl;

        //set a field
        tre.setField("AC_MSN_ID", "fly-by");
        //tre.print();
        std::cout << divider << std::endl;

        //re-set the field
        tre.setField("AC_MSN_ID", 1.2345678);
        //tre.print();
        std::cout << divider << std::endl;

        //try setting an invalid tag
        try
        {
            tre.setField("invalid-tag", "some data");
        }
        catch (except::Throwable & t)
        {
            std::cout << t.getMessage() << std::endl;
        }

        // Now, try to create a SANE TRE
        tre = nitf::TRE("JITCID");
        tre.setField("FILCMT", "fyi");
        //tre.print();
        std::cout << divider << std::endl;

        //is sane?
        //std::cout << "Is Sane? " << (tre.isSane() ? "yes" : "no") << std::endl;

        // try cloning the tre
        nitf::TRE dolly = tre.clone();
        //dolly.print();
        std::cout << divider << std::endl;

        //the two should NOT be equal -- underlying object is different
        std::cout << "Equal? : " << (tre == dolly ? "yes" : "no") << std::endl;

        //is dolly sane?
        //std::cout << "Is Sane? " << (dolly.isSane() ? "yes" : "no") << std::endl;


        //let's try getting the TREDescriptions ourselves

        /*        nitf::TREDescriptionInfo *infoPtr = NULL;
                nitf::TREDescriptionSet *descriptions =
                    nitf::TRE::getTREDescriptionSet("ACFTA");
                int numDescriptions = 0;
                infoPtr = descriptions->descriptions;
                while (infoPtr && (infoPtr->description != NULL))
                {
                    numDescriptions++;
                    infoPtr++;
                }
                std::cout << "Found " << numDescriptions << " descriptions for ACFTA" << std::endl;

                infoPtr = descriptions->descriptions;
                while (infoPtr && (infoPtr->description != NULL))
                {
                    std::cout << "Name: " << infoPtr->name << ", Length: " <<
                        infoPtr->lengthMatch << std::endl << divider << std::endl;
                    tre = nitf::TRE("ACFTA", infoPtr->description);
                    tre.print();
                    std::cout << divider << std::endl;
                    infoPtr++;
                }
        */
    }
    catch (except::Throwable & t)
    {
        std::cout << t.getMessage() << std::endl;
    }
    return 0;
}
Exemple #9
0
void print_info(const struct Map_info *Map)
{
    int i;
    char line[100];
    char tmp1[100], tmp2[100];

    struct bound_box box;
    
    divider('+');
    if (Vect_maptype(Map) & (GV_FORMAT_OGR | GV_FORMAT_OGR_DIRECT)) {
	/* for OGR format print also datasource and layer */
	sprintf(line, "%-17s%s", _("OGR layer:"),
		Vect_get_ogr_layer_name(Map));
	printline(line);
	sprintf(line, "%-17s%s", _("OGR datasource:"),
		Vect_get_ogr_dsn_name(Map));
	printline(line);
    }
    else {
	sprintf(line, "%-17s%s", _("Name:"),
		Vect_get_name(Map));
	printline(line);
	sprintf(line, "%-17s%s", _("Mapset:"),
		Vect_get_mapset(Map));
	printline(line);
    }

    sprintf(line, "%-17s%s", _("Location:"),
	    G_location());
    printline(line);
    sprintf(line, "%-17s%s", _("Database:"),
	    G_gisdbase());
    printline(line);
    sprintf(line, "%-17s%s", _("Title:"),
	    Vect_get_map_name(Map));
    printline(line);
    sprintf(line, "%-17s1:%d", _("Map scale:"),
	    Vect_get_scale(Map));
    printline(line);
    
    if (Vect_maptype(Map) & (GV_FORMAT_OGR | GV_FORMAT_OGR_DIRECT)) {
	sprintf(line, "%-17s%s (%s)", _("Map format:"),
		Vect_maptype_info(Map), Vect_get_ogr_format_info(Map));
    }
    else {
	sprintf(line, "%-17s%s", _("Map format:"),
		Vect_maptype_info(Map));
    }
    
    printline(line);
    sprintf(line, "%-17s%s", _("Name of creator:"),
	    Vect_get_person(Map));
    printline(line);
    sprintf(line, "%-17s%s", _("Organization:"),
	    Vect_get_organization(Map));
    printline(line);
    sprintf(line, "%-17s%s", _("Source date:"),
	    Vect_get_map_date(Map));
    printline(line);
    
    divider('|');
    
    sprintf(line, "  %s: %s (%s: %i)",
	    _("Type of map"), _("vector"), _("level"), Vect_level(Map));
    
    printline(line);
    
    if (Vect_level(Map) > 0) {
	printline("");
	sprintf(line,
		"  %-24s%-9d       %-22s%-9d",
		_("Number of points:"), 
		Vect_get_num_primitives(Map, GV_POINT),
		_("Number of centroids:"),
		Vect_get_num_primitives(Map, GV_CENTROID));
	printline(line);
	sprintf(line,
		"  %-24s%-9d       %-22s%-9d",
		_("Number of lines:"),
		Vect_get_num_primitives(Map, GV_LINE),
		_("Number of boundaries:"),
		Vect_get_num_primitives(Map, GV_BOUNDARY));
	printline(line);
	sprintf(line,
		"  %-24s%-9d       %-22s%-9d",
		_("Number of areas:"),
		Vect_get_num_areas(Map),
		_("Number of islands:"),
		Vect_get_num_islands(Map));
	printline(line);
	if (Vect_is_3d(Map)) {
	    sprintf(line,
		    "  %-24s%-9d       %-22s%-9d",
		    _("Number of faces:"),
		    Vect_get_num_primitives(Map, GV_FACE),
		    _("Number of kernels:"),
		    Vect_get_num_primitives(Map, GV_KERNEL));
	    printline(line);
	    sprintf(line,
		    "  %-24s%-9d       %-22s%-9d",
		    _("Number of volumes:"),
		    Vect_get_num_volumes(Map),
		    _("Number of holes:"),
		    Vect_get_num_holes(Map));
	    printline(line);
	}
	printline("");
	
	sprintf(line, "  %-24s%s",
		_("Map is 3D:"),
		Vect_is_3d(Map) ? _("Yes") : _("No"));
	printline(line);
	sprintf(line, "  %-24s%-9d",
		_("Number of dblinks:"),
		Vect_get_num_dblinks(Map));
	printline(line);
    }
    
    printline("");
    /* this differs from r.info in that proj info IS taken from the map here, not the location settings */
    /* Vect_get_proj_name() and _zone() are typically unset?! */
    if (G_projection() == PROJECTION_UTM)
	sprintf(line, "  %s: %s (%s %d)",
		_("Projection:"),
		Vect_get_proj_name(Map),
		_("zone"), Vect_get_zone(Map));
    else
	sprintf(line, "  %s: %s",
		_("Projection"),
		Vect_get_proj_name(Map));
    
    printline(line);
    printline("");
    
    Vect_get_map_box(Map, &box);
    
    G_format_northing(box.N, tmp1, G_projection());
    G_format_northing(box.S, tmp2, G_projection());
    sprintf(line, "              %c: %17s    %c: %17s",
	    'N', tmp1, 'S', tmp2);
    printline(line);
    
    G_format_easting(box.E, tmp1, G_projection());
    G_format_easting(box.W, tmp2, G_projection());
    sprintf(line, "              %c: %17s    %c: %17s",
	    'E', tmp1, 'W', tmp2);
    printline(line);
    
    if (Vect_is_3d(Map)) {
	format_double(box.B, tmp1);
	format_double(box.T, tmp2);
	sprintf(line, "              %c: %17s    %c: %17s",
		'B', tmp1, 'T', tmp2);
	printline(line);
    }
    printline("");

    format_double(Vect_get_thresh(Map), tmp1);
    sprintf(line, "  %s: %s", _("Digitization threshold"), tmp1);
    printline(line);
    sprintf(line, "  %s:", _("Comment"));
    printline(line);
    sprintf(line, "    %s", Vect_get_comment(Map));
    printline(line);
    divider('+');
    fprintf(stdout, "\n");
}
Exemple #10
0
void print_info(const struct Map_info *Map)
{
    int i, map_type;
    char line[1024];
    char timebuff[256];
    struct TimeStamp ts;
    int time_ok, first_time_ok, second_time_ok;
    struct bound_box box;
    char tmp1[1024], tmp2[1024];
    
    time_ok = first_time_ok = second_time_ok = FALSE;
    map_type = Vect_maptype(Map);
    
    /* Check the Timestamp */
    time_ok = G_read_vector_timestamp(Vect_get_name(Map), NULL, "", &ts);

    /* Check for valid entries, show none if no timestamp available */
    if (time_ok == TRUE) {
        if (ts.count > 0)
            first_time_ok = TRUE;
        if (ts.count > 1)
            second_time_ok = TRUE;
    }

    divider('+');
    sprintf(line, "%-17s%s", _("Name:"),
            Vect_get_name(Map));
    printline(line);
    sprintf(line, "%-17s%s", _("Mapset:"),
            Vect_get_mapset(Map));
    printline(line);
    
    sprintf(line, "%-17s%s", _("Location:"),
            G_location());
    printline(line);
    sprintf(line, "%-17s%s", _("Database:"),
            G_gisdbase());
    printline(line);

    sprintf(line, "%-17s%s", _("Title:"),
            Vect_get_map_name(Map));
    printline(line);
    sprintf(line, "%-17s1:%d", _("Map scale:"),
            Vect_get_scale(Map));
    printline(line);

    sprintf(line, "%-17s%s", _("Name of creator:"),
            Vect_get_person(Map));
    printline(line);
    sprintf(line, "%-17s%s", _("Organization:"),
            Vect_get_organization(Map));
    printline(line);
    sprintf(line, "%-17s%s", _("Source date:"),
            Vect_get_map_date(Map));
    printline(line);

    /* This shows the TimeStamp (if present) */
    if (time_ok  == TRUE && (first_time_ok || second_time_ok)) {
        G_format_timestamp(&ts, timebuff);
        sprintf(line, "%-17s%s", _("Timestamp (first layer): "), timebuff);
        printline(line);
    }
    else {
        strcpy(line, _("Timestamp (first layer): none"));
        printline(line);
    }
    
    divider('|');
    
    if (map_type == GV_FORMAT_OGR ||
        map_type == GV_FORMAT_OGR_DIRECT) {
        sprintf(line, "%-17s%s (%s)", _("Map format:"),
                Vect_maptype_info(Map), Vect_get_finfo_format_info(Map));
        printline(line);
        
        /* for OGR format print also datasource and layer */
        sprintf(line, "%-17s%s", _("OGR layer:"),
                Vect_get_finfo_layer_name(Map));
        printline(line);
        sprintf(line, "%-17s%s", _("OGR datasource:"),
                Vect_get_finfo_dsn_name(Map));
        printline(line);
        sprintf(line, "%-17s%s", _("Feature type:"),
                Vect_get_finfo_geometry_type(Map));
        printline(line);
    }
    else if (map_type == GV_FORMAT_POSTGIS) {
        int topo_format;
        char *toposchema_name, *topogeom_column;
        int topo_geo_only;

        const struct Format_info *finfo;

        finfo = Vect_get_finfo(Map);
        
        sprintf(line, "%-17s%s (%s)", _("Map format:"),
                Vect_maptype_info(Map), Vect_get_finfo_format_info(Map));
        printline(line);
        
        /* for PostGIS format print also datasource and layer */
        sprintf(line, "%-17s%s", _("DB table:"),
                Vect_get_finfo_layer_name(Map));
        printline(line);
        sprintf(line, "%-17s%s", _("DB name:"),
                Vect_get_finfo_dsn_name(Map));
        printline(line);

        sprintf(line, "%-17s%s", _("Geometry column:"),
                finfo->pg.geom_column);
        printline(line);

        sprintf(line, "%-17s%s", _("Feature type:"),
                Vect_get_finfo_geometry_type(Map));
        printline(line);


        
        topo_format = Vect_get_finfo_topology_info(Map,
                                                   &toposchema_name, &topogeom_column,
                                                   &topo_geo_only);
        if (topo_format == GV_TOPO_POSTGIS) {
            sprintf(line, "%-17s%s (%s %s%s)", _("Topology:"), "PostGIS",
                    _("schema:"), toposchema_name,
                    topo_geo_only ? ", topo-geo-only: yes" : "");
            printline(line);

            sprintf(line, "%-17s%s", _("Topology column:"),
                    topogeom_column);
        }
        else
            sprintf(line, "%-17s%s", _("Topology:"), "pseudo (simple features)");
        
        printline(line);
    }
    else {
        sprintf(line, "%-17s%s", _("Map format:"),
                Vect_maptype_info(Map));
        printline(line);
    }
    

    divider('|');
    
    sprintf(line, "  %s: %s (%s: %i)",
            _("Type of map"), _("vector"), _("level"), Vect_level(Map));
    printline(line);
    
    if (Vect_level(Map) > 0) {
        printline("");
        sprintf(line,
                "  %-24s%-9d       %-22s%-9d",
                _("Number of points:"), 
                Vect_get_num_primitives(Map, GV_POINT),
                _("Number of centroids:"),
                Vect_get_num_primitives(Map, GV_CENTROID));
        printline(line);
        sprintf(line,
                "  %-24s%-9d       %-22s%-9d",
                _("Number of lines:"),
                Vect_get_num_primitives(Map, GV_LINE),
                _("Number of boundaries:"),
                Vect_get_num_primitives(Map, GV_BOUNDARY));
        printline(line);
        sprintf(line,
                "  %-24s%-9d       %-22s%-9d",
                _("Number of areas:"),
                Vect_get_num_areas(Map),
                _("Number of islands:"),
                Vect_get_num_islands(Map));
        printline(line);
        if (Vect_is_3d(Map)) {
            sprintf(line,
                    "  %-24s%-9d       %-22s%-9d",
                    _("Number of faces:"),
                    Vect_get_num_primitives(Map, GV_FACE),
                    _("Number of kernels:"),
                    Vect_get_num_primitives(Map, GV_KERNEL));
            printline(line);
            sprintf(line,
                    "  %-24s%-9d       %-22s%-9d",
                    _("Number of volumes:"),
                    Vect_get_num_volumes(Map),
                    _("Number of holes:"),
                    Vect_get_num_holes(Map));
            printline(line);
        }
        printline("");

        sprintf(line, "  %-24s%s",
                _("Map is 3D:"),
                Vect_is_3d(Map) ? _("Yes") : _("No"));
        printline(line);
        sprintf(line, "  %-24s%-9d",
                _("Number of dblinks:"),
                Vect_get_num_dblinks(Map));
        printline(line);
    }

    printline("");
    /* this differs from r.info in that proj info IS taken from the map here, not the location settings */
    /* Vect_get_proj_name() and _zone() are typically unset?! */
    if (G_projection() == PROJECTION_UTM) {
        int utm_zone;

        utm_zone = Vect_get_zone(Map);
        if (utm_zone < 0 || utm_zone > 60)
            strcpy(tmp1, _("invalid"));
        else if (utm_zone == 0)
            strcpy(tmp1, _("unspecified"));
        else
            sprintf(tmp1, "%d", utm_zone);

        sprintf(line, "  %s: %s (%s %s)",
                _("Projection"), Vect_get_proj_name(Map),
                _("zone"), tmp1);
    }
    else
        sprintf(line, "  %s: %s",
                _("Projection"), Vect_get_proj_name(Map));

    printline(line);
    printline("");

    Vect_get_map_box(Map, &box);

    G_format_northing(box.N, tmp1, G_projection());
    G_format_northing(box.S, tmp2, G_projection());
    sprintf(line, "              %c: %17s    %c: %17s",
            'N', tmp1, 'S', tmp2);
    printline(line);
    
    G_format_easting(box.E, tmp1, G_projection());
    G_format_easting(box.W, tmp2, G_projection());
    sprintf(line, "              %c: %17s    %c: %17s",
            'E', tmp1, 'W', tmp2);
    printline(line);
    
    if (Vect_is_3d(Map)) {
        format_double(box.B, tmp1);
        format_double(box.T, tmp2);
        sprintf(line, "              %c: %17s    %c: %17s",
                'B', tmp1, 'T', tmp2);
        printline(line);
    }
    printline("");

    format_double(Vect_get_thresh(Map), tmp1);
    sprintf(line, "  %s: %s", _("Digitization threshold"), tmp1);
    printline(line);
    sprintf(line, "  %s:", _("Comment"));
    printline(line);
    sprintf(line, "    %s", Vect_get_comment(Map));
    printline(line);
    divider('+');
    fprintf(stdout, "\n");
}
Exemple #11
0
int debug_chain(char *name, FILE *sfd, FILE *ifd, struct _sqbase *sqbase,
                FOFS new_frame, FOFS last_frame, char *type,
                struct _sqbase *sqb, int num_msg, int fFreeFrame)
{
  SQIDX idx;
  SQHDR lframe;
  SQHDR frame;
  FOFS lframeofs;
  long filesize;
  int goterr=FALSE;
  int haderr=FALSE;
  int msgnum=0;
  word count;

  NW(ifd);


  if (new_frame==NULL_FRAME)
  {
    if (!quiet)
      printf("The %s list is empty.\n",type);
  }
  else
  {
    lframe.next_frame=new_frame;
    lframeofs=NULL_FRAME;

    fseek(sfd,0L,SEEK_END);
    filesize=ftell(sfd);

    count=0;

    for (;;)
    {
      if (!quiet)
        printf("\n");

      if (!findbug)
        printf("%s frame at %#010lx: (#%u)\n", type, (unsigned long) new_frame, (unsigned) count+1);

      msgnum++;

      if (!quiet)
        printf("\n");

      if (new_frame==NULL_FRAME)
      {
        printf("\aerror! cannot read the NULL frame\n");
        goterr=TRUE;
      }

      if (new_frame > filesize)
      {
        printf("\aframe offset too large (file size is %#010lx)!\n", (unsigned long) filesize);
        goterr=TRUE;
      }

      fseek(sfd,new_frame,SEEK_SET);

      if (ftell(sfd) != lframe.next_frame)
      {
        printf("\aerror: incorrect forward link for prior msg, #%d\n",count-1);
        goterr=TRUE;
      }

      if (fread((char *)&frame,1,sizeof(SQHDR),sfd) != sizeof(SQHDR))
      {
        printf("\aerror reading frame at %#010lx\n", (unsigned long) new_frame);
        goterr=TRUE;
      }
      else
      {
        /************************************************************************/

        if (ifd)
        {
          fseek(ifd, count*(long)sizeof(SQIDX), SEEK_SET);

          if (ftell(ifd) != count*(long)sizeof(SQIDX))
          {
            printf("\aError seeking index file to right offset!\n");
            goterr=TRUE;
          }

          if (fread((char *)&idx, 1, sizeof(SQIDX), ifd) != sizeof(SQIDX))
          {
            printf("\aerror reading index entry at %#010lx\n", (unsigned long)
                   count*(long)sizeof(SQIDX));

            goterr=TRUE;
          }

          if (!quiet)
            printf("idxofs=       %#010lx", (unsigned long) idx.ofs);

          if (idx.ofs != new_frame)
          {
            printf("\a (should be %08lx!)\n", (unsigned long) new_frame);
            goterr=TRUE;
          }
          else if (!quiet)
            printf(" (OK)\n");

          if (!quiet)
            printf("umsgid=       %#010lx\n", (unsigned long)  idx.umsgid);
        }

        /************************************************************************/

        if (!quiet)
          printf("id=           %#010lx", (unsigned long) frame.id);

        if (frame.id==SQHDRID)
        {
          if (!quiet)
            printf(" (OK)\n");
        }
        else
        {
          printf("\a (Should be %#010lx!)\n", (unsigned long) SQHDRID);
          goterr=TRUE;
        }




        if (!quiet)
          printf("prev_frame=   %#010lx", (unsigned long) frame.prev_frame);

        if (frame.prev_frame==lframeofs)
        {
          if (!quiet)
            printf(" (OK)\n");
        }
        else
        {
          printf("\a (Should be %#010lx.)\n", (unsigned long) lframeofs);
          goterr=TRUE;
        }




        if (!quiet)
          printf("next_frame=   %#010lx", (unsigned long) frame.next_frame);

        if (new_frame >= sqbase->end_frame)
        {
          printf("\a (Should be less than end_frame [%#010lx]!)\n",
                 (unsigned long) sqbase->end_frame);
          goterr=TRUE;
        }
        else if (new_frame==frame.next_frame)
        {
          printf("\a (Circular frame reference!)\n");
          goterr=TRUE;
        }
        else if (new_frame==last_frame && frame.next_frame != NULL_FRAME)
        {
          printf("\a Last should be NULL_FRAME (0x00000000).\n");
          goterr=TRUE;
        }
        else if (frame.next_frame==NULL_FRAME && new_frame != last_frame)
        {
          printf("\a Premature link end. Chain should end at %#010lx.\n", (unsigned long) last_frame);
          goterr=TRUE;
        }
        else if (sqb && frame.next_frame==NULL_FRAME &&
                 (unsigned long)(count+1) != sqb->num_msg)
        {
          printf("\a\nErr!  Last msg is #%ld, but got chain end after %ld msgs!\n", (unsigned long) sqb->num_msg,(long)(count+1));
          goterr=TRUE;
        }
        else if (!quiet)
          printf(" (OK)\n");






        if (!quiet)
          printf("frame_length= %ld", (unsigned long) frame.frame_length);

        if (new_frame+sizeof(SQHDR)+frame.frame_length > sqbase->end_frame ||
            (frame.next_frame > new_frame &&
             new_frame+sizeof(SQHDR)+frame.frame_length > frame.next_frame))
        {
          printf("\a Too long!\n");
          goterr=TRUE;
        }
        else if (!quiet)
          printf(" (OK)\n");

        if (!quiet)
          printf("msg_length=   %ld", (unsigned long) frame.msg_length);

        if ((long)frame.msg_length < (long)sizeof(XMSG) + (long)frame.clen &&
            !fFreeFrame)
        {
          printf("\a  (Control info is too long for frame!)\n");
          goterr=TRUE;
        }
        else if (frame.msg_length > frame.frame_length)
        {
          printf("\a  (Should be <= %ld!)\n", (unsigned long)  frame.frame_length);
          goterr=TRUE;
        }
        else if (!quiet)
          printf(" (OK)\n");


        if (!quiet)
        {
          printf("clen=         %ld\n", (unsigned long) frame.clen);
          printf("type=         %s\n",frtype(frame.frame_type));
        }
      }

      if (goterr)
      {
        printf("Problem in %s.\n"
               "Press <esc> to abort, or any other key to continue: ",
               name);

        if (batch)
          exit(1);

        fflush(stdout);

        if (kgetch()=='\x1b')
          exit(1);

        printf("\n");
        goterr=FALSE;
        haderr=TRUE;
      }

      divider();

      if (new_frame==NULL_FRAME || frame.next_frame==NULL_FRAME)
        break;

      lframeofs=new_frame;
      new_frame=frame.next_frame;
      lframe=frame;
      count++;
    }
  }

  if (num_msg != -1 && msgnum != num_msg)
  {
    printf("\aError!  Expected %d msgs in chain, but only found %d\n",
           num_msg, msgnum);
    haderr=TRUE;
  }

  return (haderr ? -1 : 0);
}