1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-06 23:17:47 +02:00

Update copyright year.

This commit is contained in:
Werner Koch 2012-01-31 18:08:24 +01:00
parent 92844f475b
commit 4a9d69ca87
5 changed files with 91 additions and 89 deletions

View File

@ -1,5 +1,5 @@
# Makefile.am - main makefile for NewPG/GnuPG # Makefile.am - Top level makefile for GnuPG
# Copyright (C) 2001, 2004 Free Software Foundation, Inc. # Copyright (C) 2001, 2004, 2012 Free Software Foundation, Inc.
# #
# This file is part of GnuPG. # This file is part of GnuPG.
# #

9
README
View File

@ -2,8 +2,9 @@
========================= =========================
Version 2.0 Version 2.0
Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. 2005, 2006, 2007, 2008, 2009, 2010, 2011,
2012 Free Software Foundation, Inc.
INTRODUCTION INTRODUCTION
@ -35,7 +36,7 @@ GnuPG 2.0 depends on the following packages:
libgcrypt (ftp://ftp.gnupg.org/gcrypt/libgcrypt/) libgcrypt (ftp://ftp.gnupg.org/gcrypt/libgcrypt/)
libksba (ftp://ftp.gnupg.org/gcrypt/libksba/) libksba (ftp://ftp.gnupg.org/gcrypt/libksba/)
libassuan >= 2.0 (ftp://ftp.gnupg.org/gcrypt/libassuan/) libassuan >= 2.0 (ftp://ftp.gnupg.org/gcrypt/libassuan/)
You also need the Pinentry package for most function of GnuPG; however You also need the Pinentry package for most function of GnuPG; however
it is not a build requirement. Pinentry is available at it is not a build requirement. Pinentry is available at
ftp://ftp.gnupg.org/gcrypt/pinentry/ . ftp://ftp.gnupg.org/gcrypt/pinentry/ .
@ -105,7 +106,7 @@ and use them if possible. You may also find GnuPG mirrored on some of
the regular GNU mirrors. the regular GNU mirrors.
We have some mailing lists dedicated to GnuPG: We have some mailing lists dedicated to GnuPG:
gnupg-announce@gnupg.org For important announcements like new gnupg-announce@gnupg.org For important announcements like new
versions and such stuff. This is a versions and such stuff. This is a
moderated list and has very low traffic. moderated list and has very low traffic.

View File

@ -1,6 +1,7 @@
# configure.ac - for GnuPG 2.0 # configure.ac - for GnuPG 2.0
# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, # Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
# 2006, 2007, 2008, 2010, 2011 Free Software Foundation, Inc. # 2006, 2007, 2008, 2010, 2011,
# 2012 Free Software Foundation, Inc.
# #
# This file is part of GnuPG. # This file is part of GnuPG.
# #

View File

@ -153,8 +153,8 @@ static void show_version(void);
static void static void
initialize( ARGPARSE_ARGS *arg, const char *filename, unsigned *lineno ) initialize( ARGPARSE_ARGS *arg, const char *filename, unsigned *lineno )
{ {
if( !(arg->flags & (1<<15)) ) if( !(arg->flags & (1<<15)) )
{ {
/* Initialize this instance. */ /* Initialize this instance. */
arg->internal.idx = 0; arg->internal.idx = 0;
arg->internal.last = NULL; arg->internal.last = NULL;
@ -167,13 +167,13 @@ initialize( ARGPARSE_ARGS *arg, const char *filename, unsigned *lineno )
if ( *arg->argc < 0 ) if ( *arg->argc < 0 )
jnlib_log_bug ("invalid argument for arg_parsee\n"); jnlib_log_bug ("invalid argument for arg_parsee\n");
} }
if (arg->err) if (arg->err)
{ {
/* Last option was erroneous. */ /* Last option was erroneous. */
const char *s; const char *s;
if (filename) if (filename)
{ {
if ( arg->r_opt == ARGPARSE_UNEXPECTED_ARG ) if ( arg->r_opt == ARGPARSE_UNEXPECTED_ARG )
@ -194,10 +194,10 @@ initialize( ARGPARSE_ARGS *arg, const char *filename, unsigned *lineno )
s = _("invalid option"); s = _("invalid option");
jnlib_log_error ("%s:%u: %s\n", filename, *lineno, s); jnlib_log_error ("%s:%u: %s\n", filename, *lineno, s);
} }
else else
{ {
s = arg->internal.last? arg->internal.last:"[??]"; s = arg->internal.last? arg->internal.last:"[??]";
if ( arg->r_opt == ARGPARSE_MISSING_ARG ) if ( arg->r_opt == ARGPARSE_MISSING_ARG )
jnlib_log_error (_("missing argument for option \"%.50s\"\n"), s); jnlib_log_error (_("missing argument for option \"%.50s\"\n"), s);
else if ( arg->r_opt == ARGPARSE_UNEXPECTED_ARG ) else if ( arg->r_opt == ARGPARSE_UNEXPECTED_ARG )
@ -271,10 +271,10 @@ optfile_parse (FILE *fp, const char *filename, unsigned *lineno,
char *buffer = NULL; char *buffer = NULL;
size_t buflen = 0; size_t buflen = 0;
int in_alias=0; int in_alias=0;
if (!fp) /* Divert to to arg_parse() in this case. */ if (!fp) /* Divert to to arg_parse() in this case. */
return arg_parse (arg, opts); return arg_parse (arg, opts);
initialize (arg, filename, lineno); initialize (arg, filename, lineno);
/* Find the next keyword. */ /* Find the next keyword. */
@ -302,9 +302,9 @@ optfile_parse (FILE *fp, const char *filename, unsigned *lineno,
arg->r_opt = ((opts[idx].flags & ARGPARSE_OPT_COMMAND) arg->r_opt = ((opts[idx].flags & ARGPARSE_OPT_COMMAND)
? ARGPARSE_INVALID_COMMAND ? ARGPARSE_INVALID_COMMAND
: ARGPARSE_INVALID_OPTION); : ARGPARSE_INVALID_OPTION);
else if (!(opts[idx].flags & 7)) else if (!(opts[idx].flags & 7))
arg->r_type = 0; /* Does not take an arg. */ arg->r_type = 0; /* Does not take an arg. */
else if ((opts[idx].flags & 8) ) else if ((opts[idx].flags & 8) )
arg->r_type = 0; /* Arg is optional. */ arg->r_type = 0; /* Arg is optional. */
else else
arg->r_opt = ARGPARSE_MISSING_ARG; arg->r_opt = ARGPARSE_MISSING_ARG;
@ -312,13 +312,13 @@ optfile_parse (FILE *fp, const char *filename, unsigned *lineno,
break; break;
} }
else if (state == 3) else if (state == 3)
{ {
/* No argument found. */ /* No argument found. */
if (in_alias) if (in_alias)
arg->r_opt = ARGPARSE_MISSING_ARG; arg->r_opt = ARGPARSE_MISSING_ARG;
else if (!(opts[idx].flags & 7)) else if (!(opts[idx].flags & 7))
arg->r_type = 0; /* Does not take an arg. */ arg->r_type = 0; /* Does not take an arg. */
else if ((opts[idx].flags & 8)) else if ((opts[idx].flags & 8))
arg->r_type = 0; /* No optional argument. */ arg->r_type = 0; /* No optional argument. */
else else
arg->r_opt = ARGPARSE_MISSING_ARG; arg->r_opt = ARGPARSE_MISSING_ARG;
@ -328,14 +328,14 @@ optfile_parse (FILE *fp, const char *filename, unsigned *lineno,
else if (state == 4) else if (state == 4)
{ {
/* Has an argument. */ /* Has an argument. */
if (in_alias) if (in_alias)
{ {
if (!buffer) if (!buffer)
arg->r_opt = ARGPARSE_UNEXPECTED_ARG; arg->r_opt = ARGPARSE_UNEXPECTED_ARG;
else else
{ {
char *p; char *p;
buffer[i] = 0; buffer[i] = 0;
p = strpbrk (buffer, " \t"); p = strpbrk (buffer, " \t");
if (p) if (p)
@ -369,13 +369,13 @@ optfile_parse (FILE *fp, const char *filename, unsigned *lineno,
} }
else else
buffer[i] = 0; buffer[i] = 0;
if (buffer) if (buffer)
{ {
trim_spaces (buffer); trim_spaces (buffer);
p = buffer; p = buffer;
if (*p == '"') if (*p == '"')
{ {
/* Remove quotes. */ /* Remove quotes. */
p++; p++;
if (*p && p[strlen(p)-1] == '\"' ) if (*p && p[strlen(p)-1] == '\"' )
@ -422,7 +422,7 @@ optfile_parse (FILE *fp, const char *filename, unsigned *lineno,
in_alias = 1; in_alias = 1;
state = 3; state = 3;
} }
else else
{ {
arg->r_opt = ((opts[idx].flags & ARGPARSE_OPT_COMMAND) arg->r_opt = ((opts[idx].flags & ARGPARSE_OPT_COMMAND)
? ARGPARSE_INVALID_COMMAND ? ARGPARSE_INVALID_COMMAND
@ -444,13 +444,13 @@ optfile_parse (FILE *fp, const char *filename, unsigned *lineno,
} }
} }
else if (state == 4) else if (state == 4)
{ {
/* Collect the argument. */ /* Collect the argument. */
if (buffer) if (buffer)
{ {
if (i < buflen-1) if (i < buflen-1)
buffer[i++] = c; buffer[i++] = c;
else else
{ {
char *tmp; char *tmp;
size_t tmplen = buflen + 50; size_t tmplen = buflen + 50;
@ -472,7 +472,7 @@ optfile_parse (FILE *fp, const char *filename, unsigned *lineno,
} }
else if (i < DIM(keyword)-1) else if (i < DIM(keyword)-1)
keyword[i++] = c; keyword[i++] = c;
else else
{ {
size_t tmplen = DIM(keyword) + 50; size_t tmplen = DIM(keyword) + 50;
buffer = jnlib_malloc (tmplen); buffer = jnlib_malloc (tmplen);
@ -494,13 +494,13 @@ optfile_parse (FILE *fp, const char *filename, unsigned *lineno,
arg->r_opt = ARGPARSE_KEYWORD_TOO_LONG; arg->r_opt = ARGPARSE_KEYWORD_TOO_LONG;
state = -1; /* Skip rest of line and leave. */ state = -1; /* Skip rest of line and leave. */
} }
else else
{ {
keyword[i++] = c; keyword[i++] = c;
state = 2; state = 2;
} }
} }
return arg->r_opt; return arg->r_opt;
} }
@ -562,7 +562,7 @@ arg_parse( ARGPARSE_ARGS *arg, ARGPARSE_OPTS *opts)
char **argv; char **argv;
char *s, *s2; char *s, *s2;
int i; int i;
initialize( arg, NULL, NULL ); initialize( arg, NULL, NULL );
argc = *arg->argc; argc = *arg->argc;
argv = *arg->argv; argv = *arg->argv;
@ -573,10 +573,10 @@ arg_parse( ARGPARSE_ARGS *arg, ARGPARSE_OPTS *opts)
/* Skip the first argument. */ /* Skip the first argument. */
argc--; argv++; idx++; argc--; argv++; idx++;
} }
next_one: next_one:
if (!argc) if (!argc)
{ {
/* No more args. */ /* No more args. */
arg->r_opt = 0; arg->r_opt = 0;
goto leave; /* Ready. */ goto leave; /* Ready. */
@ -585,14 +585,14 @@ arg_parse( ARGPARSE_ARGS *arg, ARGPARSE_OPTS *opts)
s = *argv; s = *argv;
arg->internal.last = s; arg->internal.last = s;
if (arg->internal.stopped && (arg->flags & ARGPARSE_FLAG_ALL)) if (arg->internal.stopped && (arg->flags & ARGPARSE_FLAG_ALL))
{ {
arg->r_opt = ARGPARSE_IS_ARG; /* Not an option but an argument. */ arg->r_opt = ARGPARSE_IS_ARG; /* Not an option but an argument. */
arg->r_type = 2; arg->r_type = 2;
arg->r.ret_str = s; arg->r.ret_str = s;
argc--; argv++; idx++; /* set to next one */ argc--; argv++; idx++; /* set to next one */
} }
else if( arg->internal.stopped ) else if( arg->internal.stopped )
{ {
arg->r_opt = 0; arg->r_opt = 0;
goto leave; /* Ready. */ goto leave; /* Ready. */
@ -601,10 +601,10 @@ arg_parse( ARGPARSE_ARGS *arg, ARGPARSE_OPTS *opts)
{ {
/* Long option. */ /* Long option. */
char *argpos; char *argpos;
arg->internal.inarg = 0; arg->internal.inarg = 0;
if (!s[2] && !(arg->flags & ARGPARSE_FLAG_NOSTOP)) if (!s[2] && !(arg->flags & ARGPARSE_FLAG_NOSTOP))
{ {
/* Stop option processing. */ /* Stop option processing. */
arg->internal.stopped = 1; arg->internal.stopped = 1;
argc--; argv++; idx++; argc--; argv++; idx++;
@ -643,7 +643,7 @@ arg_parse( ARGPARSE_ARGS *arg, ARGPARSE_OPTS *opts)
fputs ("--dump-options\n--help\n--version\n--warranty\n", stdout); fputs ("--dump-options\n--help\n--version\n--warranty\n", stdout);
exit (0); exit (0);
} }
if ( i == -2 ) if ( i == -2 )
arg->r_opt = ARGPARSE_AMBIGUOUS_OPTION; arg->r_opt = ARGPARSE_AMBIGUOUS_OPTION;
else if ( i == -1 ) else if ( i == -1 )
@ -673,40 +673,40 @@ arg_parse( ARGPARSE_ARGS *arg, ARGPARSE_OPTS *opts)
{ {
arg->r_opt = ARGPARSE_MISSING_ARG; arg->r_opt = ARGPARSE_MISSING_ARG;
} }
else if ( !argpos && *s2 == '-' else if ( !argpos && *s2 == '-'
&& (opts[i].flags & ARGPARSE_OPT_OPTIONAL) ) && (opts[i].flags & ARGPARSE_OPT_OPTIONAL) )
{ {
/* The argument is optional and the next seems to be an /* The argument is optional and the next seems to be an
option. We do not check this possible option but option. We do not check this possible option but
assume no argument */ assume no argument */
arg->r_type = ARGPARSE_TYPE_NONE; arg->r_type = ARGPARSE_TYPE_NONE;
} }
else else
{ {
set_opt_arg (arg, opts[i].flags, s2); set_opt_arg (arg, opts[i].flags, s2);
if ( !argpos ) if ( !argpos )
{ {
argc--; argv++; idx++; /* Skip one. */ argc--; argv++; idx++; /* Skip one. */
} }
} }
} }
else else
{ {
/* Does not take an argument. */ /* Does not take an argument. */
if ( argpos ) if ( argpos )
arg->r_type = ARGPARSE_UNEXPECTED_ARG; arg->r_type = ARGPARSE_UNEXPECTED_ARG;
else else
arg->r_type = 0; arg->r_type = 0;
} }
argc--; argv++; idx++; /* Set to next one. */ argc--; argv++; idx++; /* Set to next one. */
} }
else if ( (*s == '-' && s[1]) || arg->internal.inarg ) else if ( (*s == '-' && s[1]) || arg->internal.inarg )
{ {
/* Short option. */ /* Short option. */
int dash_kludge = 0; int dash_kludge = 0;
i = 0; i = 0;
if ( !arg->internal.inarg ) if ( !arg->internal.inarg )
{ {
arg->internal.inarg++; arg->internal.inarg++;
if ( (arg->flags & ARGPARSE_FLAG_ONEDASH) ) if ( (arg->flags & ARGPARSE_FLAG_ONEDASH) )
@ -727,7 +727,7 @@ arg_parse( ARGPARSE_ARGS *arg, ARGPARSE_OPTS *opts)
if ( opts[i].short_opt == *s ) if ( opts[i].short_opt == *s )
break; break;
} }
if ( !opts[i].short_opt && ( *s == 'h' || *s == '?' ) ) if ( !opts[i].short_opt && ( *s == 'h' || *s == '?' ) )
show_help (opts, arg->flags); show_help (opts, arg->flags);
@ -837,13 +837,13 @@ long_opt_strlen( ARGPARSE_OPTS *o )
{ {
size_t n = strlen (o->long_opt); size_t n = strlen (o->long_opt);
if ( o->description && *o->description == '|' ) if ( o->description && *o->description == '|' )
{ {
const char *s; const char *s;
#ifdef JNLIB_NEED_UTF8CONV #ifdef JNLIB_NEED_UTF8CONV
int is_utf8 = is_native_utf8 (); int is_utf8 = is_native_utf8 ();
#endif #endif
s=o->description+1; s=o->description+1;
if ( *s != '=' ) if ( *s != '=' )
n++; n++;
@ -875,7 +875,7 @@ static void
show_help (ARGPARSE_OPTS *opts, unsigned int flags) show_help (ARGPARSE_OPTS *opts, unsigned int flags)
{ {
const char *s; const char *s;
show_version (); show_version ();
putchar ('\n'); putchar ('\n');
s = strusage(41); s = strusage(41);
@ -904,8 +904,8 @@ show_help (ARGPARSE_OPTS *opts, unsigned int flags)
if ( s && *s== '@' && !s[1] ) /* Hide this line. */ if ( s && *s== '@' && !s[1] ) /* Hide this line. */
continue; continue;
if ( s && *s == '@' ) /* Unindented comment only line. */ if ( s && *s == '@' ) /* Unindented comment only line. */
{ {
for (s++; *s; s++ ) for (s++; *s; s++ )
{ {
if ( *s == '\n' ) if ( *s == '\n' )
{ {
@ -923,9 +923,9 @@ show_help (ARGPARSE_OPTS *opts, unsigned int flags)
if ( opts[i].short_opt < 256 ) if ( opts[i].short_opt < 256 )
{ {
printf (" -%c", opts[i].short_opt); printf (" -%c", opts[i].short_opt);
if ( !opts[i].long_opt ) if ( !opts[i].long_opt )
{ {
if (s && *s == '|' ) if (s && *s == '|' )
{ {
putchar (' '); j++; putchar (' '); j++;
for (s++ ; *s && *s != '|'; s++, j++ ) for (s++ ; *s && *s != '|'; s++, j++ )
@ -937,11 +937,11 @@ show_help (ARGPARSE_OPTS *opts, unsigned int flags)
} }
else else
fputs(" ", stdout); fputs(" ", stdout);
if ( opts[i].long_opt ) if ( opts[i].long_opt )
{ {
j += printf ("%c --%s", opts[i].short_opt < 256?',':' ', j += printf ("%c --%s", opts[i].short_opt < 256?',':' ',
opts[i].long_opt ); opts[i].long_opt );
if (s && *s == '|' ) if (s && *s == '|' )
{ {
if ( *++s != '=' ) if ( *++s != '=' )
{ {
@ -970,7 +970,7 @@ show_help (ARGPARSE_OPTS *opts, unsigned int flags)
{ {
if ( *s == '\n' ) if ( *s == '\n' )
{ {
if ( s[1] ) if ( s[1] )
{ {
putchar ('\n'); putchar ('\n');
for (j=0; j < indent; j++ ) for (j=0; j < indent; j++ )
@ -987,10 +987,10 @@ show_help (ARGPARSE_OPTS *opts, unsigned int flags)
puts ("\n(A single dash may be used instead of the double ones)"); puts ("\n(A single dash may be used instead of the double ones)");
} }
if ( (s=strusage(19)) ) if ( (s=strusage(19)) )
{ {
/* bug reports to ... */ /* bug reports to ... */
char *s2; char *s2;
putchar('\n'); putchar('\n');
s2 = strstr (s, "@EMAIL@"); s2 = strstr (s, "@EMAIL@");
if (s2) if (s2)
@ -1066,7 +1066,7 @@ usage (int level)
putc ('\n', stderr); putc ('\n', stderr);
exit (2); exit (2);
} }
else if (level == 2) else if (level == 2)
{ {
puts (strusage(41)); puts (strusage(41));
exit (0); exit (0);
@ -1096,10 +1096,10 @@ const char *
strusage( int level ) strusage( int level )
{ {
const char *p = strusage_handler? strusage_handler(level) : NULL; const char *p = strusage_handler? strusage_handler(level) : NULL;
if ( p ) if ( p )
return p; return p;
switch ( level ) switch ( level )
{ {
case 10: p = ("License GPLv3+: GNU GPL version 3 or later " case 10: p = ("License GPLv3+: GNU GPL version 3 or later "
@ -1107,7 +1107,7 @@ strusage( int level )
break; break;
case 11: p = "foo"; break; case 11: p = "foo"; break;
case 13: p = "0.0"; break; case 13: p = "0.0"; break;
case 14: p = "Copyright (C) 2011 Free Software Foundation, Inc."; break; case 14: p = "Copyright (C) 2012 Free Software Foundation, Inc."; break;
case 15: p = case 15: p =
"This is free software: you are free to change and redistribute it.\n" "This is free software: you are free to change and redistribute it.\n"
"There is NO WARRANTY, to the extent permitted by law.\n"; "There is NO WARRANTY, to the extent permitted by law.\n";
@ -1127,7 +1127,7 @@ strusage( int level )
case 40: /* short and long usage */ case 40: /* short and long usage */
case 41: p = ""; break; case 41: p = ""; break;
} }
return p; return p;
} }
@ -1178,7 +1178,7 @@ main(int argc, char **argv)
case 'c': opt.crf = pargs.r_type? pargs.r.ret_str:"a.crf"; break; case 'c': opt.crf = pargs.r_type? pargs.r.ret_str:"a.crf"; break;
case 'm': opt.myopt = pargs.r_type? pargs.r.ret_int : 1; break; case 'm': opt.myopt = pargs.r_type? pargs.r.ret_int : 1; break;
case 500: opt.a_long_one++; break; case 500: opt.a_long_one++; break;
default : pargs.err = ARGPARSE_PRINT_WARNING; break; default : pargs.err = ARGPARSE_PRINT_WARNING; break;
} }
} }
for(i=0; i < argc; i++ ) for(i=0; i < argc; i++ )

View File

@ -40,7 +40,7 @@
#define MYVERSION_LINE PGM " (GnuPG) " VERSION #define MYVERSION_LINE PGM " (GnuPG) " VERSION
#define BUGREPORT_LINE "\nReport bugs to <bug-gnupg@gnu.org>.\n" #define BUGREPORT_LINE "\nReport bugs to <bug-gnupg@gnu.org>.\n"
#else #else
#define MYVERSION_LINE PGM #define MYVERSION_LINE PGM
#define BUGREPORT_LINE "" #define BUGREPORT_LINE ""
#endif #endif
#if !defined(SUN_LEN) || !defined(PF_LOCAL) || !defined(AF_LOCAL) #if !defined(SUN_LEN) || !defined(PF_LOCAL) || !defined(AF_LOCAL)
@ -109,7 +109,7 @@ xrealloc (void *old, size_t n)
die ("out of core"); die ("out of core");
return p; return p;
} }
struct client_s { struct client_s {
struct client_s *next; struct client_s *next;
@ -117,7 +117,7 @@ struct client_s {
size_t size; /* Allocated size of buffer. */ size_t size; /* Allocated size of buffer. */
size_t len; /* Current length of buffer. */ size_t len; /* Current length of buffer. */
unsigned char *buffer; /* Buffer to with data already read. */ unsigned char *buffer; /* Buffer to with data already read. */
}; };
typedef struct client_s *client_t; typedef struct client_s *client_t;
@ -128,7 +128,7 @@ print_fd_and_time (int fd)
{ {
struct tm *tp; struct tm *tp;
time_t atime = time (NULL); time_t atime = time (NULL);
tp = localtime (&atime); tp = localtime (&atime);
printf ("%3d - %04d-%02d-%02d %02d:%02d:%02d ", printf ("%3d - %04d-%02d-%02d %02d:%02d:%02d ",
fd, fd,
@ -150,7 +150,7 @@ print_line (client_t c, const char *line)
if (c->buffer && c->len) if (c->buffer && c->len)
{ {
print_fd_and_time (c->fd); print_fd_and_time (c->fd);
fwrite (c->buffer, c->len, 1, stdout); fwrite (c->buffer, c->len, 1, stdout);
putc ('\n', stdout); putc ('\n', stdout);
c->len = 0; c->len = 0;
} }
@ -162,10 +162,10 @@ print_line (client_t c, const char *line)
print_fd_and_time (c->fd); print_fd_and_time (c->fd);
if (c->buffer && c->len) if (c->buffer && c->len)
{ {
fwrite (c->buffer, c->len, 1, stdout); fwrite (c->buffer, c->len, 1, stdout);
c->len = 0; c->len = 0;
} }
fwrite (line, s - line + 1, 1, stdout); fwrite (line, s - line + 1, 1, stdout);
line = s + 1; line = s + 1;
} }
n = strlen (line); n = strlen (line);
@ -188,12 +188,12 @@ static void
print_version (int with_help) print_version (int with_help)
{ {
fputs (MYVERSION_LINE "\n" fputs (MYVERSION_LINE "\n"
"Copyright (C) 2004 Free Software Foundation, Inc.\n" "Copyright (C) 2012 Free Software Foundation, Inc.\n"
"This program comes with ABSOLUTELY NO WARRANTY.\n" "This program comes with ABSOLUTELY NO WARRANTY.\n"
"This is free software, and you are welcome to redistribute it\n" "This is free software, and you are welcome to redistribute it\n"
"under certain conditions. See the file COPYING for details.\n", "under certain conditions. See the file COPYING for details.\n",
stdout); stdout);
if (with_help) if (with_help)
fputs ("\n" fputs ("\n"
"Usage: " PGM " [OPTIONS] SOCKETNAME\n" "Usage: " PGM " [OPTIONS] SOCKETNAME\n"
@ -204,11 +204,11 @@ print_version (int with_help)
" --version print version of the program and exit\n" " --version print version of the program and exit\n"
" --help display this help and exit\n" " --help display this help and exit\n"
BUGREPORT_LINE, stdout ); BUGREPORT_LINE, stdout );
exit (0); exit (0);
} }
int int
main (int argc, char **argv) main (int argc, char **argv)
{ {
int last_argc = -1; int last_argc = -1;
@ -219,7 +219,7 @@ main (int argc, char **argv)
int server; int server;
int flags; int flags;
client_t client_list = NULL; client_t client_list = NULL;
if (argc) if (argc)
{ {
argc--; argv++; argc--; argv++;
@ -246,8 +246,8 @@ main (int argc, char **argv)
force = 1; force = 1;
argc--; argv++; argc--; argv++;
} }
} }
if (argc != 1) if (argc != 1)
{ {
fprintf (stderr, "usage: " PGM " socketname\n"); fprintf (stderr, "usage: " PGM " socketname\n");
@ -272,7 +272,7 @@ main (int argc, char **argv)
die ("fcntl (F_GETFL) failed: %s\n", strerror (errno)); die ("fcntl (F_GETFL) failed: %s\n", strerror (errno));
if ( fcntl (server, F_SETFL, (flags | O_NONBLOCK)) == -1) if ( fcntl (server, F_SETFL, (flags | O_NONBLOCK)) == -1)
die ("fcntl (F_SETFL) failed: %s\n", strerror (errno)); die ("fcntl (F_SETFL) failed: %s\n", strerror (errno));
memset (&srvr_addr, 0, sizeof srvr_addr); memset (&srvr_addr, 0, sizeof srvr_addr);
srvr_addr.sun_family = AF_LOCAL; srvr_addr.sun_family = AF_LOCAL;
@ -280,10 +280,10 @@ main (int argc, char **argv)
srvr_addr.sun_path[sizeof (srvr_addr.sun_path) - 1] = 0; srvr_addr.sun_path[sizeof (srvr_addr.sun_path) - 1] = 0;
addrlen = SUN_LEN (&srvr_addr); addrlen = SUN_LEN (&srvr_addr);
again: again:
if (bind (server, (struct sockaddr *) &srvr_addr, addrlen)) if (bind (server, (struct sockaddr *) &srvr_addr, addrlen))
{ {
if (errno == EADDRINUSE && force) if (errno == EADDRINUSE && force)
{ {
force = 0; force = 0;
@ -320,7 +320,7 @@ main (int argc, char **argv)
continue; /* Ignore any errors. */ continue; /* Ignore any errors. */
if (FD_ISSET (server, &rfds)) /* New connection. */ if (FD_ISSET (server, &rfds)) /* New connection. */
{ {
struct sockaddr_un clnt_addr; struct sockaddr_un clnt_addr;
int fd; int fd;
@ -335,7 +335,7 @@ main (int argc, char **argv)
close (fd); close (fd);
printf ("[connection request denied: too many connections]\n"); printf ("[connection request denied: too many connections]\n");
} }
else else
{ {
for (client = client_list; client && client->fd != -1; for (client = client_list; client && client->fd != -1;
client = client->next) client = client->next)
@ -355,7 +355,7 @@ main (int argc, char **argv)
{ {
char line[256]; char line[256];
int n; int n;
n = read (client->fd, line, sizeof line - 1); n = read (client->fd, line, sizeof line - 1);
if (n < 0) if (n < 0)
{ {
@ -366,7 +366,7 @@ main (int argc, char **argv)
close (client->fd); close (client->fd);
client->fd = -1; client->fd = -1;
} }
else if (!n) else if (!n)
{ {
print_line (client, NULL); /* flush */ print_line (client, NULL); /* flush */
close (client->fd); close (client->fd);