Defines | Functions

/build/buildd-opendnssec_1.3.2-1~bpo60+1-mipsel-iYafXM/opendnssec-1.3.2/signer/src/shared/file.c File Reference

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

Go to the source code of this file.

Defines

#define BUFFER_SIZE   (16 * 1024)

Functions

const char * ods_file_mode2str (const char *mode)
int ods_fgetc (FILE *fd, unsigned int *line_nr)
int ods_skip_whitespace (FILE *fd, unsigned int *line_nr)
char * ods_build_path (const char *file, const char *suffix, int dir)
FILE * ods_fopen (const char *file, const char *dir, const char *mode)
void ods_fclose (FILE *fd)
ssize_t ods_writen (int fd, const void *vptr, size_t n)
time_t ods_file_lastmodified (const char *file)
int ods_strcmp (const char *s1, const char *s2)
const char * ods_replace (const char *str, const char *oldstr, const char *newstr)
ods_status ods_file_copy (const char *file1, const char *file2)
char * ods_dir_name (const char *file)
void ods_chown (const char *file, uid_t uid, gid_t gid, int getdir)
void ods_str_trim (char *str)

Define Documentation

#define BUFFER_SIZE   (16 * 1024)

File access.

Definition at line 47 of file file.c.


Function Documentation

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

Construct file name. (StrAppend?, snprintf?)

Definition at line 121 of file file.c.

References ods_log_crit().

Referenced by tools_audit(), tools_input(), zone_backup(), and zone_recover().

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

(Create) and change ownership of directories

Definition at line 437 of file file.c.

References ods_dir_name(), ods_log_debug(), ods_log_error(), and ods_log_warning().

char* ods_dir_name ( const char *  file  ) 

Get directory part of filename.

Definition at line 406 of file file.c.

References ods_log_assert.

Referenced by ods_chown().

void ods_fclose ( FILE *  fd  ) 
int ods_fgetc ( FILE *  fd,
unsigned int *  line_nr 
)

Get next char.

Definition at line 79 of file file.c.

References ods_log_assert.

Referenced by adutil_readline_frm_file(), and ods_skip_whitespace().

ods_status ods_file_copy ( const char *  file1,
const char *  file2 
)

File copy.

Definition at line 363 of file file.c.

Referenced by tools_input().

time_t ods_file_lastmodified ( const char *  file  ) 

Get file last modified.

Definition at line 262 of file file.c.

References ods_fclose(), ods_fopen(), and ods_log_assert.

Referenced by signconf_update(), and zonelist_update().

const char* ods_file_mode2str ( const char *  mode  ) 

Convert file mode to readable string.

Definition at line 57 of file file.c.

References ods_strcmp().

Referenced by ods_fopen().

FILE* ods_fopen ( const char *  file,
const char *  dir,
const char *  mode 
)
const char* ods_replace ( const char *  str,
const char *  oldstr,
const char *  newstr 
)

Replace a substring in string.

Definition at line 306 of file file.c.

References SYSTEM_MAXLEN.

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

Skip white space.

Definition at line 99 of file file.c.

References ods_fgetc(), and ods_log_assert.

void ods_str_trim ( char *  str  ) 

Remove leading and trailing whitespace.

Definition at line 473 of file file.c.

int ods_strcmp ( const char *  s1,
const char *  s2 
)
ssize_t ods_writen ( int  fd,
const void *  vptr,
size_t  n 
)

Write to file descriptor.

Definition at line 234 of file file.c.