Changeset 116 for trunk/src/emx


Ignore:
Timestamp:
May 10, 2003, 4:38:40 AM (22 years ago)
Author:
bird
Message:

#416: Quote filenames in link386 input.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/src/emxomf/emxomfld.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r115 r116  
    137137static void add_name_list (name_list ***add, const char *src);
    138138static void conv_path (char *name);
    139 static void put_arg (const char *src, int path);
     139static void put_arg (const char *src, int path, int quotable);
    140140static void put_args (const name_list *list, int paths);
    141141static void make_env (void);
     
    169169{
    170170  void *p;
    171  
     171
    172172  p = malloc (n);
    173173  if (p == NULL)
     
    187187{
    188188  char *p;
    189  
     189
    190190  p = xmalloc (strlen (s) + 1);
    191191  strcpy (p, s);
     
    226226   If PATH is non-zero, SRC is a path name and slashes are to be
    227227   replaced by backslashes.  If the command line gets too long, a
    228    response file is created. */
    229 
    230 static void put_arg (const char *src, int path)
     228   response file is created.
     229   If quotable is non-zero SRC will be quoted. This is required for
     230   supporting files names which includes '+' and spaces. */
     231
     232static void put_arg (const char *src, int path, int quotable)
    231233{
    232234  int len, max_len;
     
    251253
    252254      len = strlen (src);
    253       tmp = alloca (len + 1);
    254       strcpy (tmp, src);
     255      tmp = alloca (len + (quotable ? 3 : 1));
    255256      if (path)
    256         conv_path (tmp);
     257        {
     258          /* needs quoting? */
     259          if (quotable)
     260            {
     261              *tmp = '"';
     262              strcpy (tmp+1, src);
     263              tmp[++len] = '"';
     264              tmp[++len] = '\0';
     265            }
     266          else
     267            strcpy (tmp, src);
     268          conv_path (tmp);
     269        }
     270      else
     271        strcpy (tmp, src);
     272
    257273
    258274      /* Check if we've reached the maximum line length.  If the
     
    362378  while (list != NULL)
    363379    {
    364       put_arg (list->name, paths);
     380      put_arg (list->name, paths, paths);
    365381      list = list->next;
    366382    }
     
    695711  */
    696712
    697   put_arg (linker_name, TRUE);
     713  put_arg (linker_name, TRUE, FALSE);
    698714
    699715  /* If the linker is ILINK, don't use the /BAT{CH} option */
    700716  t = _getname (linker_name);
    701717  if (strnicmp (t, "ILINK", 5))
    702   put_arg ("/bat", FALSE);
     718    put_arg ("/bat", FALSE, FALSE);
    703719  else
    704     put_arg ("/nofree", FALSE);
    705   put_arg ("/nol", FALSE);
    706   put_arg ("/noe", FALSE);
    707   put_arg ("/noi", FALSE);
    708   put_arg ("/packc", FALSE);
     720    put_arg ("/nofree", FALSE, FALSE);
     721  put_arg ("/nol", FALSE, FALSE);
     722  put_arg ("/noe", FALSE, FALSE);
     723  put_arg ("/noi", FALSE, FALSE);
     724  put_arg ("/packc", FALSE, FALSE);
    709725
    710726  /* Add the /INFORMATION option if the -i option was given.  This is
     
    712728
    713729  if (opt_i)
    714     put_arg ("/i", FALSE);
     730    put_arg ("/i", FALSE, FALSE);
    715731
    716732  /* Add the /DEBUG option if the -s option was not given.  Without
     
    718734
    719735  if (!strip_symbols)
    720     put_arg ("/de", FALSE);
     736    put_arg ("/de", FALSE, FALSE);
    721737
    722738  /* Add the /BASE:n option to set the base address.  This specifies
     
    747763    {
    748764      sprintf (tmp, "/bas:%s", base);
    749       put_arg (tmp, FALSE);
     765      put_arg (tmp, FALSE, FALSE);
    750766    }
    751767
     
    755771    {
    756772      sprintf (tmp, "/st:0x%lx", stack_size * 1024);
    757       put_arg (tmp, FALSE);
     773      put_arg (tmp, FALSE, FALSE);
    758774    }
    759775
     
    765781
    766782  put_args (obj_fnames, TRUE);
    767   put_arg (",", FALSE);
     783  put_arg (",", FALSE, FALSE);
    768784
    769785  /* Put the output file name onto the command line. */
    770786
    771   put_arg (output_fname, TRUE);
    772   put_arg (",", FALSE);
     787  put_arg (output_fname, TRUE, TRUE);
     788  put_arg (",", FALSE, FALSE);
    773789
    774790  /* Put the map file name onto the command line. */
    775791
    776   put_arg (map_fname, TRUE);
    777   put_arg (",", FALSE);
     792  put_arg (map_fname, TRUE, TRUE);
     793  put_arg (",", FALSE, FALSE);
    778794
    779795  /* Put the library file names onto the command line. */
    780796
    781797  put_args (lib_fnames, TRUE);
    782   put_arg (",", FALSE);
     798  put_arg (",", FALSE, FALSE);
    783799
    784800  /* Put the name of the module definition file onto the command line. */
    785801
    786   put_arg (def_fname, TRUE);
    787   put_arg (";", FALSE);
     802  put_arg (def_fname, TRUE, TRUE);
     803  put_arg (";", FALSE, FALSE);
    788804  arg_end ();
    789805
     
    811827    {
    812828      arg_init (TRUE);
    813       put_arg ("rc -n", TRUE);
    814       put_arg (res_fname, TRUE);
    815       put_arg (output_fname, TRUE);
     829      put_arg ("rc", TRUE, FALSE);
     830      put_arg ("-n", FALSE, FALSE);
     831      put_arg (res_fname, TRUE, TRUE);
     832      put_arg (output_fname, TRUE, TRUE);
    816833      arg_end ();
    817834      rc = system (command_line);
Note: See TracChangeset for help on using the changeset viewer.