Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make make(1): indent compat.c with tabs instead of s...



details:   https://anonhg.NetBSD.org/src/rev/f6e19e95bb19
branches:  trunk
changeset: 957298:f6e19e95bb19
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Nov 23 19:35:10 2020 +0000

description:
make(1): indent compat.c with tabs instead of spaces

diffstat:

 usr.bin/make/compat.c |  663 +++++++++++++++++++++++++------------------------
 1 files changed, 337 insertions(+), 326 deletions(-)

diffs (truncated from 785 to 300 lines):

diff -r 511e29df39da -r f6e19e95bb19 usr.bin/make/compat.c
--- a/usr.bin/make/compat.c     Mon Nov 23 19:27:20 2020 +0000
+++ b/usr.bin/make/compat.c     Mon Nov 23 19:35:10 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat.c,v 1.185 2020/11/23 19:27:20 rillig Exp $      */
+/*     $NetBSD: compat.c,v 1.186 2020/11/23 19:35:10 rillig Exp $      */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -96,7 +96,7 @@
 #include "pathnames.h"
 
 /*     "@(#)compat.c   8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: compat.c,v 1.185 2020/11/23 19:27:20 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.186 2020/11/23 19:35:10 rillig Exp $");
 
 static GNode *curTarg = NULL;
 static pid_t compatChild;
@@ -109,13 +109,13 @@
 static void
 CompatDeleteTarget(GNode *gn)
 {
-    if (gn != NULL && !Targ_Precious(gn)) {
-       const char *file = GNode_VarTarget(gn);
+       if (gn != NULL && !Targ_Precious(gn)) {
+               const char *file = GNode_VarTarget(gn);
 
-       if (!opts.noExecute && eunlink(file) != -1) {
-           Error("*** %s removed", file);
+               if (!opts.noExecute && eunlink(file) != -1) {
+                       Error("*** %s removed", file);
+               }
        }
-    }
 }
 
 /* Interrupt the creation of the current target and remove it if it ain't
@@ -129,34 +129,34 @@
 static void
 CompatInterrupt(int signo)
 {
-    CompatDeleteTarget(curTarg);
+       CompatDeleteTarget(curTarg);
 
-    if (curTarg != NULL && !Targ_Precious(curTarg)) {
-       /*
-        * Run .INTERRUPT only if hit with interrupt signal
-        */
-       if (signo == SIGINT) {
-           GNode *gn = Targ_FindNode(".INTERRUPT");
-           if (gn != NULL) {
-               Compat_Make(gn, gn);
-           }
+       if (curTarg != NULL && !Targ_Precious(curTarg)) {
+               /*
+                * Run .INTERRUPT only if hit with interrupt signal
+                */
+               if (signo == SIGINT) {
+                       GNode *gn = Targ_FindNode(".INTERRUPT");
+                       if (gn != NULL) {
+                               Compat_Make(gn, gn);
+                       }
+               }
        }
-    }
 
-    if (signo == SIGQUIT)
-       _exit(signo);
+       if (signo == SIGQUIT)
+               _exit(signo);
 
-    /*
-     * If there is a child running, pass the signal on.
-     * We will exist after it has exited.
-     */
-    compatSigno = signo;
-    if (compatChild > 0) {
-       KILLPG(compatChild, signo);
-    } else {
-       bmake_signal(signo, SIG_DFL);
-       kill(myPid, signo);
-    }
+       /*
+        * If there is a child running, pass the signal on.
+        * We will exist after it has exited.
+        */
+       compatSigno = signo;
+       if (compatChild > 0) {
+               KILLPG(compatChild, signo);
+       } else {
+               bmake_signal(signo, SIG_DFL);
+               kill(myPid, signo);
+       }
 }
 
 static void
