|
Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
|
#include <assert.h>#include <errno.h>#include <signal.h>#include <stdio.h>#include <stdlib.h>#include <stdarg.h>#include <string.h>#include <sys/stat.h>#include <sys/types.h>#include <unistd.h>#include "cmdopt.h"#include "util.h"
Go to the source code of this file.
Macros | |
| #define | DEV_NULL "/dev/null" |
Functions | |
| void | warn (const char *const format,...) |
| void | terminate (const int state, const char *const format,...) |
| void * | guarded_malloc (const size_t size, const char *const file, const unsigned line) |
| void * | guarded_realloc (void *source, const size_t size, const char *const file, const unsigned line) |
| char * | reference_name (const char *data_dir, const char *subdir, const char *mode) |
| char * | input_name (const char *data_dir, const char *target) |
| char * | output_name (const char *target) |
| void | rw_sleep (int seconds) |
| int | rw_signal (int signo, void(*func)(int)) |
| #define DEV_NULL "/dev/null" |
util.cpp - Utility function definitions for the exec utility
$Id$
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
| void * guarded_malloc | ( | const size_t | size, |
| const char *const | file, | ||
| const unsigned | line | ||
| ) |
| void * guarded_realloc | ( | void * | source, |
| const size_t | size, | ||
| const char *const | file, | ||
| const unsigned | line | ||
| ) |
Wrapper for realloc(), providing return value checking.
| source | pointer to memory block to reallocate |
| size | number of bytes of memory to allocate |
| file | name of file calling method |
| line | line number in file method was called from |
| char * input_name | ( | const char * | data_dir, |
| const char * | target | ||
| ) |
Composes the name of an input file, based on target
Takes a data directory and an executable name, and tries to open an input file based on these variables. If a file is found in neither of two locattions derived from these variables, this method tries to fall back on /dev/null.
Source file locations:
| data_dir | the path of the reference data directory |
| target | the name of executable being run |
| char * output_name | ( | const char * | target | ) |
| char * reference_name | ( | const char * | data_dir, |
| const char * | subdir, | ||
| const char * | mode | ||
| ) |
Generates the name of a reference (input/output) file.
This function allocates memory which is to be freed by the caller.
| data_dir | location of example data directory |
| subdir | example subdirectory to reference |
| mode | type of file to generate name for (should be 'in' or 'out') |
| int rw_signal | ( | int | signo, |
| void(*)(int) | func | ||
| ) |
| void rw_sleep | ( | int | seconds | ) |
| void terminate | ( | const int | state, |
| const char *const | format, | ||
| ... | |||
| ) |
| void warn | ( | const char *const | format, |
| ... | |||
| ) |
util.h - Utility macros / prototypes for the runall utility
$Id$
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Generates a non-terminal error message on stderr.
| format | printf () format string to display on stderr |