Main Page | Class List | File List | Class Members | File Members

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 "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).
void unlink_suid (const char *file, uid_t uid)
 Unlink a file with temporarily changed UID.
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 = "incrontab 0.2.2"
const char * argp_program_bug_address = "<bugs@aiken.cz>"
static char doc [] = "Table manipulator for incrond (inotify cron daemon)"
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 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

void unlink_suid const char *  file,
uid_t  uid
 

Unlink a file with temporarily changed UID.

Parameters:
[in] file file to unlink
[in] uid UID for unlink processing
Attention:
No error checking is done!


Variable Documentation

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

Program arguments.

const char* argp_program_bug_address = "<bugs@aiken.cz>"
 

const char* argp_program_version = "incrontab 0.2.2"
 

char args_doc[] = "FILE" [static]
 

char doc[] = "Table manipulator for incrond (inotify cron daemon)" [static]
 

struct argp_option options[] [static]
 

Initial value:

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


Generated on Mon Oct 30 21:54:32 2006 for incron by  doxygen 1.4.4