2021-11-21 01:49:30 +00:00
|
|
|
#include "main.h"
|
|
|
|
|
2021-11-21 01:29:09 +00:00
|
|
|
#include "dwm.h"
|
|
|
|
|
2021-11-21 01:37:38 +00:00
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2021-11-21 01:29:09 +00:00
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
2021-11-21 01:37:38 +00:00
|
|
|
if (argc == 2 && strcmp(argv[1], "-v") == 0) {
|
2021-11-21 01:52:24 +00:00
|
|
|
fputs("polytreewm-"VERSION"\n", stderr);
|
|
|
|
exit(EXIT_SUCCESS);
|
2021-11-21 01:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (argc != 1) {
|
|
|
|
die("usage: polytreewm [-v]");
|
|
|
|
}
|
|
|
|
|
2021-11-21 01:29:09 +00:00
|
|
|
return dwm_main(argc, argv);
|
|
|
|
}
|
2021-11-21 01:37:38 +00:00
|
|
|
|
|
|
|
void die(const char *const fmt, ...)
|
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
va_start(ap, fmt);
|
|
|
|
vfprintf(stderr, fmt, ap);
|
|
|
|
va_end(ap);
|
2021-11-21 01:49:30 +00:00
|
|
|
|
2021-11-21 01:37:38 +00:00
|
|
|
fputc('\n', stderr);
|
|
|
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
2021-11-21 01:49:30 +00:00
|
|
|
|
|
|
|
void die_perror(const char *const fmt, ...)
|
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
va_start(ap, fmt);
|
|
|
|
vfprintf(stderr, fmt, ap);
|
|
|
|
va_end(ap);
|
|
|
|
|
|
|
|
fprintf(stderr, ": ");
|
|
|
|
perror(NULL);
|
|
|
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|