Porównaj commity

...

6 Commity

Autor SHA1 Wiadomość Data
569e5afd71 update README 2025-11-08 15:16:14 +01:00
41b803df43 Warn if -w not provided 2025-11-08 15:12:40 +01:00
50af69c659 Exit on unknown options 2025-11-08 15:12:10 +01:00
5f3e73e592 Retire file_exists() 2025-10-01 14:05:22 +02:00
0d5e6cd052 Add option: -V --version 2025-10-01 14:03:39 +02:00
53f8aa343b mask_to_names(): Handle if ftell() is not successful 2025-09-30 18:59:04 +02:00
3 zmienionych plików z 31 dodań i 15 usunięć

Wyświetl plik

@@ -1,11 +1,15 @@
prefix = /usr/local
bindir = $(prefix)/bin
CFLAGS = -std=c99 -Wall -Wextra -pedantic
VERSIONFALLBACK = "v1.2+"
VERSIONFLAGS = -DGIT_TAG=\"$(shell git describe --tags HEAD || echo $(VERSIONFALLBACK))\"
all:
$(CC) adhocify.c -g $(CFLAGS) -o adhocify
$(CC) adhocify.c -g $(CFLAGS) $(VERSIONFLAGS) -o adhocify
release:
$(CC) adhocify.c $(CFLAGS) -o adhocify
$(CC) adhocify.c $(CFLAGS) $(VERSIONFLAGS) -o adhocify
install: release
install -D adhocify $(DESTDIR)$(bindir)/adhocify

Wyświetl plik

@@ -101,17 +101,17 @@ Install
=======
## Debian / Ubuntu
Please [read this](https://quitesimple.org/page/repositories) before using those instructions
Latest release can be installed using apt
```
# First, obtain key. Here we just assume it's trustworhty.
# First, obtain the key. Here we just assume it's trustworthy...
wget -O- https://repo.quitesimple.org/repo.quitesimple.org.asc | gpg --dearmor > repo.quitesimple.org-keyring.gpg
cat repo.quitesimple.org-keyring.gpg | sudo tee -a /usr/share/keyrings/repo.quitesimple.org.gpg > /dev/null
#For Debian
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/repo.quitesimple.org.gpg] https://repo.quitesimple.org/debian/ default main" | sudo tee /etc/apt/sources.list.d/quitesimple.list
#For Ubuntu/Debian
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/repo.quitesimple.org.gpg] https://repo.quitesimple.org/debian/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/quitesimple.list
#For Ubuntu >=21.10, prefer these sources
#echo "deb [arch=amd64 signed-by=/usr/share/keyrings/repo.quitesimple.org.gpg] https://repo.quitesimple.org/debian/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/quitesimple.list
sudo apt-get update
sudo apt-get install adhocify

Wyświetl plik

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2024 Albert S. <adhocify@quitesimple.org>
* Copyright (c) 2014-2025 Albert S. <adhocify@quitesimple.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -160,11 +160,6 @@ bool path_is_directory(const char *path)
return S_ISDIR(sb.st_mode);
}
static inline bool file_exists(const char *path)
{
return access(path, F_OK) == 0;
}
void add_to_ignore_list(const char *str)
{
*ignorelist_current = xmalloc(sizeof(struct ignorelist));
@@ -311,6 +306,11 @@ const char *mask_to_names(int mask)
{
ret[pos-1] = '\0';
}
else
{
logerror("Failed to convert mask to string: %s", strerror(errno));
exit(EXIT_FAILURE);
}
return xstrdup(ret);
}
@@ -510,7 +510,10 @@ static inline char *get_cwd()
void print_usage()
{
printf("adhocify [OPTIONS] command [arguments for command] - Monitor for inotify events and launch commands\n\n");
printf("adhocify [OPTIONS] command [arguments for command] - Monitor for inotify events and launch commands\n");
printf("Version: %s\n\n", GIT_TAG);
printf("--version, -V print version and exit\n");
printf("--daemon, -d run as a daemon\n");
printf("--path, -w adds the specified path to the watchlist\n");
printf("--logfile, -o path to write output of adhocify and stdout/stderr of launched commands to\n");
@@ -535,6 +538,7 @@ static struct option long_options[] = {{"daemon", no_argument, 0, 'd'},
{"mask", required_argument, 0, 'm'},
{"path", required_argument, 0, 'w'},
{"no-env", no_argument, 0, 'a'},
{"version", no_argument, 0, 'V'},
{"stdin", no_argument, 0, 's'},
{"no-forkbomb-check", no_argument, 0, 'b'},
{"ignore", required_argument, 0, 'i'},
@@ -571,10 +575,14 @@ void parse_options(int argc, char **argv)
int option;
int option_index;
uint32_t optmask = 0;
while((option = getopt_long(argc, argv, "absdo:w:m:i:e::", long_options, &option_index)) != -1)
while((option = getopt_long(argc, argv, "absdVo:w:m:i:e::", long_options, &option_index)) != -1)
{
switch(option)
{
case 'V':
printf("%s\n", GIT_TAG);
exit(EXIT_SUCCESS);
break;
case 'd':
daemonize = true;
break;
@@ -629,6 +637,9 @@ void parse_options(int argc, char **argv)
awaited_child_exit_code = atoi(optarg);
}
break;
case '?':
logerror("Invalid option provided. Exiting\n");
exit(EXIT_FAILURE);
}
}
@@ -656,6 +667,7 @@ void process_options()
if(watchlist_head == NULL)
{
logwrite("Info: Watching current dir (no -w provided)\n");
watchqueue_add_path(get_cwd());
}