osl logo

The lightweight storage library


[README] [Download] [INSTALL] [Quick Start] [API] [License] [Contact] [man page]
Enumerations | Functions
osltar.c File Reference
#include <inttypes.h>
#include <osl.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <dirent.h>
#include <errno.h>
#include <sys/mman.h>
#include <fcntl.h>
Include dependency graph for osltar.c:

Go to the source code of this file.

Enumerations

enum  osltar_columns { OTC_NAME, OTC_DATA, NUM_OT_COLUMNS }
 

Functions

__static__ int string_compare (const struct osl_object *obj1, const struct osl_object *obj2)
 
int main (int argc, char **argv)
 

Detailed Description

A simple file archiver with many limitations. Do not use it. It is just an * example to illustrate programming with libosl.

Definition in file osltar.c.

Enumeration Type Documentation

The columns of the osl table.

Enumerator
OTC_NAME 

File name.

OTC_DATA 

File content.

NUM_OT_COLUMNS 

two.

Definition at line 27 of file osltar.c.

27  {
29  OTC_NAME,
31  OTC_DATA,
34 };

Function Documentation

int main ( int  argc,
char **  argv 
)

The osltar main funcion.

Parameters
argcUsual argument count.
argvUsual argument vector.

Definition at line 343 of file osltar.c.

344 {
345  if (argc < 2)
346  print_usage_and_die();
347  if (!strcmp(argv[1], "c"))
348  return com_create(argc - 1, argv + 1);
349  if (!strcmp(argv[1], "x"))
350  return com_extract(argc - 1, argv + 1);
351  if (!strcmp(argv[1], "t"))
352  return com_list(argc - 1, argv + 1);
353  print_usage_and_die();
354  exit(EXIT_FAILURE);
355 
356 }
__static__ int string_compare ( const struct osl_object obj1,
const struct osl_object obj2 
)

Compare two osl objects of string type.

Parameters
obj1Pointer to the first object.
obj2Pointer to the second object.
Returns
It returns an integer less than, equal to, or greater than zero if obj1 is found, respectively, to be less than, to match, or be greater than obj2.
See also
strcmp(3), strncmp(3), osl_compare_func.

Definition at line 56 of file osltar.c.

References osl_object::data, osl_table_description::dir, osl_table_description::name, NUM_OT_COLUMNS, osl_add_row(), osl_close_table(), osl_create_table(), osl_get_object(), osl_get_row(), OSL_MAPPED_STORAGE, OSL_MARK_CLEAN, osl_open_table(), OSL_RBTREE, osl_rbtree_loop(), osl_strerror(), OSL_UNIQUE, OTC_DATA, OTC_NAME, osl_object::size, and osl_column_description::storage_type.

57 {
58  const char *str1 = (const char *)obj1->data;
59  const char *str2 = (const char *)obj2->data;
60  return strcmp(str1, str2);
61 }
void * data
Definition: osl.h:20

Here is the call graph for this function: