Commit 5b400482 authored by Dave Love's avatar Dave Love
Browse files

Include unistd.h, string.h, stdlib.h,

fcntl.h, stdarg.h conditionally.
(_GNU_SOURCE, __attribute__): Don't define.
(optarg, optind, opterr): Declare.
(lose, lose_syserr): Use NO_RETURN.
(get_user_id): Use P_.
parent e440b20e
...@@ -29,30 +29,38 @@ Boston, MA 02111-1307, USA. */ ...@@ -29,30 +29,38 @@ Boston, MA 02111-1307, USA. */
Created 2002/03/22, by Colin Walters <walters@debian.org> Created 2002/03/22, by Colin Walters <walters@debian.org>
*/ */
#define _GNU_SOURCE
#include <config.h> #include <config.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif
#include <errno.h> #include <errno.h>
#ifdef HAVE_STRING_H
#include <string.h> #include <string.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h> #include <stdlib.h>
#endif
#include <stdio.h> #include <stdio.h>
#include <time.h> #include <time.h>
#include <pwd.h> #include <pwd.h>
#include <ctype.h> #include <ctype.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h> #include <fcntl.h>
#endif
#ifdef STDC_HEADERS
#include <stdarg.h> #include <stdarg.h>
#endif
#include <sys/stat.h> #include <sys/stat.h>
/* Needed for SunOS4, for instance. */
extern char *optarg;
extern int optind, opterr;
#define MAX_ATTEMPTS 5 #define MAX_ATTEMPTS 5
#define MAX_SCORES 200 #define MAX_SCORES 200
#define MAX_DATA_LEN 1024 #define MAX_DATA_LEN 1024
#if !defined (__GNUC__) || __GNUC__ < 2
#define __attribute__(x)
#endif
/* Declare the prototype for a general external function. */ /* Declare the prototype for a general external function. */
#if defined (PROTOTYPES) || defined (WINDOWSNT) #if defined (PROTOTYPES) || defined (WINDOWSNT)
#define P_(proto) proto #define P_(proto) proto
...@@ -97,8 +105,7 @@ int ...@@ -97,8 +105,7 @@ int
write_scores P_((const char *filename, const struct score_entry *scores, write_scores P_((const char *filename, const struct score_entry *scores,
int count)); int count));
void lose P_((const char *msg)) void lose P_((const char *msg)) NO_RETURN;
__attribute__ ((noreturn));
void lose(msg) void lose(msg)
const char *msg; const char *msg;
...@@ -107,8 +114,7 @@ void lose(msg) ...@@ -107,8 +114,7 @@ void lose(msg)
exit(1); exit(1);
} }
void lose_syserr P_((const char *msg)) void lose_syserr P_((const char *msg)) NO_RETURN;
__attribute__ ((noreturn));
void lose_syserr(msg) void lose_syserr(msg)
const char *msg; const char *msg;
...@@ -118,7 +124,7 @@ void lose_syserr(msg) ...@@ -118,7 +124,7 @@ void lose_syserr(msg)
} }
char * char *
get_user_id(void) get_user_id P_ ((void))
{ {
char *name; char *name;
struct passwd *buf = getpwuid(getuid()); struct passwd *buf = getpwuid(getuid());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment