ict-main.cpp File Reference

inotify cron table manipulator main file More...

#include <argp.h>
#include <pwd.h>
#include <string>
#include <stdio.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include "incron.h"
#include "incrontab.h"

Classes

struct  arguments
 incrontab arguments More...

Defines

#define INCRON_DEFAULT_EDITOR   "vim"

Enumerations

enum  InCronTab_Operation_t { OPER_NONE, OPER_LIST, OPER_REMOVE, OPER_EDIT }
 incrontab operations More...

Functions

static error_t parse_opt (int key, char *arg, struct argp_state *state)
 Parses the program options (arguments).
bool copy_from_file (const char *path, const char *user)
 Copies a file to an user table.
bool remove_table (const char *user)
 Removes an user table.
bool list_table (const char *user)
 Lists an user table.
bool edit_table (const char *user)
 Allows to edit an user table.
int main (int argc, char **argv)

Variables

const char * argp_program_version = INCRON_TAB_NAME " " INCRON_VERSION
const char * argp_program_bug_address = INCRON_BUG_ADDRESS
static char doc [] = "incrontab - incron table manipulator\n(c) Lukas Jelinek, 2006, 2007"
static char args_doc [] = "FILE"
static struct argp_option options []
static struct argp argp = { options, parse_opt, args_doc, doc }
 Program arguments.


Detailed Description

inotify cron table manipulator main file

inotify cron system

Copyright (C) 2006, 2007 Lukas Jelinek, <lukas@aiken.cz>

This program is free software; you can use it, redistribute it and/or modify it under the terms of the GNU General Public License, version 2 (see LICENSE-GPL).


Define Documentation

#define INCRON_DEFAULT_EDITOR   "vim"


Enumeration Type Documentation

enum InCronTab_Operation_t

incrontab operations

Enumerator:
OPER_NONE 
OPER_LIST  nothing
OPER_REMOVE  list table
OPER_EDIT  edit table


Function Documentation

bool copy_from_file ( const char *  path,
const char *  user 
)

Copies a file to an user table.

Parameters:
[in] path path to file
[in] user user name
Returns:
true = success, false = failure

bool edit_table ( const char *  user  ) 

Allows to edit an user table.

Parameters:
[in] user user name
Returns:
true = success, false = failure
Attention:
This function is very complex and may contain various bugs including security ones. Please keep it in mind..

bool list_table ( const char *  user  ) 

Lists an user table.

Parameters:
[in] user user name
Returns:
true = success, false = failure
Attention:
Listing is currently done through 'cat'.

int main ( int  argc,
char **  argv 
)

static error_t parse_opt ( int  key,
char *  arg,
struct argp_state *  state 
) [static]

Parses the program options (arguments).

Parameters:
[in] key argument key (name)
[in] arg argument value
[out] state options setting
Returns:
0 on success, ARGP_ERR_UNKNOWN on unknown argument(s)

bool remove_table ( const char *  user  ) 

Removes an user table.

Parameters:
[in] user user name
Returns:
true = success, false = failure


Variable Documentation

struct argp argp = { options, parse_opt, args_doc, doc } [static]

Program arguments.

const char* argp_program_bug_address = INCRON_BUG_ADDRESS

const char* argp_program_version = INCRON_TAB_NAME " " INCRON_VERSION

char args_doc[] = "FILE" [static]

char doc[] = "incrontab - incron table manipulator\n(c) Lukas Jelinek, 2006, 2007" [static]

struct argp_option options[] [static]

Initial value:

 {
  {"list",    'l', 0,      0,  "List the current table" },
  {"remove",  'r', 0,      0,  "Remove the table completely" },
  {"edit",    'e', 0,      0,  "Edit the table" },
  {"user",    'u', "USER", 0,  "Override the current user" },
  { 0 }
}


Generated on Thu Jan 4 00:37:59 2007 for incron by  doxygen 1.5.1