![]() |
STASIS
A pipeline delivery generator
|
#include <stdio.h>#include <stdlib.h>#include <dirent.h>#include <string.h>#include <unistd.h>#include <limits.h>#include <errno.h>#include "core.h"#include "log.h"#include "copy.h"#include "system.h"#include "strlist.h"#include "utils.h"#include "ini.h"
Go to the source code of this file.
Functions | |
| int | pushd (const char *path) |
| int | popd (void) |
| char * | expandpath (const char *_path) |
| int | rmtree (char *_path) |
| char ** | file_readlines (const char *filename, size_t start, size_t limit, ReaderFn *readerFn) |
| char * | path_basename (char *path) |
| char * | path_dirname (char *path) |
| char * | find_program (const char *name) |
| int | touch (const char *filename) |
| int | git_clone (struct Process *proc, char *url, char *destdir, char *gitref) |
| char * | git_describe (const char *path) |
| char * | git_rev_parse (const char *path, char *args) |
| int | path_store (char **destptr, size_t maxlen, const char *base, const char *path) |
| void | msg (unsigned type, char *fmt,...) |
| void | debug_shell () |
| char * | xmkstemp (FILE **fp, const char *mode) |
| int | isempty_dir (const char *path) |
| int | xml_pretty_print_in_place (const char *filename, const char *pretty_print_prog, const char *pretty_print_args) |
| int | fix_tox_conf (const char *filename, char **result, size_t maxlen) |
| char * | collapse_whitespace (char **s) |
| int | redact_sensitive (const char **to_redact, size_t to_redact_size, char *src, char *dest, size_t maxlen) |
| struct StrList * | listdir (const char *path) |
| long | get_cpu_count () |
| int | mkdirs (const char *_path, mode_t mode) |
| char * collapse_whitespace | ( | char ** | s | ) |
Collapse all whitespace in a string (to single spaces)
| s | address of string to modify |
| char * expandpath | ( | const char * | _path | ) |
Expand "~" to the user's home directory
| _path | (Must start with a ~) |

| char * find_program | ( | const char * | name | ) |
Scan PATH directories for a named program
| name | program name |
| int fix_tox_conf | ( | const char * | filename, |
| char ** | result, | ||
| size_t | maxlen ) |
Applies STASIS fixups to a tox ini config
| filename | path to tox.ini |
| result | path to processed configuration |
| maxlen |
| filename | /path/to/tox.ini |
| result | path of replacement tox.ini configuration |
| maxlen |

| long get_cpu_count | ( | ) |
Get CPU count
| int git_clone | ( | struct Process * | proc, |
| char * | url, | ||
| char * | destdir, | ||
| char * | gitref ) |
Clone a git repository
| proc | Process struct |
| url | URL (or file system path) of repoistory to clone |
| destdir | destination directory |
| gitref | commit/branch/tag of checkout (NULL will use HEAD of default branch for repo) |

| char * git_describe | ( | const char * | path | ) |
Git describe wrapper
| path | to repository |

| char * git_rev_parse | ( | const char * | path, |
| char * | args ) |
Git rev-parse wrapper
| path | to repository |
| args | to pass to git rev-parse |

| int isempty_dir | ( | const char * | path | ) |
Is the path an empty directory structure?
| path | directory |
| struct StrList * listdir | ( | const char * | path | ) |
Given a directory path, return a list of files
| path | of a directory |
Retrieve file names in a directory (no metadata, non-recursive)
| path | directory path |

| int mkdirs | ( | const char * | _path, |
| mode_t | mode ) |
Create all leafs in directory path
| _path | directory path to create |
| mode | mode_t permissions |
| char * path_basename | ( | char * | path | ) |
Strip directory from file name Note: Caller is responsible for freeing memory
| _path |
| char * path_dirname | ( | char * | path | ) |
Return parent directory of file, or the parent of a directory
| path |
| int path_store | ( | char ** | destptr, |
| size_t | maxlen, | ||
| const char * | base, | ||
| const char * | path ) |
Helper function to initialize simple STASIS internal path strings
| destptr | address of destination string pointer |
| maxlen | maximum length of the path |
| base | path |
| path | to append to base |

| int popd | ( | void | ) |
Return from directory. Pop last path from directory stack.

| int pushd | ( | const char * | path | ) |
| int redact_sensitive | ( | const char ** | to_redact, |
| size_t | to_redact_size, | ||
| char * | src, | ||
| char * | dest, | ||
| size_t | maxlen ) |
Write REDACTED in dest for each occurrence of to_redacted token present in src
| to_redact | array of tokens to redact |
| src | input string |
| dest | output string |
| maxlen | maximum length of dest byte array |
Replace sensitive text in strings with REDACTED
| to_redact | a list of tokens to redact |
| to_redact_size | limit to n tokens in list |
| src | to read |
| dest | to write modified string |
| maxlen | maximum length of dest string |

| int rmtree | ( | char * | _path | ) |
| int touch | ( | const char * | filename | ) |
Create an empty file, or update modified timestamp on an existing file
| filename | file to touch |
| char * xmkstemp | ( | FILE ** | fp, |
| const char * | mode ) |
Creates a temporary file returning an open file pointer via fp, and the path to the file. The caller is responsible for closing fp and free()ing the returned file path.
| fp | pointer to FILE (to be initialized) |
| mode | fopen() style file mode string |

| int xml_pretty_print_in_place | ( | const char * | filename, |
| const char * | pretty_print_prog, | ||
| const char * | pretty_print_args ) |
Rewrite an XML file with a pretty printer command
| filename | path to modify |
| pretty_print_prog | program to call |
| pretty_print_args | arguments to pass to program |
