Skip to content

Instantly share code, notes, and snippets.

View jaypeche's full-sized avatar
:octocat:
Gentoo nightly build

jay jaypeche

:octocat:
Gentoo nightly build
View GitHub Profile
@jaypeche
jaypeche / Makefile
Created December 1, 2014 20:40
clamav-realtime v0.0.2
# Makefile for clamav-realtime v0.0.2
# Including platform definitions
NAME=clamav-realtime
VERSION=0.0.2
include Makefile.defs
CC= gcc
STD= _GNU_SOURCE
> Create a function to notify filesystem changes
-->WORK but not recursive
> TODO : Recursive Loop
> CLAMAV : Use return code to launch analysis or not
> Create function like : inotify initialization, scan loop, cl_initialization, cl_updatedb...
@jaypeche
jaypeche / clamav-realtime.desktop
Created December 1, 2014 20:59
clamav-realtime launcher
[Desktop Entry]
Name=ClamAV Realtime
Comment=Realtime antivirus scanner with libClamAV
Exec=clamav-realtime
Icon=clamav-realtime
Terminal=false
Type=Application
MimeType=application/x-executable;
X-GNOME-Autostart-enabled=true
@jaypeche
jaypeche / -
Created December 3, 2014 22:58
#include <unistd.h>
int getopt (int argc, char * const argv[], const char * optstring);
extern char * optarg;
extern int optind, opterr;
@jaypeche
jaypeche / getopt_POSIX.c
Created December 4, 2014 00:11
getopt_POSIX_CORRECTLY
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
int
main(int argc, char *argv[])
{
int flags, opt;
int nsecs, tfnd;
@jaypeche
jaypeche / 06LST02.C
Created December 4, 2014 00:31
getopt examples Linux
#include <stdio.h>
#include <getopt.h>
int
main(int argc,char **argv) {
int optch;
static char optstring[] = "gW:c";
while ( (optch = getopt(argc,argv,optstring)) != -1 )
switch ( optch ) {
@jaypeche
jaypeche / getopt_GNU_POSIX.c
Created December 4, 2014 01:13
getopt GNU POSIX
#include <stdio.h> /* for printf */
#include <stdlib.h> /* for exit */
#include <unistd.h> /* for getopt */
int main (int argc, char **argv) {
int c;
int digit_optind = 0;
int aopt = 0, bopt = 0;
char *copt = 0, *dopt = 0;
while ( (c = getopt(argc, argv, "abc:d:012")) != -1) {
int this_option_optind = optind ? optind : 1;
@jaypeche
jaypeche / hello_world.c
Created December 5, 2014 18:31
getopt POSIX for clamav-realtime.c
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>
/* Define version */
static const char version[] = "0.0.3";
/* Flag set by ‘--verbose’. */
static int verbose_flag;
/*
@jaypeche
jaypeche / readconf.c
Created December 7, 2014 09:02
libconfig readconf.c v1 build with -lconfig flag
#include <stdio.h>
#include <stdlib.h>
#include <libconfig.h>
int main(int argc, char **argv)
{
config_t cfg, *cf;
const config_setting_t *retries;
const char *base = NULL;
int count, n, enabled;
@jaypeche
jaypeche / example1.c
Created December 7, 2014 23:45
libconfig doc sample
/* ----------------------------------------------------------------------------
libconfig - A library for processing structured configuration files
Copyright (C) 2005-2010 Mark A Lindner
This file is part of libconfig.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.