1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
/* a_ljc_program - insert a description here
* Copyright (C) 2025 by Some Developer <email@address.com>
* Distributed under The MIT License
*/
#include <stdio.h>
#include <libjodycode.h>
#include "libjodycode_check.h"
#include "version.h"
/* Detect Windows and modify as needed */
#if defined _WIN32 || defined __CYGWIN__
#ifndef ON_WINDOWS
#define ON_WINDOWS 1
#endif
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#include <io.h>
#else /* Not Windows */
#ifdef UNICODE
#error Do not define UNICODE on non-Windows platforms.
#undef UNICODE
#endif
#endif /* _WIN32 || __CYGWIN__ */
#ifdef UNICODE
int wmain(int argc, wchar_t **wargv)
#else
int main(int argc, char **argv)
#endif
{
int stdout_tty = 0;
/* Insert main()-local variables here */
#ifdef ON_WINDOWS
/* Windows buffers our std output; don't let it do that */
if (setvbuf(stdout, NULL, _IONBF, 0) != 0 || setvbuf(stderr, NULL, _IONBF, 0) != 0)
fprintf(stderr, "warning: setvbuf() failed\n");
if (_isatty(_fileno(stdout))) stdout_tty = 1;
#else
if (isatty(fileno(stdout))) stdout_tty = 1;
#endif /* ON_WINDOWS */
/* Verify libjodycode compatibility before going further */
if (libjodycode_version_check(1, 0) != 0) {
/*** Insert version check failure actions here ***/
exit(EXIT_FAILURE);
}
/* On Windows, set up the terminal and un-wide argv */
#ifdef ON_WINDOWS
#ifdef UNICODE
static char **argv;
int ut_err = jc_setup_unicode_terminal(argc, wargv, &argv, NULL);
#else
int ut_err = jc_setup_unicode_terminal(0, NULL, NULL, NULL);
#endif /* UNICODE */
if (ut_err != 0) {
jc_print_error(ut_err);
exit(EXIT_FAILURE);
}
#endif /* ON_WINDOWS */
/***** INSERT YOUR PROGRAM HERE *****/
exit(EXIT_SUCCESS);
}
|