]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/fush/files/openpty.patch
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / fush / files / openpty.patch
1
2 #
3 # Patch managed by http://www.holgerschurig.de/patcher.html
4 #
5
6 Index: fush-0-9-0/configure.in
7 ===================================================================
8 --- fush-0-9-0.orig/configure.in        2004-01-25 18:52:01.000000000 -0600
9 +++ fush-0-9-0/configure.in     2005-01-18 13:41:06.000000000 -0600
10 @@ -27,7 +27,7 @@
11  # Checks for header files.
12  AC_HEADER_STDC
13  AC_HEADER_SYS_WAIT
14 -AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/ioctl.h sys/param.h syslog.h unistd.h string.h sys/types.h syslog.h glob.h time.h errno.h libutil.h termios.h])
15 +AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/ioctl.h sys/param.h syslog.h unistd.h string.h sys/types.h syslog.h glob.h time.h errno.h libutil.h pty.h termios.h])
16  
17  # Checks for typedefs, structures, and compiler characteristics.
18  AC_C_CONST
19 @@ -35,6 +35,14 @@
20  AC_STRUCT_TM
21  AC_TYPE_UID_T
22  AC_CHECK_TYPE( mode_t, unsigned short )
23 +AC_CHECK_DECLS( [user_from_uid], [], [], [
24 +#if HAVE_LIBUTIL_H
25 +# include <libutil.h>
26 +#endif] )
27 +if test x"$HAVE_DECL_USER_FROM_UID" = "x"; then
28 +  PWCACHE_OBJS="pwcache.o"
29 +fi
30 +AC_SUBST(PWCACHE_OBJS)
31  
32  # Checks for library functions.
33  AC_FUNC_FORK
34 Index: fush-0-9-0/src/fushtools.c
35 ===================================================================
36 --- fush-0-9-0.orig/src/fushtools.c     2004-01-25 18:52:01.000000000 -0600
37 +++ fush-0-9-0/src/fushtools.c  2005-01-18 13:41:30.000000000 -0600
38 @@ -23,7 +23,13 @@
39  #include "linklist.h"
40  #include "md5.h"
41  #include <pwd.h>
42 -#include <libutil.h>
43 +#if HAVE_LIBUTIL_H
44 +# include <libutil.h>
45 +#else
46 +# include <pty.h>
47 +# include <utmp.h>
48 +# include "pwcache.h"
49 +#endif
50  #include <termios.h>
51  
52  extern List g_replace;
53 Index: fush-0-9-0/src/pwcache.c
54 ===================================================================
55 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
56 +++ fush-0-9-0/src/pwcache.c    2005-01-18 15:38:02.000000000 -0600
57 @@ -0,0 +1,88 @@
58 +// Copyright (C) 1992-1998 by Michael K. Johnson, johnsonm@redhat.com
59 +// Note: most likely none of his code remains
60 +//
61 +// Copyright 2002, Albert Cahalan
62 +//
63 +// This file is placed under the conditions of the GNU Library
64 +// General Public License, version 2, or any later version.
65 +// See file COPYING for information on distribution conditions.
66 +
67 +#include <stdio.h>
68 +#include <sys/types.h>
69 +#include <stdlib.h>
70 +#include <pwd.h>
71 +//#include "alloc.h"
72 +#include "pwcache.h"
73 +#include <grp.h>
74 +
75 +// might as well fill cache lines... else we waste memory anyway
76 +
77 +#define        HASHSIZE        64              /* power of 2 */
78 +#define        HASH(x)         ((x) & (HASHSIZE - 1))
79 +
80 +#define NAMESIZE       20
81 +#define NAMELENGTH     "19"
82 +
83 +static struct pwbuf {
84 +    struct pwbuf *next;
85 +    uid_t uid;
86 +    char name[NAMESIZE];
87 +} *pwhash[HASHSIZE];
88 +
89 +char *user_from_uid(uid_t uid, int nouser)
90 +{
91 +    struct pwbuf **p;
92 +    struct passwd *pw;
93 +    char *ret;
94 +
95 +    p = &pwhash[HASH(uid)];
96 +    while (*p) {
97 +       if ((*p)->uid == uid)
98 +           return((*p)->name);
99 +       p = &(*p)->next;
100 +    }
101 +    *p = (struct pwbuf *) malloc(sizeof(struct pwbuf));
102 +    (*p)->uid = uid;
103 +    ret = (*p)->name;
104 +    if ((pw = getpwuid(uid)) == NULL)
105 +       if (nouser)
106 +           ret = NULL;
107 +       else
108 +           sprintf((*p)->name, "#%d", uid);
109 +    else
110 +       sprintf((*p)->name, "%-." NAMELENGTH "s", pw->pw_name);
111 +    (*p)->next = NULL;
112 +    return ret;
113 +}
114 +
115 +static struct grpbuf {
116 +    struct grpbuf *next;
117 +    gid_t gid;
118 +    char name[NAMESIZE];
119 +} *grphash[HASHSIZE];
120 +
121 +char *group_from_gid(gid_t gid, int nogroup)
122 +{
123 +    struct grpbuf **g;
124 +    struct group *gr;
125 +    char *ret;
126 +
127 +    g = &grphash[HASH(gid)];
128 +    while (*g) {
129 +       if ((*g)->gid == gid)
130 +           return((*g)->name);
131 +       g = &(*g)->next;
132 +    }
133 +    *g = (struct grpbuf *) malloc(sizeof(struct grpbuf));
134 +    (*g)->gid = gid;
135 +    ret = (*g)->name;
136 +    if ((gr = getgrgid(gid)) == NULL)
137 +       if (nogroup)
138 +          ret = NULL;
139 +       else
140 +           sprintf((*g)->name, "#%d", gid);
141 +    else
142 +       sprintf((*g)->name, "%-." NAMELENGTH "s", gr->gr_name);
143 +    (*g)->next = NULL;
144 +    return ret;
145 +}
146 Index: fush-0-9-0/src/pwcache.h
147 ===================================================================
148 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
149 +++ fush-0-9-0/src/pwcache.h    2005-01-18 13:45:17.000000000 -0600
150 @@ -0,0 +1,9 @@
151 +#ifndef PROCPS_PROC_PWCACHE_H
152 +#define PROCPS_PROC_PWCACHE_H
153 +
154 +#include <sys/types.h>
155 +
156 +extern char *user_from_uid(uid_t uid, int nouser);
157 +extern char *group_from_gid(gid_t gid, int nogroup);
158 +
159 +#endif
160 Index: fush-0-9-0/src/Makefile.in
161 ===================================================================
162 --- fush-0-9-0.orig/src/Makefile.in     2004-01-25 18:52:01.000000000 -0600
163 +++ fush-0-9-0/src/Makefile.in  2005-01-18 13:37:23.000000000 -0600
164 @@ -1,7 +1,7 @@
165  CC =           @CC@
166  CFLAGS =       -Wall @CFLAGS@ @CPPFLAGS@ @DEFS@
167  LDFLAGS =      @LDFLAGS@ @LIBS@
168 -OBJS =         fush.o fushtools.o fuparse.o md5.o linklist.o
169 +OBJS =         fush.o fushtools.o fuparse.o md5.o linklist.o @PWCACHE_OBJS@
170  ADMOBJS = fushadmin.o md5.o
171  HEADERS = fush.h
172