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
/
libc
/
misc
/
mktemp.c
File editor
/* * (C) Shane Kerr <kerr@wizard.net> under terms of LGPL */ #include <unistd.h> #include <string.h> #include <stdio.h> #include <sys/stat.h> #include <errno.h> char *mktemp(char *s) { char * ptr; static char c1 = 0; static char c2 = 0; static char uniq_ch[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; size_t len; if (!s || (len = strlen(s)) < 6) { errno = EINVAL; return 0; } ptr = s + len - 6; if (++c1 >= 62) { c1 = 0; if (++c2 >= 62) { errno = EEXIST; return 0; } } sprintf(ptr, "%04d%c%c", getpid(), uniq_ch[(int)c1], uniq_ch[(int)c2]); return s; }
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