helix config
This commit is contained in:
parent
c0e548d323
commit
9ad5fc75b2
16
.helix/languages.toml
Normal file
16
.helix/languages.toml
Normal file
@ -0,0 +1,16 @@
|
||||
[[language]]
|
||||
file-types = ["c"]
|
||||
indent.unit = "\t"
|
||||
indent.tab-width = 8
|
||||
language-id = "C"
|
||||
name = "C"
|
||||
roots = ["Makefile"]
|
||||
scope = "source.c"
|
||||
|
||||
[[language]]
|
||||
file-types = ["homepage"]
|
||||
indent.unit = "\t"
|
||||
indent.tab-width = 8
|
||||
name = "homepage"
|
||||
roots = ["Makefile"]
|
||||
scope = "homepage"
|
@ -1,7 +0,0 @@
|
||||
scrut: scrut.o libfileis.o
|
||||
$(CC) $(CFLAGS) -o scrut libfileis.o scrut.o
|
||||
|
||||
clean:
|
||||
$(RM) scrut *.o
|
||||
|
||||
.PHONY: clean
|
@ -1,80 +0,0 @@
|
||||
#include <stdio.h> /* fprintf(3), stderr, NULL */
|
||||
#include <string.h> /* strchr(3) */
|
||||
#ifndef EX_USAGE
|
||||
# include <sysexits.h>
|
||||
#endif
|
||||
#include <unistd.h> /* access(3), getopt(3), F_OK, R_OK, W_OK, X_OK */
|
||||
#include <sys/stat.h> /* lstat(3), stat struct, S_ISBLK, S_ISCHR, S_ISDIR,
|
||||
* S_ISFIFO, S_ISGID, S_ISREG, S_ISLNK, S_ISSOCK,
|
||||
* S_ISUID, S_ISVTX */
|
||||
|
||||
static char args[] = "bcdefghkprsuwxLS";
|
||||
static char ops[(sizeof args) / (sizeof *args)];
|
||||
static char *program_name = "scrut";
|
||||
|
||||
int main(int argc, char *argv[]){
|
||||
struct stat buf;
|
||||
int c;
|
||||
size_t i;
|
||||
|
||||
if(argc < 2)
|
||||
goto usage;
|
||||
|
||||
i = 0;
|
||||
while((c = getopt(argc, argv, args)) != -1)
|
||||
if(strchr(args, c) == NULL)
|
||||
goto usage;
|
||||
else
|
||||
ops[i++] = c;
|
||||
ops[i] = '\0';
|
||||
|
||||
if(optind == argc)
|
||||
goto usage;
|
||||
|
||||
argv += optind;
|
||||
do{ if(access(*argv, F_OK) != 0 || lstat(*argv, &buf) == -1)
|
||||
return 1; /* doesn't exist or isn't stattable */
|
||||
|
||||
for(i = 0; ops[i] != '\0'; ++i)
|
||||
if(ops[i] == 'e')
|
||||
continue;
|
||||
else if(ops[i] == 'h'){
|
||||
usage: fprintf(stderr, "Usage: %s (-%s) [file...]\n",
|
||||
argv[0] == NULL
|
||||
? program_name
|
||||
: argv[0],
|
||||
args);
|
||||
|
||||
return EX_USAGE;
|
||||
}else if(
|
||||
(ops[i] == 'b'
|
||||
&& !S_ISBLK(buf.st_mode))
|
||||
|| (ops[i] == 'c'
|
||||
&& !S_ISCHR(buf.st_mode))
|
||||
|| (ops[i] == 'd'
|
||||
&& !S_ISDIR(buf.st_mode))
|
||||
|| (ops[i] == 'f'
|
||||
&& !S_ISREG(buf.st_mode))
|
||||
|| (ops[i] == 'g'
|
||||
&& !(buf.st_mode & S_ISGID))
|
||||
|| (ops[i] == 'k'
|
||||
&& !(buf.st_mode & S_ISVTX))
|
||||
|| (ops[i] == 'p'
|
||||
&& !S_ISFIFO(buf.st_mode))
|
||||
|| (ops[i] == 'r'
|
||||
&& access(*argv, R_OK) != 0)
|
||||
|| (ops[i] == 'u'
|
||||
&& !(buf.st_mode & S_ISUID))
|
||||
|| (ops[i] == 'w'
|
||||
&& access(*argv, W_OK) != 0)
|
||||
|| (ops[i] == 'x'
|
||||
&& access(*argv, X_OK) != 0)
|
||||
|| (ops[i] == 'L'
|
||||
&& !S_ISLNK(buf.st_mode))
|
||||
|| (ops[i] == 'S'
|
||||
&& !S_ISSOCK(buf.st_mode)))
|
||||
return 1;
|
||||
}while(*++argv != NULL);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user