diff --git a/docs/internals/command.html.in b/docs/internals/command.html.in index 17d13605e6..c6131e376e 100644 --- a/docs/internals/command.html.in +++ b/docs/internals/command.html.in @@ -83,7 +83,7 @@

-  virCommandPtr cmd = virCommandNew("/usr/bin/dnsmasq");
+virCommandPtr cmd = virCommandNew("/usr/bin/dnsmasq");
 

@@ -100,7 +100,7 @@

-  virCommandAddArg(cmd, "-strict-order");
+virCommandAddArg(cmd, "-strict-order");
 

@@ -109,7 +109,7 @@

-  virCommandAddArgPair(cmd, "--conf-file", "/etc/dnsmasq.conf");
+virCommandAddArgPair(cmd, "--conf-file", "/etc/dnsmasq.conf");
 

@@ -118,7 +118,7 @@

-  virCommandAddArgFormat(cmd, "%d", count);
+virCommandAddArgFormat(cmd, "%d", count);
 

@@ -127,11 +127,11 @@

-  const char *const args[] = {
-      "--strict-order", "--except-interface", "lo", NULL
-  };
-  virCommandAddArgSet(cmd, args);
-  virCommandAddArgList(cmd, "--domain", "localdomain", NULL);
+const char *const args[] = {
+    "--strict-order", "--except-interface", "lo", NULL
+};
+virCommandAddArgSet(cmd, args);
+virCommandAddArgList(cmd, "--domain", "localdomain", NULL);
 

@@ -140,14 +140,14 @@

-  const char *const args[] = {
-      "/usr/bin/dnsmasq",
-      "--strict-order", "--except-interface",
-      "lo", "--domain", "localdomain", NULL
-  };
-  virCommandPtr cmd1 = virCommandNewArgs(cmd, args);
-  virCommandPtr cmd2 = virCommandNewArgList("/usr/bin/dnsmasq",
-                                            "--domain", "localdomain", NULL);
+const char *const args[] = {
+    "/usr/bin/dnsmasq",
+    "--strict-order", "--except-interface",
+    "lo", "--domain", "localdomain", NULL
+};
+virCommandPtr cmd1 = virCommandNewArgs(cmd, args);
+virCommandPtr cmd2 = virCommandNewArgList("/usr/bin/dnsmasq",
+                                          "--domain", "localdomain", NULL);
 

Setting up the environment

@@ -163,7 +163,7 @@

-  virCommandAddEnvPassCommon(cmd);
+virCommandAddEnvPassCommon(cmd);
 

@@ -177,8 +177,8 @@

-  virCommandAddEnvPass(cmd, "DISPLAY");
-  virCommandAddEnvPass(cmd, "XAUTHORITY");
+virCommandAddEnvPass(cmd, "DISPLAY");
+virCommandAddEnvPass(cmd, "XAUTHORITY");
 

@@ -187,7 +187,7 @@

-  virCommandAddEnvPair(cmd, "TERM", "xterm");
+virCommandAddEnvPair(cmd, "TERM", "xterm");
 

@@ -196,7 +196,7 @@

-  virCommandAddEnvString(cmd, "TERM=xterm");
+virCommandAddEnvString(cmd, "TERM=xterm");
 

Miscellaneous other options

@@ -210,7 +210,7 @@

-  virCommandDaemonize(cmd);
+virCommandDaemonize(cmd);
 

@@ -221,7 +221,7 @@

-  virCommandSetPidFile(cmd, "/var/run/dnsmasq.pid");
+virCommandSetPidFile(cmd, "/var/run/dnsmasq.pid");
 

@@ -240,7 +240,7 @@

-  virCommandClearCaps(cmd);
+virCommandClearCaps(cmd);
 

Managing file handles

@@ -256,13 +256,13 @@

-  int sharedfd = open("cmd.log", "w+");
-  int childfd = open("conf.txt", "r");
-  virCommandPassFD(cmd, sharedfd, 0);
-  virCommandPassFD(cmd, childfd,
-                   VIR_COMMAND_PASS_FD_CLOSE_PARENT);
-  if (VIR_CLOSE(sharedfd) < 0)
-      goto cleanup;
+int sharedfd = open("cmd.log", "w+");
+int childfd = open("conf.txt", "r");
+virCommandPassFD(cmd, sharedfd, 0);
+virCommandPassFD(cmd, childfd,
+                 VIR_COMMAND_PASS_FD_CLOSE_PARENT);
+if (VIR_CLOSE(sharedfd) < 0)
+    goto cleanup;
 

@@ -282,7 +282,7 @@

-  virCommandSetInputFD(cmd, 7);
+virCommandSetInputFD(cmd, 7);
 

@@ -291,10 +291,10 @@

