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
/
file_utils
/
touch.c
File editor
#include <stdio.h> #include <fcntl.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <utime.h> #include "futils.h" int main(int argc, char **argv) { int ncreate = 0; int err = 0; struct stat sbuf; if (argc < 2) { errmsg("usage: touch file [...]\n"); return 1; } if ((argv[1][0] == '-') && (argv[1][1] == 'c')) { ncreate = 1; argv++; } for (argv++; *argv; argv++) { if (**argv != '-') { if (stat(*argv, &sbuf)) { if (!ncreate) { int fd = creat(*argv, 0666); if (fd < 0) { errstr(*argv); errmsg(": cannot create file\n"); err = 1; } else close(fd); } } else err |= utime(*argv, NULL); } } return (err ? 1 : 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