Name: Anonymous 2009-05-06 2:50
/PROG/ has decided to worktogether to make a telnet based multiplayerp
/* TODO: Insert GNU GPL version 3 header. */
#include "config.h"
/* FUCK THE ESTABLISHMENT, YEAH, STICK IT TO THE MAN !! */
#define _GNU_SOURCE
#include <stdio.h>
#include <errno.h>
#include <getopt.h>
static void
print_help()
{
printf("Usage: %s [OPTION]\n", program_invocation_short_name);
puts("OPTION can be:");
puts(" --help Display help.");
puts(" --version Display version information.");
}
static void
print_version()
{
puts("This is " PACKAGE_NAME " version " PACKAGE_VERSION ".");
}
int
main(int argc, char* argv[])
{
for (;;) {
static const struct long_options[] = {
{ "help", 0, NULL, 'h' },
{ "version", 0, NULL, 'v' },
{ 0, 0, 0, 0 }
};
int option_index = 0;
int c = getopt_long(argc, argv, "hv", long_options, &option_index);
if (c == -1)
break;
switch (c) {
case 'h':
print_help();
return EXIT_SUCCESS;
case 'v':
print_version();
return EXIT_SUCCESS;
default:
print_help();
return EXIT_FAILURE;
}
}
if (optind < argc) {
print_help();
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}/*
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>;.
*/
/*
Copyright (c) 2009 >>42
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/
#include "config.h"
/* FUCK THE ESTABLISHMENT, YEAH, STICK IT TO THE MAN !! */
#define _GNU_SOURCE
#include <stdio.h>
#include <errno.h>
#include <getopt.h>
static void
print_help()
{
printf("Usage: %s [OPTION]\n", program_invocation_short_name);
puts("OPTION can be:");
puts(" --help Display help.");
puts(" --version Display version information.");
}
static void
print_version()
{
puts("This is " PACKAGE_NAME " version " PACKAGE_VERSION ".");
}
int
main(int argc, char* argv[])
{
for (;;) {
static const struct long_options[] = {
{ "help", 0, NULL, 'h' },
{ "version", 0, NULL, 'v' },
{ 0, 0, 0, 0 }
};
int option_index = 0;
int c = getopt_long(argc, argv, "hv", long_options, &option_index);
if (c == -1)
break;
switch (c) {
case 'h':
print_help();
return EXIT_SUCCESS;
case 'v':
print_version();
return EXIT_SUCCESS;
default:
print_help();
return EXIT_FAILURE;
}
}
if (optind < argc) {
print_help();
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
87a
atexit(curses_cleanup);
initscr();
cbreak();
noecho();
nonl();
keypad(stdscr, TRUE);
.
39a
#include <curses.h>
static void
curses_cleanup()
{
endwin();
}
.
commit c50f8d266cf4757758c952f8fcc721f6a88208c8
tree f03eaf59cfaa8a62ca9d5ecc6f71b7bbc46bebb6
parent 246007a0e71a4d04ea7304c76485ccf45195f63d
author Anonymous <anonymous@world4ch.org>; 1241886665 +0200
committer Anonymous <anonymous@world4ch.org>; 1241886665 +0200
Correct two small errors to make the code compile.
diff --git a/test.c b/test.c
index 533104c..5c465dc 100644
--- a/test.c
+++ b/test.c
@@ -38,6 +38,7 @@
#include <errno.h>
#include <getopt.h>
#include <curses.h>
+#include <stdlib.h>
static void
curses_cleanup()
@@ -64,7 +65,7 @@ int
main(int argc, char* argv[])
{
for (;;) {
- static const struct long_options[] = {
+ static const struct option long_options[] = {
{ "help", 0, NULL, 'h' },
{ "version", 0, NULL, 'v' },
{ 0, 0, 0, 0 }