Ignore:
Timestamp:
Sep 30, 2006, 7:04:47 PM (18 years ago)
Author:
Joe Ciccone <jciccone@…>
Branches:
clfs-1.2, clfs-2.1, clfs-3.0.0-systemd, clfs-3.0.0-sysvinit, master, systemd, sysvinit
Children:
c19067a
Parents:
bd2e5bb
Message:

Updated the wrapper.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BOOK/final-system/multilib/multiarch_wrapper.xml

    rbd2e5bb r5fb43ca  
    2929
    3030<screen os="b"><userinput>cat &gt; multiarch_wrapper.c &lt;&lt; "EOF"
    31 #include &lt;stdio.h&gt;
     31#include &lt;unistd.h&gt;
    3232#include &lt;stdlib.h&gt;
     33#include &lt;errno.h&gt;
    3334#include &lt;string.h&gt;
    34 #include &lt;errno.h&gt;
    3535
    36 #ifndef DEFAULT_ARCH
    37 # define DEFAULT_ARCH "64"
     36#ifndef DEFAULTENV
     37#define DEFAULTENV "64"
    3838#endif
    3939
    40 int main (int argc, char *argv[])
     40int main(int argc, char **argv)
    4141{
     42  char *filename;
    4243  char *use_arch;
    43   if ((use_arch = getenv("USE_ARCH")) == NULL)
    44     use_arch = DEFAULT_ARCH;
    4544
    46   char *filename = malloc(strlen(argv[0]) + strlen(use_arch) + 2);
     45  if(!(use_arch = getenv("USE_ARCH")))
     46    use_arch = DEFAULTENV;
     47
     48  filename = (char *) malloc(strlen(argv[0]) + strlen(use_arch) + 2);
    4749  strcpy(filename, argv[0]);
    4850  strcat(filename, "-");
    4951  strcat(filename, use_arch);
    5052
    51   int ret = execvp(filename, argv);
    52   if ((ret != 0)&amp;&amp;(errno != 0))
    53   {
    54     char *errmsg = malloc(strlen(filename) + 19);
    55     strcpy(errmsg, "Unable to execute ");
    56     strcat(errmsg, filename);
    57     perror(errmsg);
    58     free(errmsg);
    59   }
    60 
     53  execvp(filename, argv);
     54  perror(argv[0]);
    6155  free(filename);
    62 
    63   return ret;
    6456}
    6557EOF</userinput></screen>
Note: See TracChangeset for help on using the changeset viewer.