Changeset 113 for trunk/src/binutils


Ignore:
Timestamp:
May 9, 2003, 11:15:46 PM (22 years ago)
Author:
bird
Message:

Initial hacking.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/binutils/binutils/objcopy.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r112 r113  
    550550  char * buffer;
    551551  unsigned int line_count;
    552  
     552
    553553  if (stat (filename, & st) < 0)
    554554    fatal (_("cannot stat: %s: %s"), filename, strerror (errno));
     
    569569
    570570  line_count = 1;
    571  
     571
    572572  for (line = buffer; * line != '\0'; line ++)
    573573    {
     
    588588              finished = true;
    589589              break;
    590              
     590       
    591591            case '\r':
    592592              * eol = '\0';
     
    596596              finished = true;
    597597              break;
    598              
     598       
    599599            case 0:
    600600              finished = true;
    601601              break;
    602              
     602       
    603603            case '#':
    604604              /* Line comment, Terminate the line here, in case a
     
    607607              * eol = '\0';
    608608              break;
    609              
     609       
    610610            default:
    611611              break;
     
    638638                       line_count, filename);
    639639        }
    640  
     640
    641641      * name_end = '\0';
    642642
     
    13461346  bfd *ibfd;
    13471347  char **matching;
     1348#ifdef __EMX__
     1349  /* Check if they're both zero so we know when to use emxbind or not. */
     1350  int  bothtargetsnull = (input_target == NULL && output_target == NULL);
     1351#endif
     1352
    13481353
    13491354  /* To allow us to do "strip *" without dying on the first
     
    13891394      if (!bfd_close (ibfd))
    13901395        RETURN_NONFATAL (input_filename);
     1396
     1397      #ifdef __EMX__
     1398      /*
     1399       * On OS/2 executables are normally pushed thru emxbind.
     1400       * So, if input and target format was both NULL and this was
     1401       * an emxbind'ed executable, then redo the emxbinding. We're
     1402       * a bit careful not to break anything therefore the NULL target
     1403       * precautions.
     1404       *
     1405       * THIS IS A HACK! It's motivation is to skip some trouble
     1406       * during GCC building.
     1407       *
     1408       * We really don't get everything right now, just get the
     1409       * "strip xgcc.exe" working good enough.
     1410       */
     1411      if (bothtargetsnull && status == 0 && !getenv("NO_STRIP_EMXBIND"))
     1412        {
     1413          FILE *child;
     1414          char szCmd[1024];
     1415          char *psz;
     1416          sprintf (szCmd, "emxbind.exe -i \"%s\" 2> nul", input_filename);
     1417          for (psz = szCmd; *psz; psz++)
     1418              if (*psz == '\\')  *psz = '/';
     1419          if ((child = popen (szCmd, "r")) != NULL)
     1420            {
     1421              if (!pclose (child))
     1422                {
     1423                  char *tmpname;
     1424                  char  tmpnameexe[260];
     1425
     1426                  tmpname = make_tempname (output_filename);
     1427                  if (!tmpname)
     1428                      RETURN_NONFATAL (input_filename);
     1429                  strcat(strcpy(tmpnameexe, tmpname), ".exe");
     1430                  free(tmpname);
     1431
     1432                  sprintf(szCmd, "emxbind.exe -bq -o \"%s\" \"%s\"", tmpnameexe, output_filename);
     1433                  for (psz = szCmd; *psz; psz++)
     1434                      if (*psz == '\\')  *psz = '/';
     1435                  if (!system (szCmd))
     1436                      smart_rename (tmpnameexe, output_filename, preserve_dates);
     1437                  unlink (tmpnameexe);
     1438                }
     1439            }
     1440        }
     1441      #endif
    13911442    }
    13921443  else
Note: See TracChangeset for help on using the changeset viewer.