Changes by Kazuhiro Fujieda <fujieda@jaist.ac.jp>
* assert.cc (__assert): Reduce dependency on newlib. * exec.cc: Eliminate unnecessary inclusion of ctype.h. * glob.c: Ditto. * hinfo.cc: Ditto. * init.cc: Ditto. * strace.cc: Ditto. * tty.cc: Ditto. * grp.cc (parse_grp): Eliminate atoi. * passwd.cc (grab_int): Ditto. * grp.cc (getgroups): Eliminate str{n,}casecmp. * path.cc (get_raw_device_number): Ditto. * path.cc (sort_by_native_name): Ditto. * spawn.cc (iscmd): Ditto. * uinfo.cc (internal_getlogin): Ditto.
This commit is contained in:
parent
51b2ec5d03
commit
ebbd4e8fb3
@ -1,3 +1,20 @@
|
|||||||
|
2000-06-28 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
|
||||||
|
|
||||||
|
* assert.cc (__assert): Reduce dependency on newlib.
|
||||||
|
* exec.cc: Eliminate unnecessary inclusion of ctype.h.
|
||||||
|
* glob.c: Ditto.
|
||||||
|
* hinfo.cc: Ditto.
|
||||||
|
* init.cc: Ditto.
|
||||||
|
* strace.cc: Ditto.
|
||||||
|
* tty.cc: Ditto.
|
||||||
|
* grp.cc (parse_grp): Eliminate atoi.
|
||||||
|
* passwd.cc (grab_int): Ditto.
|
||||||
|
* grp.cc (getgroups): Eliminate str{n,}casecmp.
|
||||||
|
* path.cc (get_raw_device_number): Ditto.
|
||||||
|
* path.cc (sort_by_native_name): Ditto.
|
||||||
|
* spawn.cc (iscmd): Ditto.
|
||||||
|
* uinfo.cc (internal_getlogin): Ditto.
|
||||||
|
|
||||||
Sat Jul 1 11:43:32 2000 Christopher Faylor <cgf@cygnus.com>
|
Sat Jul 1 11:43:32 2000 Christopher Faylor <cgf@cygnus.com>
|
||||||
|
|
||||||
* binmode.c (cygwin_premain0): Fix erroneous clearing of bit.
|
* binmode.c (cygwin_premain0): Fix erroneous clearing of bit.
|
||||||
|
@ -32,15 +32,14 @@ __assert (const char *file, int line, const char *failedexpr)
|
|||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
buf = (char *) alloca (100 + strlen (failedexpr));
|
buf = (char *) alloca (100 + strlen (failedexpr));
|
||||||
siprintf (buf, "Failed assertion\n\t%s\nat line %d of file %s",
|
__small_sprintf (buf, "Failed assertion\n\t%s\nat line %d of file %s",
|
||||||
failedexpr, line, file);
|
failedexpr, line, file);
|
||||||
MessageBox (NULL, buf, NULL, MB_OK | MB_ICONERROR | MB_TASKMODAL);
|
MessageBox (NULL, buf, NULL, MB_OK | MB_ICONERROR | MB_TASKMODAL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CloseHandle (h);
|
CloseHandle (h);
|
||||||
(void) fiprintf (stderr,
|
small_printf ("assertion \"%s\" failed: file \"%s\", line %d\n",
|
||||||
"assertion \"%s\" failed: file \"%s\", line %d\n",
|
|
||||||
failedexpr, file, line);
|
failedexpr, file, line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@ details. */
|
|||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@ details. */
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <ctype.h>
|
|
||||||
#include <process.h>
|
#include <process.h>
|
||||||
#include "winsup.h"
|
#include "winsup.h"
|
||||||
|
|
||||||
|
@ -70,7 +70,6 @@
|
|||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <glob.h>
|
#include <glob.h>
|
||||||
|
@ -66,7 +66,7 @@ parse_grp (struct group &grp, const char *line)
|
|||||||
if (!strlen (grp.gr_passwd))
|
if (!strlen (grp.gr_passwd))
|
||||||
grp.gr_passwd = NULL;
|
grp.gr_passwd = NULL;
|
||||||
|
|
||||||
grp.gr_gid = atoi (dp);
|
grp.gr_gid = strtol (dp, NULL, 10);
|
||||||
dp = strchr (dp, ':');
|
dp = strchr (dp, ':');
|
||||||
if (dp)
|
if (dp)
|
||||||
{
|
{
|
||||||
@ -249,7 +249,7 @@ getgroups (int gidsetsize, gid_t *grouplist, gid_t gid, const char *username)
|
|||||||
}
|
}
|
||||||
else if (group_buf[i].gr_mem)
|
else if (group_buf[i].gr_mem)
|
||||||
for (int gi = 0; group_buf[i].gr_mem[gi]; ++gi)
|
for (int gi = 0; group_buf[i].gr_mem[gi]; ++gi)
|
||||||
if (! strcasecmp (username, group_buf[i].gr_mem[gi]))
|
if (strcasematch (username, group_buf[i].gr_mem[gi]))
|
||||||
{
|
{
|
||||||
if (cnt < gidsetsize)
|
if (cnt < gidsetsize)
|
||||||
grouplist[cnt] = group_buf[i].gr_gid;
|
grouplist[cnt] = group_buf[i].gr_gid;
|
||||||
|
@ -9,7 +9,6 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
|||||||
details. */
|
details. */
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <ctype.h>
|
|
||||||
#include "winsup.h"
|
#include "winsup.h"
|
||||||
|
|
||||||
extern HMODULE cygwin_hmodule;
|
extern HMODULE cygwin_hmodule;
|
||||||
|
@ -57,7 +57,7 @@ static int
|
|||||||
grab_int (char **p)
|
grab_int (char **p)
|
||||||
{
|
{
|
||||||
char *src = *p;
|
char *src = *p;
|
||||||
int val = atoi (src);
|
int val = strtol (src, NULL, 10);
|
||||||
while (*src && *src != ':' && *src != '\n')
|
while (*src && *src != ':' && *src != '\n')
|
||||||
src++;
|
src++;
|
||||||
if (*src == ':')
|
if (*src == ':')
|
||||||
|
@ -438,12 +438,12 @@ get_raw_device_number (const char *uxname, const char *w32path, int &unit)
|
|||||||
{
|
{
|
||||||
DWORD devn = FH_BAD;
|
DWORD devn = FH_BAD;
|
||||||
|
|
||||||
if (strncasecmp (w32path, "\\\\.\\tape", 8) == 0)
|
if (strncasematch (w32path, "\\\\.\\tape", 8))
|
||||||
{
|
{
|
||||||
devn = FH_TAPE;
|
devn = FH_TAPE;
|
||||||
unit = digits (w32path + 8);
|
unit = digits (w32path + 8);
|
||||||
// norewind tape devices have leading n in name
|
// norewind tape devices have leading n in name
|
||||||
if (! strncasecmp (uxname, "/dev/n", 6))
|
if (strncasematch (uxname, "/dev/n", 6))
|
||||||
unit += 128;
|
unit += 128;
|
||||||
}
|
}
|
||||||
else if (isdrive (w32path + 4))
|
else if (isdrive (w32path + 4))
|
||||||
@ -451,7 +451,7 @@ get_raw_device_number (const char *uxname, const char *w32path, int &unit)
|
|||||||
devn = FH_FLOPPY;
|
devn = FH_FLOPPY;
|
||||||
unit = tolower (w32path[4]) - 'a';
|
unit = tolower (w32path[4]) - 'a';
|
||||||
}
|
}
|
||||||
else if (strncasecmp (w32path, "\\\\.\\physicaldrive", 17) == 0)
|
else if (strncasematch (w32path, "\\\\.\\physicaldrive", 17))
|
||||||
{
|
{
|
||||||
devn = FH_FLOPPY;
|
devn = FH_FLOPPY;
|
||||||
unit = digits (w32path + 17) + 128;
|
unit = digits (w32path + 17) + 128;
|
||||||
@ -1566,7 +1566,7 @@ sort_by_native_name (const void *a, const void *b)
|
|||||||
|
|
||||||
/* The two paths were the same length, so just determine normal
|
/* The two paths were the same length, so just determine normal
|
||||||
lexical sorted order. */
|
lexical sorted order. */
|
||||||
res = strcasecmp (ap->posix_path, bp->posix_path);
|
res = strcmp (ap->native_path, bp->native_path);
|
||||||
|
|
||||||
if (res == 0)
|
if (res == 0)
|
||||||
{
|
{
|
||||||
|
@ -169,7 +169,7 @@ iscmd (const char *argv0, const char *what)
|
|||||||
n = strlen (argv0) - strlen (what);
|
n = strlen (argv0) - strlen (what);
|
||||||
if (n >= 2 && argv0[1] != ':')
|
if (n >= 2 && argv0[1] != ':')
|
||||||
return 0;
|
return 0;
|
||||||
return n >= 0 && strcasecmp (argv0 + n, what) == 0 &&
|
return n >= 0 && strcasematch (argv0 + n, what) &&
|
||||||
(n == 0 || isdirsep (argv0[n - 1]));
|
(n == 0 || isdirsep (argv0[n - 1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@ This software is a copyrighted work licensed under the terms of the
|
|||||||
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
||||||
details. */
|
details. */
|
||||||
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "winsup.h"
|
#include "winsup.h"
|
||||||
|
@ -11,7 +11,6 @@ details. */
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <utmp.h>
|
#include <utmp.h>
|
||||||
#include <ctype.h>
|
|
||||||
#include "winsup.h"
|
#include "winsup.h"
|
||||||
|
|
||||||
extern fhandler_tty_master *tty_master;
|
extern fhandler_tty_master *tty_master;
|
||||||
|
@ -41,7 +41,7 @@ internal_getlogin (struct pinfo *pi)
|
|||||||
if ((env = getenv ("USERDOMAIN")) != NULL)
|
if ((env = getenv ("USERDOMAIN")) != NULL)
|
||||||
strcpy (pi->domain, env);
|
strcpy (pi->domain, env);
|
||||||
/* Trust only if usernames are identical */
|
/* Trust only if usernames are identical */
|
||||||
if (!strcasecmp (pi->username, buf) && pi->domain[0] && pi->logsrv[0])
|
if (strcasematch (pi->username, buf) && pi->domain[0] && pi->logsrv[0])
|
||||||
debug_printf ("Domain: %s, Logon Server: %s", pi->domain, pi->logsrv);
|
debug_printf ("Domain: %s, Logon Server: %s", pi->domain, pi->logsrv);
|
||||||
/* If that failed, try to get that info from NetBIOS */
|
/* If that failed, try to get that info from NetBIOS */
|
||||||
else if (!NetWkstaUserGetInfo (NULL, 1, (LPBYTE *)&wui))
|
else if (!NetWkstaUserGetInfo (NULL, 1, (LPBYTE *)&wui))
|
||||||
@ -53,7 +53,7 @@ internal_getlogin (struct pinfo *pi)
|
|||||||
wcstombs (pi->domain, wui->wkui1_logon_domain,
|
wcstombs (pi->domain, wui->wkui1_logon_domain,
|
||||||
(wcslen (wui->wkui1_logon_domain) + 1) * sizeof (WCHAR));
|
(wcslen (wui->wkui1_logon_domain) + 1) * sizeof (WCHAR));
|
||||||
/* Save values in environment */
|
/* Save values in environment */
|
||||||
if (strcasecmp (pi->username, "SYSTEM")
|
if (!strcasematch (pi->username, "SYSTEM")
|
||||||
&& pi->domain[0] && pi->logsrv[0])
|
&& pi->domain[0] && pi->logsrv[0])
|
||||||
{
|
{
|
||||||
LPUSER_INFO_3 ui = NULL;
|
LPUSER_INFO_3 ui = NULL;
|
||||||
@ -139,7 +139,7 @@ internal_getlogin (struct pinfo *pi)
|
|||||||
PSID psid = (PSID) psidbuf;
|
PSID psid = (PSID) psidbuf;
|
||||||
|
|
||||||
pi->psid = (PSID) pi->sidbuf;
|
pi->psid = (PSID) pi->sidbuf;
|
||||||
if (strcasecmp (pi->username, "SYSTEM")
|
if (!strcasematch (pi->username, "SYSTEM")
|
||||||
&& pi->domain[0] && pi->logsrv[0])
|
&& pi->domain[0] && pi->logsrv[0])
|
||||||
{
|
{
|
||||||
if (get_registry_hive_path (pi->psid, buf))
|
if (get_registry_hive_path (pi->psid, buf))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user