gEDA-user: PCB - How To Find A Component?

DJ Delorie dj at delorie.com
Mon Feb 16 20:23:36 EST 2009


> Maybe I'm overlooking something very obvious and better should restart
> tomorrow morning after some coffee.

Close!  Elements don't always have names.  You also didn't check for
missing arguments.  Try this bit of code:


        if (argc == 0 || strcasecmp (argv[0], "") == 0)
        {
                Message ("WARNING: in FindElement the argument should be a non-empty string value.\n");
                return 0;
        }
        else
        {

                SET_FLAG (NAMEONPCBFLAG, PCB);
                ELEMENT_LOOP(PCB->Data);
                {
                        if (NAMEONPCB_NAME(element)
			    && strcmp (argv[0], NAMEONPCB_NAME(element)) == 0)
                        {



More information about the geda-user mailing list