-  int outfd = open("out.log", "w+");
-  int errfd = open("err.log", "w+");
-  virCommandSetOutputFD(cmd, &outfd);
-  virCommandSetErrorFD(cmd, &errfd);
+int outfd = open("out.log", "w+");
+int errfd = open("err.log", "w+");
+virCommandSetOutputFD(cmd, &outfd);
+virCommandSetErrorFD(cmd, &errfd);
 

@@ -304,10 +304,10 @@

-  int outfd = -1;
-  int errfd = -1
-  virCommandSetOutputFD(cmd, &outfd);
-  virCommandSetErrorFD(cmd, &errfd);
+int outfd = -1;
+int errfd = -1
+virCommandSetOutputFD(cmd, &outfd);
+virCommandSetErrorFD(cmd, &errfd);
 

@@ -326,7 +326,7 @@

-  virCommandNonblockingFDs(cmd);
+virCommandNonblockingFDs(cmd);
 

Feeding & capturing strings to/from the child

@@ -350,8 +350,8 @@

-  const char *input = "Hello World\n";
-  virCommandSetInputBuffer(cmd, input);
+const char *input = "Hello World\n";
+virCommandSetInputBuffer(cmd, input);
 

@@ -362,9 +362,9 @@

-  char *output = NULL, *errors = NULL;
-  virCommandSetOutputBuffer(cmd, &output);
-  virCommandSetErrorBuffer(cmd, &errors);
+char *output = NULL, *errors = NULL;
+virCommandSetOutputBuffer(cmd, &output);
+virCommandSetErrorBuffer(cmd, &errors);
 

@@ -392,7 +392,7 @@

-  virCommandSetWorkingDirectory(cmd, LOCALSTATEDIR);
+virCommandSetWorkingDirectory(cmd, LOCALSTATEDIR);
 

Any additional hooks

@@ -406,7 +406,7 @@

-  virCommandSetPreExecHook(cmd, hook, opaque);
+virCommandSetPreExecHook(cmd, hook, opaque);
 

Logging commands

@@ -418,20 +418,20 @@

-  int logfd = ...;
-  char *timestamp = virTimestamp();
-  char *string = NULL;
+int logfd = ...;
+char *timestamp = virTimestamp();
+char *string = NULL;
 
-  dprintf(logfd, "%s: ", timestamp);
-  VIR_FREE(timestamp);
-  virCommandWriteArgLog(cmd, logfd);
+dprintf(logfd, "%s: ", timestamp);
+VIR_FREE(timestamp);
+virCommandWriteArgLog(cmd, logfd);
 
-  string = virCommandToString(cmd);
-  if (string)
-      VIR_DEBUG("about to run %s", string);
-  VIR_FREE(string);
-  if (virCommandRun(cmd, NULL) < 0)
-      return -1;
+string = virCommandToString(cmd);
+if (string)
+    VIR_DEBUG("about to run %s", string);
+VIR_FREE(string);
+if (virCommandRun(cmd, NULL) < 0)
+    return -1;
 

Running commands synchronously

@@ -443,8 +443,8 @@

-  if (virCommandRun(cmd, NULL) < 0)
-     return -1;
+if (virCommandRun(cmd, NULL) < 0)
+   return -1;
 

@@ -465,19 +465,19 @@

-  int status;
-  if (virCommandRun(cmd, &status) < 0)
-      return -1;
-  if (status == 1) {
-    ...do stuff...
-  }
+int status;
+if (virCommandRun(cmd, &status) < 0)
+    return -1;
+if (status == 1) {
+  ...do stuff...
+}
 
-  virCommandRawStatus(cmd2);
-  if (virCommandRun(cmd2, &status) < 0)
-      return -1;
-  if (WIFEXITED(status) && WEXITSTATUS(status) == 1) {
-    ...do stuff...
-  }
+virCommandRawStatus(cmd2);
+if (virCommandRun(cmd2, &status) < 0)
+    return -1;
+if (WIFEXITED(status) && WEXITSTATUS(status) == 1) {
+  ...do stuff...
+}
 

Running commands asynchronously

@@ -490,19 +490,19 @@

-  pid_t pid;
-  if (virCommandRunAsync(cmd, &pid) < 0)
-     return -1;
+pid_t pid;
+if (virCommandRunAsync(cmd, &pid) < 0)
+   return -1;
 
-  ... do something while pid is running ...
+... do something while pid is running ...
 
-  int status;
-  if (virCommandWait(cmd, &status) < 0)
-     return -1;
+int status;
+if (virCommandWait(cmd, &status) < 0)
+   return -1;
 
-  if (WEXITSTATUS(status)...) {
-     ..do stuff..
-  }
+if (WEXITSTATUS(status)...) {
+   ..do stuff..
+}
 

@@ -540,7 +540,7 @@

-  virCommandFree(cmd);
+virCommandFree(cmd);