]> TLD Linux GIT Repositories - packages/coreutils.git/blob - coreutils-getgid.patch
- reworked for coreutils 8.16, fixes invalid-opt test
[packages/coreutils.git] / coreutils-getgid.patch
1 diff -urN coreutils-8.16.orig//README coreutils-8.16/README
2 --- coreutils-8.16.orig//README 2012-03-24 18:22:13.000000000 +0000
3 +++ coreutils-8.16/README       2012-04-18 09:07:17.417662632 +0000
4 @@ -9,7 +9,7 @@
5  
6    [ arch base64 basename cat chcon chgrp chmod chown chroot cksum comm cp
7    csplit cut date dd df dir dircolors dirname du echo env expand expr
8 -  factor false fmt fold groups head hostid hostname id install join kill
9 +  factor false fmt fold getgid groups head hostid hostname id install join kill
10    link ln logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl nohup
11    nproc od paste pathchk pinky pr printenv printf ptx pwd readlink realpath
12    rm rmdir runcon seq sha1sum sha224sum sha256sum sha384sum sha512sum shred
13 diff -urN coreutils-8.16.orig//man/Makefile.am coreutils-8.16/man/Makefile.am
14 --- coreutils-8.16.orig//man/Makefile.am        2012-03-26 09:50:41.000000000 +0000
15 +++ coreutils-8.16/man/Makefile.am      2012-04-18 09:07:17.410850573 +0000
16 @@ -60,6 +60,7 @@
17  false.1:       $(common_dep)   $(srcdir)/false.x       ../src/false.c
18  fmt.1:         $(common_dep)   $(srcdir)/fmt.x         ../src/fmt.c
19  fold.1:                $(common_dep)   $(srcdir)/fold.x        ../src/fold.c
20 +getgid.1:      $(common_dep)   $(srcdir)/getgid.x      ../src/getgid.c
21  groups.1:      $(common_dep)   $(srcdir)/groups.x      ../src/groups.c
22  head.1:                $(common_dep)   $(srcdir)/head.x        ../src/head.c
23  hostid.1:      $(common_dep)   $(srcdir)/hostid.x      ../src/hostid.c
24 diff -urN coreutils-8.16.orig//man/getgid.1 coreutils-8.16/man/getgid.1
25 --- coreutils-8.16.orig//man/getgid.1   1970-01-01 00:00:00.000000000 +0000
26 +++ coreutils-8.16/man/getgid.1 2012-04-18 09:07:17.410850573 +0000
27 @@ -0,0 +1,22 @@
28 +.TH GETGID "1" "October 2002" "getgid (coreutils) 4.5.3" "User Commands"
29 +.SH NAME
30 +getgid \- print ID of given group
31 +.SH SYNOPSIS
32 +.B getgid
33 +\fIGROUPNAME\fR
34 +.SH DESCRIPTION
35 +.PP
36 +Print group ID for GROUPNAME.
37 +.PP
38 +Without any OPTION, print usage information.
39 +.SH AUTHOR
40 +Written by Artur Frysiak.
41 +.SH "REPORTING BUGS"
42 +Report bugs to <feedback@pld-linux.org>.
43 +.SH COPYRIGHT
44 +Copyright \(co 1999 Artur Frysiak.
45 +.br
46 +This is free software; see the source for copying conditions.  There is NO
47 +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
48 +.SH "SEE ALSO"
49 +.BR id (1)
50 diff -urN coreutils-8.16.orig//man/getgid.x coreutils-8.16/man/getgid.x
51 --- coreutils-8.16.orig//man/getgid.x   1970-01-01 00:00:00.000000000 +0000
52 +++ coreutils-8.16/man/getgid.x 2012-04-18 09:07:17.410850573 +0000
53 @@ -0,0 +1,4 @@
54 +[NAME]
55 +getgid \- print ID of given group
56 +[DESCRIPTION]
57 +.\" Add any additional description here
58 diff -urN coreutils-8.16.orig//man/pl/getgid.1 coreutils-8.16/man/pl/getgid.1
59 --- coreutils-8.16.orig//man/pl/getgid.1        1970-01-01 00:00:00.000000000 +0000
60 +++ coreutils-8.16/man/pl/getgid.1      2012-04-18 09:07:17.410850573 +0000
61 @@ -0,0 +1,22 @@
62 +.TH GETGID "1" "Pa¼dziernik 2002" "getgid (coreutils) 4.5.3" "Polecenia u¿ytkownika"
63 +.SH NAZWA
64 +getgid \- wypisuje identyfikator podanej grupy
65 +.SH SK£ADNIA
66 +.B getgid
67 +\fINAZWA-GRUPY\fR
68 +.SH OPIS
69 +.PP
70 +Wypisuje identyfikator grupy NAZWA-GRUPY.
71 +.PP
72 +Bez ¿adnych opcji podaje sposób u¿ycia.
73 +.SH AUTOR
74 +Napisane przez Artura Frysiaka.
75 +.SH "ZG£ASZANIE B£ÊDÓW"
76 +B³êdy proszê zg³aszaæ (w jêz. polskim lub angielskim) pod <feedback@pld-linux.org>.
77 +.SH COPYRIGHT
78 +Copyright \(co 1999 Artur Frysiak.
79 +.br
80 +This is free software; see the source for copying conditions.  There is NO
81 +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
82 +.SH ZOBACZ TAK¯E
83 +.BR id (1)
84 diff -urN coreutils-8.16.orig//po/POTFILES.in coreutils-8.16/po/POTFILES.in
85 --- coreutils-8.16.orig//po/POTFILES.in 2012-03-24 18:22:13.000000000 +0000
86 +++ coreutils-8.16/po/POTFILES.in       2012-04-18 09:07:17.412850440 +0000
87 @@ -66,6 +66,7 @@
88  src/find-mount-point.c
89  src/fmt.c
90  src/fold.c
91 +src/getgid.c
92  src/getlimits.c
93  src/group-list.c
94  src/groups.c
95 diff -urN coreutils-8.16.orig//po/pl.po coreutils-8.16/po/pl.po
96 --- coreutils-8.16.orig//po/pl.po       2012-03-26 12:08:45.000000000 +0000
97 +++ coreutils-8.16/po/pl.po     2012-04-18 09:07:17.417662632 +0000
98 @@ -4109,6 +4109,15 @@
99  "  \\0NNN   znak o kodzie ASCII wynoszącym NNN (ósemkowo, 1 do 3 cyfr)\n"
100  "  \\xHH    znak o kodzie ASCII wynoszącym HH (szestnastkowo, 1 do 2 cyfr)\n"
101  
102 +#: src/getgid.c:37
103 +#, c-format
104 +msgid ""
105 +"Usage:\n"
106 +"\t%s groupname\n"
107 +msgstr ""
108 +"Składnia:\n"
109 +"\t%s nazwa-grupy\n"
110 +
111  #. This is a proper name. See the gettext manual, section Names.
112  #: src/env.c:32 src/printenv.c:45 src/whoami.c:35
113  msgid "Richard Mlynarik"
114 diff -urN coreutils-8.16.orig//src/Makefile.am coreutils-8.16/src/Makefile.am
115 --- coreutils-8.16.orig//src/Makefile.am        2012-03-24 18:22:13.000000000 +0000
116 +++ coreutils-8.16/src/Makefile.am      2012-04-18 09:07:17.411850524 +0000
117 @@ -69,6 +69,7 @@
118    false                \
119    fmt          \
120    fold         \
121 +  getgid       \
122    ginstall     \
123    groups       \
124    head         \
125 diff -urN coreutils-8.16.orig//src/getgid.c coreutils-8.16/src/getgid.c
126 --- coreutils-8.16.orig//src/getgid.c   1970-01-01 00:00:00.000000000 +0000
127 +++ coreutils-8.16/src/getgid.c 2012-04-18 09:44:16.000000000 +0000
128 @@ -0,0 +1,88 @@
129 +/* getgid - print GID of given group
130 +   Copyright (C) 1999 Artur Frysiak <wiget@pld-linux.org>
131 +
132 +   This program is free software; you can redistribute it and/or modify
133 +   it under the terms of the GNU General Public License as published by
134 +   the Free Software Foundation; either version 2, or (at your option)
135 +   any later version.
136 +
137 +   This program is distributed in the hope that it will be useful,
138 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
139 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
140 +   GNU General Public License for more details.
141 +
142 +   You should have received a copy of the GNU General Public License
143 +   along with this program; if not, write to the Free Software Foundation,
144 +   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
145 +
146 +#include <config.h>
147 +#include <grp.h>
148 +#include <getopt.h>
149 +#include <sys/types.h>
150 +
151 +#include "system.h"
152 +#include "error.h"
153 +#include "long-options.h"
154 +#include "quote.h"
155 +
156 +/* The official name of this program (e.g., no 'g' prefix).  */
157 +#define PROGRAM_NAME "getgid"
158 +
159 +#define AUTHORS proper_name ("Artur Frysiak")
160 +
161 +void
162 +usage (int status)
163 +{
164 +  if (status != EXIT_SUCCESS)
165 +    emit_try_help ();
166 +  else
167 +    {
168 +      printf (_("Usage: %s [OPTION]... [GROUPNAME]...\n"), program_name);
169 +      fputs (_("\
170 +Prints ID of given group name.\
171 +\n\
172 +"), stdout);
173 +      fputs (HELP_OPTION_DESCRIPTION, stdout);
174 +      fputs (VERSION_OPTION_DESCRIPTION, stdout);
175 +      emit_ancillary_info ();
176 +    }
177 +  exit (status);
178 +}
179 +
180 +int
181 +main (int argc, char **argv)
182 +{
183 +  struct group *gr;
184 +
185 +  initialize_main (&argc, &argv);
186 +  set_program_name (argv[0]);
187 +  setlocale (LC_ALL, "");
188 +  bindtextdomain (PACKAGE, LOCALEDIR);
189 +  textdomain (PACKAGE);
190 +
191 +  atexit (close_stdout);
192 +
193 +  parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, Version,
194 +                      usage, AUTHORS, (char const *) NULL);
195 +  if (getopt_long (argc, argv, "", NULL, NULL) != -1)
196 +    usage (EXIT_FAILURE);
197 +
198 +  if (argc < optind + 1)
199 +    {
200 +      error (0, 0, _("missing operand"));
201 +      usage (EXIT_FAILURE);
202 +    }
203 +
204 +  if (optind + 2 < argc)
205 +    {
206 +      error (0, 0, _("extra operand %s"), quote (argv[optind + 2]));
207 +      usage (EXIT_FAILURE);
208 +    }
209 +
210 +  gr = getgrnam(argv[optind]);
211 +  if (gr == NULL)
212 +    error (EXIT_FAILURE, errno, _("cannot find group name %s"), quote (argv[optind]));
213 +  else
214 +    printf("%lu\n", (unsigned long int) gr->gr_gid);
215 +  exit(EXIT_SUCCESS);
216 +}