@@ -193,272 +193,278 @@
 int
 Compat_RunCommand(const char *cmdp, GNode *gn)
 {
-    char *cmdStart;            /* Start of expanded command */
-    char *bp;
-    Boolean silent;            /* Don't print command */
-    Boolean doIt;              /* Execute even if -n */
-    volatile Boolean errCheck; /* Check errors */
-    int reason;                        /* Reason for child's death */
-    int status;                        /* Description of child's death */
-    pid_t cpid;                        /* Child actually found */
-    pid_t retstat;             /* Result of wait */
-    StringListNode *cmdNode;   /* Node where current command is located */
-    const char **volatile av;  /* Argument vector for thing to exec */
-    char **volatile mav;       /* Copy of the argument vector for freeing */
-    Boolean useShell;          /* TRUE if command should be executed
+       char *cmdStart;         /* Start of expanded command */
+       char *bp;
+       Boolean silent;         /* Don't print command */
+       Boolean doIt;           /* Execute even if -n */
+       volatile Boolean errCheck; /* Check errors */
+       int reason;             /* Reason for child's death */
+       int status;             /* Description of child's death */
+       pid_t cpid;             /* Child actually found */
+       pid_t retstat;          /* Result of wait */
+       StringListNode *cmdNode; /* Node where current command is located */
+       const char **volatile av; /* Argument vector for thing to exec */
+       char **volatile mav;    /* Copy of the argument vector for freeing */
+       Boolean useShell;       /* TRUE if command should be executed
                                 * using a shell */
-    const char *volatile cmd = cmdp;
+       const char *volatile cmd = cmdp;
 
-    silent = (gn->type & OP_SILENT) != 0;
-    errCheck = !(gn->type & OP_IGNORE);
-    doIt = FALSE;
+       silent = (gn->type & OP_SILENT) != 0;
+       errCheck = !(gn->type & OP_IGNORE);
+       doIt = FALSE;
 
-    /* Luckily the commands don't end up in a string pool, otherwise
-     * this comparison could match too early, in a dependency using "..."
-     * for delayed commands, run in parallel mode, using the same shell
-     * command line more than once; see JobPrintCommand.
-     * TODO: write a unit-test to protect against this potential bug. */
-    cmdNode = Lst_FindDatum(gn->commands, cmd);
-    (void)Var_Subst(cmd, gn, VARE_WANTRES, &cmdStart);
-    /* TODO: handle errors */
+       /* Luckily the commands don't end up in a string pool, otherwise
+        * this comparison could match too early, in a dependency using "..."
+        * for delayed commands, run in parallel mode, using the same shell
+        * command line more than once; see JobPrintCommand.
+        * TODO: write a unit-test to protect against this potential bug. */
+       cmdNode = Lst_FindDatum(gn->commands, cmd);
+       (void)Var_Subst(cmd, gn, VARE_WANTRES, &cmdStart);
+       /* TODO: handle errors */
 
-    if (cmdStart[0] == '\0') {
-       free(cmdStart);
-       return 0;
-    }
-    cmd = cmdStart;
-    LstNode_Set(cmdNode, cmdStart);
+       if (cmdStart[0] == '\0') {
+               free(cmdStart);
+               return 0;
+       }
+       cmd = cmdStart;
+       LstNode_Set(cmdNode, cmdStart);
 
-    if (gn->type & OP_SAVE_CMDS) {
-       GNode *endNode = Targ_GetEndNode();
-       if (gn != endNode) {
-           Lst_Append(endNode->commands, cmdStart);
-           return 0;
+       if (gn->type & OP_SAVE_CMDS) {
+               GNode *endNode = Targ_GetEndNode();
+               if (gn != endNode) {
+                       Lst_Append(endNode->commands, cmdStart);
+                       return 0;
+               }
        }
-    }
-    if (strcmp(cmdStart, "...") == 0) {
-       gn->type |= OP_SAVE_CMDS;
-       return 0;
-    }
+       if (strcmp(cmdStart, "...") == 0) {
+               gn->type |= OP_SAVE_CMDS;
+               return 0;
+       }
 
-    for (;;) {
-       if (*cmd == '@')
-           silent = !DEBUG(LOUD);
-       else if (*cmd == '-')
-           errCheck = FALSE;
-       else if (*cmd == '+') {
-           doIt = TRUE;
-           if (!shellName)     /* we came here from jobs */
-               Shell_Init();
-       } else
-           break;
-       cmd++;
-    }
+       for (;;) {
+               if (*cmd == '@')
+                       silent = !DEBUG(LOUD);
+               else if (*cmd == '-')
+                       errCheck = FALSE;
+               else if (*cmd == '+') {
+                       doIt = TRUE;
+                       if (!shellName) /* we came here from jobs */
+                               Shell_Init();
+               } else
+                       break;
+               cmd++;
+       }
 
-    while (ch_isspace(*cmd))
-       cmd++;
+       while (ch_isspace(*cmd))
+               cmd++;
 
-    /*
-     * If we did not end up with a command, just skip it.
-     */
-    if (cmd[0] == '\0')
-       return 0;
+       /*
+        * If we did not end up with a command, just skip it.
+        */
+       if (cmd[0] == '\0')
+               return 0;
 
 #if !defined(MAKE_NATIVE)
-    /*
-     * In a non-native build, the host environment might be weird enough
-     * that it's necessary to go through a shell to get the correct
-     * behaviour.  Or perhaps the shell has been replaced with something
-     * that does extra logging, and that should not be bypassed.
-     */
-    useShell = TRUE;
+       /*
+        * In a non-native build, the host environment might be weird enough
+        * that it's necessary to go through a shell to get the correct
+        * behaviour.  Or perhaps the shell has been replaced with something
+        * that does extra logging, and that should not be bypassed.
+        */
+       useShell = TRUE;
 #else
-    /*
-     * Search for meta characters in the command. If there are no meta
-     * characters, there's no need to execute a shell to execute the
-     * command.
-     *
-     * Additionally variable assignments and empty commands
-     * go to the shell. Therefore treat '=' and ':' like shell
-     * meta characters as documented in make(1).
-     */
+       /*
+        * Search for meta characters in the command. If there are no meta
+        * characters, there's no need to execute a shell to execute the
+        * command.
+        *
+        * Additionally variable assignments and empty commands
+        * go to the shell. Therefore treat '=' and ':' like shell
+        * meta characters as documented in make(1).
+        */
 
-    useShell = needshell(cmd);
+       useShell = needshell(cmd);
 #endif
 
-    /*
-     * Print the command before echoing if we're not supposed to be quiet for
-     * this one. We also print the command if -n given.
-     */
-    if (!silent || !GNode_ShouldExecute(gn)) {
-       printf("%s\n", cmd);
-       fflush(stdout);
-    }
+       /*
+        * Print the command before echoing if we're not supposed to be quiet
+        * for this one. We also print the command if -n given.
+        */
+       if (!silent || !GNode_ShouldExecute(gn)) {
+               printf("%s\n", cmd);
+               fflush(stdout);
+       }
 
-    /*
-     * If we're not supposed to execute any commands, this is as far as
-     * we go...
-     */
-    if (!doIt && !GNode_ShouldExecute(gn))
-       return 0;
-
-    DEBUG1(JOB, "Execute: '%s'\n", cmd);
-
-    if (useShell) {
        /*
-        * We need to pass the command off to the shell, typically



Home | Main Index | Thread Index | Old Index