Compare commits
No commits in common. "46f0d4955f2037a58fddcd5727b218803a10c5c9" and "e90d25e30fe8ef271a6c3f6574404667b91ef42c" have entirely different histories.
46f0d4955f
...
e90d25e30f
@ -1,14 +0,0 @@
|
|||||||
[[language]]
|
|
||||||
file-types = ["c"]
|
|
||||||
indent.unit = "\t"
|
|
||||||
indent.tab-width = 4
|
|
||||||
language-id = "c"
|
|
||||||
name = "c"
|
|
||||||
roots = ["Makefile"]
|
|
||||||
scope = "source.c"
|
|
||||||
|
|
||||||
[[language]]
|
|
||||||
name = "rust"
|
|
||||||
auto-format = false
|
|
||||||
indent.unit = "\t"
|
|
||||||
indent.tab-width = 4
|
|
7
Makefile
7
Makefile
@ -32,7 +32,7 @@ RUSTLIBS = --extern getopt=build/o/libgetopt.rlib \
|
|||||||
CFLAGS += -I$(SYSEXITS)
|
CFLAGS += -I$(SYSEXITS)
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: dj false fop hru intcmp mm npc pschdir rpn scrut str strcmp swab true
|
all: dj false fop hru intcmp mm npc rpn scrut str strcmp swab true
|
||||||
|
|
||||||
# keep build/include until bindgen(1) has stdin support
|
# keep build/include until bindgen(1) has stdin support
|
||||||
# https://github.com/rust-lang/rust-bindgen/issues/2703
|
# https://github.com/rust-lang/rust-bindgen/issues/2703
|
||||||
@ -122,11 +122,6 @@ npc: build/bin/npc
|
|||||||
build/bin/npc: src/npc.c build
|
build/bin/npc: src/npc.c build
|
||||||
$(CC) $(CFLAGAS) -o $@ src/npc.c
|
$(CC) $(CFLAGAS) -o $@ src/npc.c
|
||||||
|
|
||||||
.PHONY: pschdir
|
|
||||||
pschdir: build/bin/pschdir
|
|
||||||
build/bin/pschdir: src/pschdir.c build
|
|
||||||
$(CC) $(CFLAGS) -o $@ src/pschdir.c
|
|
||||||
|
|
||||||
.PHONY: rpn
|
.PHONY: rpn
|
||||||
rpn: build/bin/rpn
|
rpn: build/bin/rpn
|
||||||
build/bin/rpn: src/rpn.rs build rustlibs
|
build/bin/rpn: src/rpn.rs build rustlibs
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
#include <errno.h> /* EACCESS, ELOOP, ENAMETOOLONG, ENOENT, ENOTDIR, errno */
|
|
||||||
#include <stdio.h> /* fprintf(3), stderr */
|
|
||||||
#include <string.h> /* strerror(3) */
|
|
||||||
#include <sysexits.h> /* EX_OSERR, EX_NOPERM, EX_NOINPUT, EX_UNAVAILABLE,
|
|
||||||
* EX_USAGE */
|
|
||||||
#include <unistd.h> /* chdir(2) */
|
|
||||||
|
|
||||||
char *program_name = "pschdir";
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]){
|
|
||||||
if (argc < 3) {
|
|
||||||
fprintf(stderr, "Usage: %s [directory] [command (argument...)]\n",
|
|
||||||
argv[0] == NULL ? program_name : argv[0]);
|
|
||||||
return EX_USAGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(chdir(argv[1]) != 0){
|
|
||||||
fprintf(stderr, "%s: %s: %s\n", argv[0], argv[1], strerror(errno));
|
|
||||||
|
|
||||||
switch (errno) {
|
|
||||||
case ENAMETOOLONG: return EX_OSERR;
|
|
||||||
case EACCES: return EX_NOPERM;
|
|
||||||
case ENOENT:
|
|
||||||
case ENOTDIR: return EX_NOINPUT;
|
|
||||||
default: return EX_UNAVAILABLE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
execvp(argv[2], &argv[2]);
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user