You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
584 B
27 lines
584 B
#include <litc.h>
|
|
|
|
static char buf[1024];
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
int ret;
|
|
if ((ret = mkdir("/wtf", 0755)) < 0)
|
|
err(ret, "mkdir failed");
|
|
|
|
if ((ret = mkdir("/wtf/happyday", 0755)) < 0)
|
|
err(ret, "mkdir failed");
|
|
|
|
if ((ret = mkdir("/wtf/happyday/wut", 0755)) < 0)
|
|
err(ret, "mkdir failed");
|
|
|
|
if ((ret = open("/wtf/happyday/wut/afile", O_RDWR|O_CREAT, 0755)) < 0)
|
|
err(ret, "open failed");
|
|
int fd = ret;
|
|
|
|
snprintf(buf, sizeof(buf), "we fight for the user!");
|
|
if ((ret = write(fd, buf, strlen(buf))) != strlen(buf))
|
|
err(ret, "write failed");
|
|
|
|
return 0;
|
|
}
|