VirtualBox

Changeset 3656 in kBuild


Ignore:
Timestamp:
Nov 4, 2024 1:56:03 AM (5 months ago)
Author:
bird
Message:

kmk/job.c: Deal with escape sequences inside double quotes when we're using kmk_ash. Simplified some windo32 special double-quote handling, some of which looks bogus. Shut up warning. Classify kmk_ash and kmk_kash as bourne shells.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/job.c

    r3655 r3656  
    442442  /* List of known POSIX (or POSIX-ish) shells.  */
    443443  static const char *unix_shells[] = {
     444#ifdef KMK
     445    "kmk_ash",
     446    "kmk_kash",
     447#endif
    444448    "sh",
    445449    "bash",
     
    17801784        for (i = 0; argv[i]; i++)
    17811785          fprintf (stderr, "%s ", argv[i]);
    1782         fprintf (stderr, "\n", argv[i]);
     1786        fprintf (stderr, "\n");
    17831787        goto error;
    17841788      }
     
    30953099             But on MSDOS, if we use COMMAND.COM, double and single
    30963100             quotes have the same effect.  */
     3101#ifdef KMK
     3102          else if (instring == '"' && unixy_shell && *p == '\\')
     3103            {
     3104              /* If kmk_ash, allow simple escape sequence: \", \\, \$, \` */
     3105              char const ch2 = p[1];
     3106              if (is_kmk_shell
     3107               && (   ch2 == '\"'
     3108                   || ch2 == '\\'
     3109                   || ch2 == '$'
     3110                   || ch2 == '`'))
     3111                *ap++ = *++p;
     3112              else
     3113                goto slow;
     3114            }
     3115          else if (instring == '"' && unixy_shell && (*p == '$' || *p == '`'))
     3116            goto slow;
     3117# ifdef WINDOWS32
     3118          /* Quoted wildcard characters must be passed quoted to the
     3119             command, so give up the fast route.  */
     3120          else if (instring == '"' && !unixy_shell && (*p == '*' || *p == '?'))
     3121            goto slow;
     3122          else if (instring == '"' && !unixy_shell && p[0] == '\\' && p[1] == '"') /* bird: this smells */
     3123            *ap++ = *++p;
     3124# endif
     3125#else /* !KMK */
    30973126          else if (instring == '"' && strchr ("\\$`", *p) != 0 && unixy_shell)
    30983127            goto slow;
     
    31053134            *ap++ = *++p;
    31063135#endif
     3136#endif /* !KMK */
    31073137          else
    31083138            *ap++ = *p;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette