OpenDNSSEC-signer 1.2.1
Functions

/build/buildd-opendnssec_1.2.1.dfsg-1-ia64-j6OroR/opendnssec-1.2.1.dfsg/signer/src/util/file.c File Reference

#include "config.h"
#include "util/file.h"
#include "util/log.h"
#include "util/se_malloc.h"
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
Include dependency graph for file.c:

Go to the source code of this file.

Functions

const char * se_file_mode2str (const char *mode)
int se_fgetc (FILE *fd, unsigned int *line_nr)
int se_skip_whitespace (FILE *fd, unsigned int *line_nr)
char * se_build_path (const char *file, const char *suffix, int dir)
FILE * se_fopen (const char *file, const char *dir, const char *mode)
void se_fclose (FILE *fd)
ssize_t se_writen (int fd, const void *vptr, size_t n)
time_t se_file_lastmodified (const char *file)
int se_strcmp (const char *s1, const char *s2)
const char * se_replace (const char *str, const char *oldstr, const char *newstr)
int se_file_copy (const char *file1, const char *file2)
char * se_dir_name (const char *file)
void se_chown (const char *file, uid_t uid, gid_t gid, int getdir)
void se_str_trim (char *str)

Function Documentation

char* se_build_path ( const char *  file,
const char *  suffix,
int  dir 
)

Construct file name. (StrAppend?, snprintf?)

Definition at line 114 of file file.c.

References se_malloc().

Referenced by signconf_backup(), task_backup(), tools_audit(), tools_read_input(), tools_update(), zone_add_dnskeys(), zone_backup_state(), zone_nsecify(), zone_recover_from_backup(), and zone_sign().

void se_chown ( const char *  file,
uid_t  uid,
gid_t  gid,
int  getdir 
)

(Create) and change ownership of directories

Definition at line 396 of file file.c.

References se_dir_name(), se_free(), se_log_debug(), se_log_error(), and se_log_warning().

char* se_dir_name ( const char *  file)

Get directory part of filename.

Definition at line 367 of file file.c.

References se_calloc(), and se_log_assert.

Referenced by se_chown().

void se_fclose ( FILE *  fd)
int se_fgetc ( FILE *  fd,
unsigned int *  line_nr 
)

Get next char.

Definition at line 72 of file file.c.

References se_log_assert.

Referenced by se_skip_whitespace().

int se_file_copy ( const char *  file1,
const char *  file2 
)

File copy.

Definition at line 343 of file file.c.

References se_fclose(), se_fopen(), se_log_assert, se_log_debug(), and SYSTEM_MAXLEN.

Referenced by tools_read_input(), and tools_update().

time_t se_file_lastmodified ( const char *  file)

Get file last modified.

Definition at line 248 of file file.c.

References se_fclose(), se_fopen(), and se_log_assert.

Referenced by signconf_read(), and zonelist_read().

const char* se_file_mode2str ( const char *  mode)

File access. Convert file mode to readable string.

Definition at line 52 of file file.c.

References se_log_assert, and se_strcmp().

Referenced by se_fopen().

FILE* se_fopen ( const char *  file,
const char *  dir,
const char *  mode 
)
const char* se_replace ( const char *  str,
const char *  oldstr,
const char *  newstr 
)

Replace a substring in string.

Definition at line 292 of file file.c.

References se_calloc(), se_log_assert, se_strdup(), and SYSTEM_MAXLEN.

Referenced by set_notify_ns().

int se_skip_whitespace ( FILE *  fd,
unsigned int *  line_nr 
)

Skip white space.

Definition at line 92 of file file.c.

References se_fgetc(), and se_log_assert.

void se_str_trim ( char *  str)

Remove leading and trailing whitespace.

Definition at line 432 of file file.c.

int se_strcmp ( const char *  s1,
const char *  s2 
)
ssize_t se_writen ( int  fd,
const void *  vptr,
size_t  n 
)

Write to file descriptor.

Definition at line 220 of file file.c.