elks-enhanced
public
Read
Owner: themaster
Branch: master
Commits: 6893
Updated: 2026-04-19 00:15
Git CLI clone URL
git clone https://www.xt-emporium.com/git/elks-enhanced.git
Fullscreen desktop URL
Code
Commits
History
Branches
Bug Reports
Discussions
Compare
Settings
elks-enhanced
/
elkscmd
/
busyelks
/
cmd
/
which.c
File editor
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> int which_main(argc,argv) int argc; char ** argv; { char *envpath; char *path, *cp; char buf[200]; char patbuf[512]; int quit, found; if (argc < 2) { write(STDERR_FILENO, "Usage: which cmd [cmd, ..]\n", 37); exit(1); } if ((envpath = getenv("PATH")) == 0) { envpath = "."; } argv[argc] = 0; for(argv++ ; *argv; argv++) { strcpy(patbuf, envpath); cp = path = patbuf; quit = found = 0; while(!quit) { cp = index(path, ':'); if (cp == NULL) { quit++; } else { *cp = '\0'; } sprintf(buf, "%s/%s", (*path ? path:"."), *argv); path = ++cp; if (access(buf, 1) == 0) { printf("%s\n", buf); found++; } } if (!found) { printf("No %s in %s\n", *argv, envpath); } } exit(0); }
Commit message
This repository is read-only for this account.
Repository snapshot
Current branch
master
Visibility
public
Your access
Read
Remote
Configured
File activity
View file history