incron  0.5.10
Defines | Functions
ict-main.cpp File Reference

inotify cron table manipulator main file More...

#include <argp.h>
#include <pwd.h>
#include <string>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/inotify.h>
#include <fcntl.h>
#include <stdlib.h>
#include <limits.h>
#include <cstring>
#include <cstdio>
#include "inotify-cxx.h"
#include "appargs.h"
#include "incron.h"
#include "incrontab.h"
#include "incroncfg.h"

Defines

#define INCRON_ALT_EDITOR   "/etc/alternatives/editor"
 Alternative editor.
#define INCRON_DEFAULT_EDITOR   "vim"
 Default (hard-wired) editor.
#define INCRONTAB_VERSION   INCRONTAB_NAME " " INCRON_VERSION
 incrontab version string
#define INCRONTAB_DESCRIPTION
 incrontab description string
#define INCRONTAB_HELP
 incrontab help string

Functions

bool copy_from_file (const std::string &rPath, const std::string &rUser)
 Copies a file to an user table.
bool remove_table (const std::string &rUser)
 Removes an user table.
bool list_table (const std::string &rUser)
 Lists an user table.
bool edit_table (const std::string &rUser)
 Allows to edit an user table.
void list_types ()
 Prints the list of all available inotify event types.
bool reload_table (const std::string &rUser)
 Reloads an user table.
int main (int argc, char **argv)

Detailed Description

inotify cron table manipulator main file

inotify cron system

Copyright (C) 2006, 2007, 2008, 2012 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).

Credits: kolter (fix for segfaulting on --user) Christian Ruppert (new include to build with GCC 4.4+)


Define Documentation

#define INCRON_ALT_EDITOR   "/etc/alternatives/editor"

Alternative editor.

#define INCRON_DEFAULT_EDITOR   "vim"

Default (hard-wired) editor.

#define INCRONTAB_DESCRIPTION
Value:
"incrontab - inotify cron table manipulator\n" \
                              "(c) Lukas Jelinek, 2006, 2007, 208"

incrontab description string

#define INCRONTAB_HELP
Value:
INCRONTAB_DESCRIPTION "\n\n" \
          "usage: incrontab [<options>] <operation>\n" \
          "       incrontab [<options>] <FILE-TO-IMPORT>\n\n" \
          "<operation> may be one of the following:\n" \
          "  -?, --about                  gives short information about program\n" \
          "  -h, --help                   prints this help text\n" \
          "  -l, --list                   lists user table\n" \
          "  -r, --remove                 removes user table\n" \
          "  -e, --edit                   provides editing user table\n" \
          "  -t, --types                  list supported event types\n" \
          "  -d, --reload                 request incrond to reload user table\n" \
          "  -V, --version                prints program version\n\n" \
          "\n" \
          "These options may be used:\n" \
          "  -u <USER>, --user=<USER>     overrides current user (requires root privileges)\n" \
          "  -f <FILE>, --config=<FILE>   overrides default configuration file  (requires root privileges)\n\n" \
          "For reporting bugs please use http://bts.aiken.cz\n"

incrontab help string

#define INCRONTAB_VERSION   INCRONTAB_NAME " " INCRON_VERSION

incrontab version string


Function Documentation

bool copy_from_file ( const std::string &  rPath,
const std::string &  rUser 
)

Copies a file to an user table.

Parameters:
[in]rPathpath to file
[in]rUseruser name
Returns:
true = success, false = failure
bool edit_table ( const std::string &  rUser)

Allows to edit an user table.

Parameters:
[in]rUseruser 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 std::string &  rUser)

Lists an user table.

Parameters:
[in]rUseruser name
Returns:
true = success, false = failure
void list_types ( )

Prints the list of all available inotify event types.

int main ( int  argc,
char **  argv 
)
bool reload_table ( const std::string &  rUser)

Reloads an user table.

Parameters:
[in]rUseruser name
Returns:
true = success, false = otherwise
bool remove_table ( const std::string &  rUser)

Removes an user table.

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