Include `%'-escape substitution.
[sw-tools] / src / sw.c
index 4040d91..743c426 100644 (file)
--- a/src/sw.c
+++ b/src/sw.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: sw.c,v 1.2 1999/07/16 12:50:43 mdw Exp $
+ * $Id: sw.c,v 1.3 1999/09/10 15:27:32 mdw Exp $
  *
  * Main driver code for sw-tools
  *
@@ -29,6 +29,9 @@
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: sw.c,v $
+ * Revision 1.3  1999/09/10 15:27:32  mdw
+ * Include `%'-escape substitution.
+ *
  * Revision 1.2  1999/07/16 12:50:43  mdw
  * Replace deprecated `mdwopt' flag name with new version.
  *
@@ -88,7 +91,7 @@ static cmd *cmds = CMD_LINK;
 
 const char *opt_output = 0;
 const char *opt_arch = 0;
-unsigned int opt_flags;
+unsigned int opt_flags = optFlag_percent;
 
 /*----- Helpful GNUy message routines -------------------------------------*/
 
@@ -103,7 +106,7 @@ static void version(FILE *fp)
 
 static void usage(FILE *fp)
 {
-  fprintf(fp, "Usage: %s [-fbi] [-a arch,...] [-o style] command [args]\n",
+  fprintf(fp, "Usage: %s [-fbip] [-a arch,...] [-o style] command [args]\n",
          QUIS);
 }
 
@@ -124,6 +127,7 @@ There are some options which affect a few of the available commands:\n\
 -b, --beep             Beep when the build is complete.\n\
 -i, --install          Mark architectures as done when build succeeds.\n\
 -f, --force            Run build commands on installed architectures.\n\
+-p, --percent          Enable `%'-escapes in build command arguments.\n\
 -o, --output=STYLE     Display output in a particular style.  Use style\n\
                        `help' for a list.\n\
 \n", fp);
@@ -196,7 +200,9 @@ int main(int argc, char *argv[])
       { "force",       0,              0,      'f' },
       { "install",     0,              0,      'i' },
       { "output",      OPTF_ARGREQ,    0,      'o' },
-      { "beep",                0,              0,      'b' },
+      { "beep",                OPTF_NEGATE,    0,      'b' },
+      { "percent",     OPTF_NEGATE,    0,      'p' },
+      { "escape",      OPTF_NEGATE,    0,      'p' },
 
       /* --- Internal-use-only magical options --- *
        *
@@ -210,7 +216,8 @@ int main(int argc, char *argv[])
 
       { 0,             0,              0,      0 }
     };
-    int i = mdwopt(argc, argv, "+hHvu a:bfio:", opt, 0, 0, OPTF_ENVVAR);
+    int i = mdwopt(argc, argv, "+hHvu a:b+p+fio:", opt, 0, 0,
+                  OPTF_ENVVAR | OPTF_NEGATION);
     if (i < 0)
       break;
 
@@ -242,6 +249,15 @@ int main(int argc, char *argv[])
       case 'b':
        opt_flags |= optFlag_beep;
        break;
+      case 'b' | OPTF_NEGATED:
+       opt_flags &= ~optFlag_beep;
+       break;
+      case 'p':
+       opt_flags |= optFlag_percent;
+       break;
+      case 'p' | OPTF_NEGATED:
+       opt_flags &= ~optFlag_percent;
+       break;
       case 'i':
        opt_flags |= optFlag_install;
        break;