Author: sebor
Date: Tue Jul 25 15:41:26 2006
New Revision: 425545
URL: http://svn.apache.org/viewvc?rev=425545&view=rev
Log:
2006-07-25 Andrew Black <[EMAIL PROTECTED]>
* cmdopt.cpp: Formatting cleanup.
* exec.cpp: Same.
* output.cpp: Same.
* runall.cpp: Same.
* util.cpp: Same.
Modified:
incubator/stdcxx/trunk/util/cmdopt.cpp
incubator/stdcxx/trunk/util/exec.cpp
incubator/stdcxx/trunk/util/output.cpp
incubator/stdcxx/trunk/util/runall.cpp
incubator/stdcxx/trunk/util/util.cpp
Modified: incubator/stdcxx/trunk/util/cmdopt.cpp
URL:
http://svn.apache.org/viewvc/incubator/stdcxx/trunk/util/cmdopt.cpp?rev=425545&r1=425544&r2=425545&view=diff
==============================================================================
--- incubator/stdcxx/trunk/util/cmdopt.cpp (original)
+++ incubator/stdcxx/trunk/util/cmdopt.cpp Tue Jul 25 15:41:26 2006
@@ -38,7 +38,7 @@
int compat = 0; /**< Test compatability mode switch. Defaults to 0 (off) */
const char* exe_opts = ""; /**< Command line switches for child processes */
const char* in_root = ""; /**< Root directory for input/reference files */
-const char* exe_name; /**< Alias for process argv[0]. */
+const char* exe_name; /**< Alias for process argv [0]. */
/**
Display command line switches for program and terminate.
@@ -77,7 +77,7 @@
@see exe_opts
*/
int
-eval_options (const int argc, /* const */ char* const argv[])
+eval_options (const int argc, char* const argv [])
{
int i;
@@ -129,11 +129,11 @@
if ('\0' == argv [i][2])
return i+1;
- if (8 == arglen && 0 == memcmp ("--compat", argv [i], 8)){
+ if (8 == arglen && 0 == memcmp ("--compat", argv [i], 8)) {
compat = 1;
break;
}
- else if (10 == arglen && 0 == memcmp ("--nocompat", argv [i], 10)){
+ else if (10 == arglen && 0 == memcmp ("--nocompat", argv [i], 10))
{
compat = 0;
break;
}
@@ -185,13 +185,13 @@
table_pos = argv = (char**)RW_MALLOC (
(strlen (exe_opts) + 5) * sizeof (char*) / 2);
- /* (strlen (exe_opts)+5)/2 is overkill for the most situations,
- but it is just large enough to handle the worst case scenario
- (worst case is similar to 'x y' or 'x y z', requiring lengths
- of 4 and 5 respectively.)
+ /* (strlen (exe_opts)+5)/2 is overkill for the most situations, but it is
+ just large enough to handle the worst case scenario. The worst case
+ is a string similar to 'x y' or 'x y z', requiring array lengths of 4
+ and 5 respectively.
*/
- last = target = argv[1] = (char*)RW_MALLOC (strlen (exe_opts) + 1);
+ last = target = argv [1] = (char*)RW_MALLOC (strlen (exe_opts) + 1);
/* Transcribe the contents, handling escaping and splitting */
for (pos = exe_opts; *pos; ++pos) {
Modified: incubator/stdcxx/trunk/util/exec.cpp
URL:
http://svn.apache.org/viewvc/incubator/stdcxx/trunk/util/exec.cpp?rev=425545&r1=425544&r2=425545&view=diff
==============================================================================
--- incubator/stdcxx/trunk/util/exec.cpp (original)
+++ incubator/stdcxx/trunk/util/exec.cpp Tue Jul 25 15:41:26 2006
@@ -26,7 +26,7 @@
#include <assert.h> /* for assert */
#include <errno.h> /* for errno */
-#include <fcntl.h> /* for O_*, */
+#include <fcntl.h> /* for O_*, */
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
@@ -43,13 +43,15 @@
#include "exec.h"
/**
- Status flag used to comunicate that an alarm has triggered
+ Status flag used to comunicate that an alarm has triggered.
+
+ Value is 0 when alarm hasn't been triggered or has been handled
+ Value is 1 when alarm has been triggered and hasn't been handled
+
@see handle_alrm
@see open_input
*/
-static int
-alarm_timeout; /* set to a non-zero value when a non-zero timeout expires */
-
+static int alarm_timeout;
/**
Translates a signal number into a human understandable name
@@ -65,7 +67,7 @@
static const struct {
int val;
const char* str;
- } names[] = {
+ } names [] = {
#undef SIGNAL
#define SIGNAL(val) { SIG ## val, #val }
@@ -233,16 +235,16 @@
};
size_t i;
- static char def[16];
+ static char def [16];
- for (i = 0; i != sizeof names / sizeof *names; ++i) {
+ for (i = 0; i < sizeof names / sizeof *names; ++i) {
if (names [i].val == signo) {
return names [i].str;
}
}
/* We've run out of known signal numbers, so use a default name */
- snprintf (def, sizeof(def), "SIG#%d", signo);
+ snprintf (def, sizeof def, "SIG#%d", signo);
return def;
}
@@ -276,7 +278,7 @@
that the child process has terminated, or when we conclude it won't
terminate. To prevent the child process from running forever, we set
handle_alrm as the handler for SIGALRM using the sigaction system call and
- set a timeout using the alarm() system call. If this timeout expires, we
+ set a timeout using the alarm () system call. If this timeout expires, we
try to kill the child process using several different signals.
@todo add better handling for corner conditions
@@ -289,7 +291,7 @@
static struct exec_attrs
wait_for_child (pid_t child_pid)
{
- static const int signals[] = {
+ static const int signals [] = {
SIGHUP, SIGINT, SIGTERM, SIGKILL, SIGKILL
};
@@ -308,7 +310,7 @@
#else
int waitopts = WUNTRACED;
#endif
- assert ( 1 < child_pid );
+ assert (1 < child_pid);
/* Clear timeout */
alarm_timeout = 0;
@@ -320,7 +322,7 @@
act.sa_handler = handle_alrm;
sigaction (SIGALRM, &act, 0);
- if (timeout>0)
+ if (timeout > 0)
alarm (timeout);
while (1) {
@@ -358,7 +360,7 @@
++siginx;
/* Step to the next signal */
- if (siginx > sigcount ) {
+ if (siginx > sigcount) {
/* Still running, but we've run out of signals to try
Therefore, we'll set error flags and break out of
the loop.
@@ -384,12 +386,12 @@
}
else if (ECHILD == errno) {
/* should not happen */
- fprintf (stderr, "waitpid(%d) error: %s\n",
+ fprintf (stderr, "waitpid (%d) error: %s\n",
(int)child_pid, strerror (errno));
}
else {
- /* waitpid() error */
- fprintf (stderr, "waitpid(%d) error: %s\n",
+ /* waitpid () error */
+ fprintf (stderr, "waitpid (%d) error: %s\n",
(int)child_pid, strerror (errno));
}
}
@@ -453,8 +455,8 @@
/* If the file exists (errno isn't ENOENT), exit */
if (ENOENT != errno)
- terminate ( 1, "open(%s) failed: %s\n", tmp_name,
- strerror (errno));
+ terminate (1, "open (%s) failed: %s\n", tmp_name,
+ strerror (errno));
/* Try in_root/tutorial/in/exec_name.in */
memcpy (tmp_name, in_root, root_len+1);
@@ -471,22 +473,22 @@
/* If the file exists (errno isn't ENOENT), exit */
if (-1 == intermit && ENOENT != errno)
- terminate ( 1, "open(%s) failed: %s\n", tmp_name,
- strerror (errno));
+ terminate (1, "open (%s) failed: %s\n", tmp_name,
+ strerror (errno));
- free(tmp_name);
+ free (tmp_name);
}
/* If we didn't find a source file, open /dev/null */
- intermit = open("/dev/null", O_RDONLY);
+ intermit = open ("/dev/null", O_RDONLY);
/* If we opened the file, return the descriptor */
if (0 <= intermit)
return intermit;
/* otherwise, print an error message and exit */
- terminate ( 1, "open(/dev/null) failed: %s\n", strerror (errno));
+ terminate (1, "open (/dev/null) failed: %s\n", strerror (errno));
return -1; /* silence a compiler warning */
}
@@ -510,21 +512,21 @@
result = dup2 (source, dest);
if (-1 == result)
- terminate ( 1, "redirecting to %s failed: %s\n", name,
- strerror (errno));
+ terminate (1, "redirecting to %s failed: %s\n", name,
+ strerror (errno));
result = close (source);
if (-1 == result)
- terminate ( 1, "closing source for %s redirection failed: %s\n",
- name, strerror (errno));
+ terminate (1, "closing source for %s redirection failed: %s\n",
+ name, strerror (errno));
}
/**
Entry point to the watchdog subsystem.
- This method fork()s, creating a child process. This child process becomes
- a process group leader, redirects input and output files, then exec()s
- the target specified in argv[0], providing it with argv to use as its argv
+ This method fork ()s, creating a child process. This child process becomes
+ a process group leader, redirects input and output files, then exec ()s
+ the target specified in argv [0], providing it with argv to use as its argv
array. Meanwhile, the parent process calls the wait_for_child method to
monitor the child process, passing the return value back to the calling
method.
@@ -532,7 +534,7 @@
@param exec_name name of the child executable
@param argv argv array for child process
@return structure describing how the child procees exited
- @see wait_for_child()
+ @see wait_for_child ()
*/
struct exec_attrs
exec_file (const char* exec_name, char** argv)
@@ -543,62 +545,62 @@
FILE* error_file;
assert (0 != argv);
- assert (0 != argv[0]);
+ assert (0 != argv [0]);
assert (0 != exec_name);
/* Set process group ID (so entire group can be killed)*/
{
- const pid_t pgroup = setsid();
- if ( getpid() != pgroup )
- terminate ( 1, "Error setting process group: %s\n",
- strerror (errno));
+ const pid_t pgroup = setsid ();
+ if (getpid () != pgroup)
+ terminate (1, "Error setting process group: %s\n",
+ strerror (errno));
}
- /* Cache stdout for use if execv() fails */
+ /* Cache stdout for use if execv () fails */
{
const int error_cache = dup (2);
if (-1 == error_cache)
- terminate ( 1, "Error duplicating stderr: %s\n",
- strerror (errno));
+ terminate (1, "Error duplicating stderr: %s\n",
+ strerror (errno));
error_file = fdopen (error_cache,"a");
if (0 == error_file)
- terminate ( 1, "Error opening file handle from cloned "
- "stderr file descriptor: %s\n", strerror (errno));
+ terminate (1, "Error opening file handle from cloned "
+ "stderr file descriptor: %s\n", strerror (errno));
}
/* Redirect stdin */
{
const int intermit = open_input (exec_name);
- replace_file(intermit, 0, "stdin");
+ replace_file (intermit, 0, "stdin");
}
/* Redirect stdout */
{
- const size_t exelen = strlen (argv[0]);
+ const size_t exelen = strlen (argv [0]);
const size_t outlen = exelen + 5;
char* const tmp_name = (char*)RW_MALLOC (outlen);
int intermit;
/* Redirect stdout */
- memcpy (tmp_name, argv[0], exelen + 1);
+ memcpy (tmp_name, argv [0], exelen + 1);
strcat (tmp_name, ".out");
intermit = open (tmp_name, O_WRONLY | O_CREAT | O_TRUNC,
S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
if (-1 == intermit)
- terminate( 1, "Error opening %s for output redirection: "
+ terminate (1, "Error opening %s for output redirection: "
"%s\n", tmp_name, strerror (errno));
- replace_file(intermit, 1, "stdout");
+ replace_file (intermit, 1, "stdout");
free (tmp_name);
}
/* Redirect stderr */
- if (-1 == dup2(1, 2))
- terminate ( 1, "Redirection of stderr to stdout failed: %s\n",
- strerror (errno));
+ if (-1 == dup2 (1, 2))
+ terminate (1, "Redirection of stderr to stdout failed: %s\n",
+ strerror (errno));
execv (argv [0], argv);
@@ -608,14 +610,14 @@
exit (1);
}
- if (-1 == child_pid){
+ if (-1 == child_pid) {
/* Fake a failue to execute status return structure */
struct exec_attrs state = {127, -1};
fprintf (stderr, "Unable to create child process for %s: %s\n",
- argv[0], strerror (errno));
+ argv [0], strerror (errno));
return state;
}
/* parent */
- return wait_for_child ( child_pid );
+ return wait_for_child (child_pid);
}
Modified: incubator/stdcxx/trunk/util/output.cpp
URL:
http://svn.apache.org/viewvc/incubator/stdcxx/trunk/util/output.cpp?rev=425545&r1=425544&r2=425545&view=diff
==============================================================================
--- incubator/stdcxx/trunk/util/output.cpp (original)
+++ incubator/stdcxx/trunk/util/output.cpp Tue Jul 25 15:41:26 2006
@@ -81,8 +81,8 @@
unsigned fsm = 0;
char tok;
- assert ( 0 != exec_name );
- assert ( 0 != out_name );
+ assert (0 != exec_name);
+ assert (0 != out_name);
if (0 == data) {
if (ENOENT != errno) {
@@ -99,16 +99,16 @@
fsm = 1;
break;
case '#':
- fsm = ( 1 == fsm ) ? 2 : 0;
+ fsm = (1 == fsm) ? 2 : 0;
break;
case ' ':
- fsm = ( 2 == fsm ) ? 3 : ( ( 4 == fsm ) ? 5 : 0 );
+ fsm = (2 == fsm) ? 3 : ((4 == fsm) ? 5 : 0);
break;
case '|':
- fsm = ( 3 == fsm ) ? 4 : 0;
+ fsm = (3 == fsm) ? 4 : 0;
break;
case '(':
- if ( 5 == fsm ) {
+ if (5 == fsm) {
fseek (data, -6, SEEK_CUR);
fsm++;
break;
@@ -118,18 +118,18 @@
}
}
- if (!feof(data)) {
- while (3 == fscanf(data, "# | (S%u) %*s | %u | %u | %*u%% |\n",
- &r_lvl, &r_active, &r_total)) {
+ if (!feof (data)) {
+ while (3 == fscanf (data, "# | (S%u) %*s | %u | %u | %*u%% |\n",
+ &r_lvl, &r_active, &r_total)) {
if (6 < r_lvl) {
/* The 0.new tests produces errors, and are all
expected to be active, so invert the total */
- if (8 == r_lvl && 0 == strcmp(exec_name,"0.new"))
+ if (8 == r_lvl && 0 == strcmp (exec_name,"0.new"))
r_active = r_total-r_active;
failed += r_active;
asserts += r_total;
if (failed < r_active || asserts < r_total) {
- puts(" OFLOW");
+ puts (" OFLOW");
return;
}
}
@@ -141,27 +141,27 @@
if (fmt_ok) {
unsigned pcnt = 0;
if (asserts) {
- pcnt = 100 * ( asserts - failed ) / asserts;
+ pcnt = 100 * (asserts - failed) / asserts;
}
- printf(" 0 %6d %6d %5d%%\n", asserts, failed, pcnt);
+ printf (" 0 %6d %6d %5d%%\n", asserts, failed, pcnt);
}
else {
- puts("FORMAT");
+ puts ("FORMAT");
}
- fclose(data);
+ fclose (data);
}
/**
Parses output file out_name for test exec_name.
- This method is a reimplementation of check_test(). The difference between
- this method and check_test() is how it parses the results. This version
+ This method is a reimplementation of check_test (). The difference between
+ this method and check_test () is how it parses the results. This version
parses compatability layer output, rather than the test driver output.
@param exec_name the name of the executable that generated the output file
@param out_name the name of the output file being parsed
- @see check_test()
+ @see check_test ()
*/
static void
check_compat_test (const char* out_name)
@@ -172,7 +172,7 @@
unsigned fsm = 0;
char tok;
- assert ( 0 != out_name );
+ assert (0 != out_name);
if (0 == data) {
if (ENOENT != errno) {
@@ -191,13 +191,13 @@
fsm = 1;
break;
case '#':
- if ( 1 == fsm || 2 == fsm )
+ if (1 == fsm || 2 == fsm)
++fsm;
else
fsm = 0;
break;
case ' ':
- if ( 3 == fsm ) {
+ if (3 == fsm) {
++fsm;
break;
}
@@ -206,23 +206,23 @@
}
}
- if (!feof(data)) { /* leading "## A" eaten above */
- read = fscanf(data, "ssertions = %u\n## FailedAssertions = %u",
+ if (!feof (data)) { /* leading "## A" eaten above */
+ read = fscanf (data, "ssertions = %u\n## FailedAssertions = %u",
&asserts, &failed);
}
if (2 == read) {
unsigned pcnt = 0;
if (asserts) {
- pcnt = 100 * ( asserts - failed ) / asserts;
+ pcnt = 100 * (asserts - failed) / asserts;
}
- printf(" 0 %6d %6d %5d%%\n", asserts, failed, pcnt);
+ printf (" 0 %6d %6d %5d%%\n", asserts, failed, pcnt);
}
else {
- puts("FORMAT");
+ puts ("FORMAT");
}
- fclose(data);
+ fclose (data);
}
/**
@@ -237,7 +237,7 @@
*/
#define FILE_TEST(op, x) \
if (-1==(x)) \
- terminate ( 2, op " failed: %s\n", strerror (errno) )
+ terminate (2, op " failed: %s\n", strerror (errno))
/**
Parses output file out_name for the example exec_name.
@@ -263,16 +263,16 @@
@param exec_name the name of the executable that generated the output file
@param out_name the name of the output file being parsed
@see in_root
- @see FILE_TEST()
+ @see FILE_TEST ()
@todo remove dependancy on POSIX diff utility
*/
static void
-check_example(const char* const exec_name, const char* const out_name)
+check_example (const char* const exec_name, const char* const out_name)
{
struct stat file_info;
- const size_t root_len = strlen(in_root);
- char* const ref_name = (char*)RW_MALLOC(root_len
- + strlen(exec_name) + 19);
+ const size_t root_len = strlen (in_root);
+ char* const ref_name = (char*)RW_MALLOC (root_len
+ + strlen (exec_name) + 19);
int state = -1;
assert (0 != in_root);
@@ -286,11 +286,10 @@
strcat (ref_name, exec_name);
strcat (ref_name, ".out");
- if (0 > stat(ref_name, &file_info)) {
+ if (0 > stat (ref_name, &file_info)) {
if (ENOENT != errno) {
- printf("stat(%s) error: %s\n", ref_name,
- strerror (errno));
- free(ref_name);
+ printf ("stat (%s) error: %s\n", ref_name, strerror (errno));
+ free (ref_name);
return;
}
@@ -301,15 +300,13 @@
strcat (ref_name, exec_name);
strcat (ref_name, ".out");
- if (0 > stat(ref_name, &file_info)) {
- if (ENOENT != errno) {
- printf("stat(%s) error: %s\n", ref_name,
- strerror (errno));
- }
- else {
- puts(" NOREF");
- }
- free(ref_name);
+ if (0 > stat (ref_name, &file_info)) {
+ if (ENOENT != errno)
+ printf ("stat (%s) error: %s\n", ref_name, strerror (errno));
+ else
+ puts (" NOREF");
+
+ free (ref_name);
return;
}
}
@@ -317,23 +314,23 @@
const pid_t child_pid = fork ();
if (0 == child_pid) { /* child */
- /* Cache stdout (hopefully) for use if execv() fails */
- int error_cache = dup(2);
+ /* Cache stdout (hopefully) for use if execv () fails */
+ int error_cache = dup (2);
FILE* error_file;
- FILE_TEST("dup(stderr)", error_cache);
+ FILE_TEST ("dup (stderr)", error_cache);
- FILE_TEST("close(stdin)",close(0));
- FILE_TEST("close(stdin)",close(1));
- FILE_TEST("close(stderr)",close(2));
+ FILE_TEST ("close (stdin)",close (0));
+ FILE_TEST ("close (stdin)",close (1));
+ FILE_TEST ("close (stderr)",close (2));
/* Todo: diff with --strip-trailing-cr on windows */
execlp ("diff", "diff", ref_name, out_name, (char *)0);
if ((error_file = fdopen (error_cache, "a")))
- fprintf (error_file, "execlp(\"diff\", ...) error: %s\n",
+ fprintf (error_file, "execlp (\"diff\", ...) error: %s\n",
strerror (errno));
- exit(2);
+ exit (2);
}
while (1) {
@@ -343,21 +340,21 @@
if (WIFEXITED (state)) {
const int retcode = WEXITSTATUS (state);
- switch ( retcode ) {
+ switch (retcode) {
case 0:
- puts(" 0");
+ puts (" 0");
break;
case 1:
- puts("OUTPUT");
+ puts ("OUTPUT");
break;
default:
- printf("diff returned %d\n", retcode);
+ printf ("diff returned %d\n", retcode);
}
break;
}
else if (WIFSIGNALED (state)) {
- printf("diff exited with %s\n",
- get_signame (WTERMSIG (state)));
+ printf ("diff exited with %s\n",
+ get_signame (WTERMSIG (state)));
break;
}
/*
@@ -371,7 +368,7 @@
}
}
- free(ref_name);
+ free (ref_name);
}
/**
@@ -379,15 +376,15 @@
@param target the path to the executable that generated the output file
@param exec_name the name of the executable that generated the output file
- @see check_test()
- @see check_compat_test()
- @see check_example()
+ @see check_test ()
+ @see check_compat_test ()
+ @see check_example ()
*/
void
parse_output (const char* target, const char* exec_name)
{
- const size_t path_len = strlen ( target );
- char* const out_name = (char*)RW_MALLOC ( path_len + 5);
+ const size_t path_len = strlen (target);
+ char* const out_name = (char*)RW_MALLOC (path_len + 5);
memcpy (out_name, target, path_len + 1);
strcat (out_name,".out");
@@ -398,9 +395,9 @@
else
check_compat_test (out_name);
}
- else{
+ else {
/* Otherwise, diff against the output file */
check_example (exec_name, out_name);
}
- free(out_name);
+ free (out_name);
}
Modified: incubator/stdcxx/trunk/util/runall.cpp
URL:
http://svn.apache.org/viewvc/incubator/stdcxx/trunk/util/runall.cpp?rev=425545&r1=425544&r2=425545&view=diff
==============================================================================
--- incubator/stdcxx/trunk/util/runall.cpp (original)
+++ incubator/stdcxx/trunk/util/runall.cpp Tue Jul 25 15:41:26 2006
@@ -86,11 +86,11 @@
/* This is roughly equivlent to the -x bash operator.
It checks if the file can be run, /not/ if we can run it
*/
- const size_t path_len = strlen ( target );
+ const size_t path_len = strlen (target);
char* tmp_name;
/* If target is a .o file, check if it exists */
- if ( '.' == target [path_len-1] && 'o' == target [path_len] ){
+ if ('.' == target [path_len-1] && 'o' == target [path_len]) {
if (exists)
puts (" 0");
else
@@ -105,24 +105,21 @@
}
/* Otherwise, check for the .o file */
- tmp_name = (char*)RW_MALLOC ( path_len + 3 );
+ tmp_name = (char*)RW_MALLOC (path_len + 3);
memcpy (tmp_name, target, path_len + 1);
strcat (tmp_name,".o");
- if (0 > stat(tmp_name, &file_info)) {
- if (ENOENT != errno) {
- printf ("stat(%s) error: %s\n", tmp_name,
- strerror (errno));
- }
- else {
+ if (0 > stat (tmp_name, &file_info)) {
+ if (ENOENT != errno)
+ printf ("stat (%s) error: %s\n", tmp_name, strerror (errno));
+ else
puts (" COMP");
- }
}
else {
puts (" LINK");
}
- free(tmp_name);
+ free (tmp_name);
return 0;
}
return 1;
@@ -132,7 +129,7 @@
Post target execution result analysis.
This method examines the content of result, dispatching the processing
- to check_test() or check_example() if target had a return code of 0.
+ to check_test () or check_example () if target had a return code of 0.
Otherwise, this method determines why target terminated, based on the
return code and outputs that reason.
@@ -151,15 +148,15 @@
@param target the path to the executable that was run
@param exec_name the short name of the executable
@param result the return code data from running the target
- @see check_test()
- @see check_example()
+ @see check_test ()
+ @see check_example ()
*/
static void
process_results (const char* target, const char* exec_name,
const struct exec_attrs* result)
{
if (0 == result->status) {
- parse_output(target, exec_name);
+ parse_output (target, exec_name);
}
else if (WIFEXITED (result->status)) {
const int retcode = WEXITSTATUS (result->status);
@@ -175,10 +172,10 @@
}
}
else if (WIFSIGNALED (result->status)) {
- printf("%6s\n", get_signame (WTERMSIG (result->status)));
+ printf ("%6s\n", get_signame (WTERMSIG (result->status)));
}
else if (WIFSTOPPED (result->status)) {
- printf("%6s\n", get_signame (WSTOPSIG (result->status)));
+ printf ("%6s\n", get_signame (WSTOPSIG (result->status)));
}
else if (-1 == result->status && -1 == result->killed) {
puts (" NKILL");
@@ -209,8 +206,8 @@
assert (0 != path);
- for (mark = pos = path; '\0' != *(pos); ++pos)
- mark = ( '/' == *(pos) || '\\' == *(pos) ) ? pos+1 : mark;
+ for (mark = pos = path; '\0' != *pos; ++pos)
+ mark = ('/' == *pos || '\\' == *pos) ? pos + 1 : mark;
return mark;
}
@@ -239,10 +236,10 @@
childargv [0] = target;
- printf ( "%-18.18s ", exec_name );
- fflush ( stdout );
+ printf ("%-18.18s ", exec_name);
+ fflush (stdout);
- if ( !check_target_ok (target))
+ if (!check_target_ok (target))
return;
status = exec_file (exec_name, childargv);
@@ -262,9 +259,9 @@
*/
int
-main (int argc, char *argv[])
+main (int argc, char *argv [])
{
- exe_name = argv[0];
+ exe_name = argv [0];
if (1 < argc && '-' == argv [1][0]) {
const int nopts = eval_options (argc, argv);
@@ -282,13 +279,13 @@
if (0 < argc) {
int i;
- char** childargv = split_child_opts();
+ char** childargv = split_child_opts ();
- assert ( 0 != childargv );
- puts("NAME STATUS ASSRTS FAILED PERCNT");
+ assert (0 != childargv);
+ puts ("NAME STATUS ASSRTS FAILED PERCNT");
- for ( i = 0; i < argc; ++i ) {
- run_target ( argv [i], childargv );
+ for (i = 0; i < argc; ++i) {
+ run_target (argv [i], childargv);
}
if (childargv [1])
Modified: incubator/stdcxx/trunk/util/util.cpp
URL:
http://svn.apache.org/viewvc/incubator/stdcxx/trunk/util/util.cpp?rev=425545&r1=425544&r2=425545&view=diff
==============================================================================
--- incubator/stdcxx/trunk/util/util.cpp (original)
+++ incubator/stdcxx/trunk/util/util.cpp Tue Jul 25 15:41:26 2006
@@ -31,28 +31,28 @@
#include "util.h"
/**
- Wrapper for exit(), providing a terminal error message on stderr.
+ Wrapper for exit (), providing a terminal error message on stderr.
- @param state non-zero status code to exit() with
- @param format printf() format string to display on stderr
+ @param state non-zero status code to exit () with
+ @param format printf () format string to display on stderr
*/
void
-terminate ( const int state, const char* const format, ... )
+terminate (const int state, const char* const format, ...)
{
va_list args;
assert (0 != format);
assert (0 != state);
- va_start ( args, format );
- vfprintf ( stderr, format, args );
- va_end ( args );
+ va_start (args, format);
+ vfprintf (stderr, format, args);
+ va_end (args);
- exit ( state );
+ exit (state);
}
/**
- Wrapper for malloc(), providing return value checking.
+ Wrapper for malloc (), providing return value checking.
@param size number of bytes of memory to allocate
@param file name of file calling method
@@ -62,13 +62,13 @@
void*
guarded_malloc (const size_t size, const char* const file, const unsigned line)
{
- void* const alloc = malloc(size);
+ void* const alloc = malloc (size);
assert (0 != file);
assert (0 < size);
- if ( 0 == alloc )
- terminate ( 1, "malloc(%lu) at line %u of %s failed: %s\n",
+ if (0 == alloc)
+ terminate (1, "malloc (%lu) at line %u of %s failed: %s\n",
(unsigned long)size, line, file, strerror (errno));
return alloc;