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:
Corinna Vinschen 2000-07-01 17:30:35 +00:00
parent 51b2ec5d03
commit ebbd4e8fb3
13 changed files with 31 additions and 21 deletions

View File

@ -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>
* binmode.c (cygwin_premain0): Fix erroneous clearing of bit.

View File

@ -32,16 +32,15 @@ __assert (const char *file, int line, const char *failedexpr)
char *buf;
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);
MessageBox (NULL, buf, NULL, MB_OK | MB_ICONERROR | MB_TASKMODAL);
}
else
{
CloseHandle (h);
(void) fiprintf (stderr,
"assertion \"%s\" failed: file \"%s\", line %d\n",
failedexpr, file, line);
small_printf ("assertion \"%s\" failed: file \"%s\", line %d\n",
failedexpr, file, line);
}
abort ();

View File

@ -14,7 +14,6 @@ details. */
#include <sys/socket.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <unistd.h>
#include <fcntl.h>

View File

@ -11,7 +11,6 @@ details. */
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <ctype.h>
#include <process.h>
#include "winsup.h"

View File

@ -70,7 +70,6 @@
#include <sys/param.h>
#include <sys/stat.h>
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
#include <glob.h>

View File

@ -66,7 +66,7 @@ parse_grp (struct group &grp, const char *line)
if (!strlen (grp.gr_passwd))
grp.gr_passwd = NULL;
grp.gr_gid = atoi (dp);
grp.gr_gid = strtol (dp, NULL, 10);
dp = strchr (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)
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)
grouplist[cnt] = group_buf[i].gr_gid;

View File

@ -9,7 +9,6 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
#include <stdlib.h>
#include <ctype.h>
#include "winsup.h"
extern HMODULE cygwin_hmodule;

View File

@ -57,7 +57,7 @@ static int
grab_int (char **p)
{
char *src = *p;
int val = atoi (src);
int val = strtol (src, NULL, 10);
while (*src && *src != ':' && *src != '\n')
src++;
if (*src == ':')

View File

@ -438,12 +438,12 @@ get_raw_device_number (const char *uxname, const char *w32path, int &unit)
{
DWORD devn = FH_BAD;
if (strncasecmp (w32path, "\\\\.\\tape", 8) == 0)
if (strncasematch (w32path, "\\\\.\\tape", 8))
{
devn = FH_TAPE;
unit = digits (w32path + 8);
// norewind tape devices have leading n in name
if (! strncasecmp (uxname, "/dev/n", 6))
if (strncasematch (uxname, "/dev/n", 6))
unit += 128;
}
else if (isdrive (w32path + 4))
@ -451,7 +451,7 @@ get_raw_device_number (const char *uxname, const char *w32path, int &unit)
devn = FH_FLOPPY;
unit = tolower (w32path[4]) - 'a';
}
else if (strncasecmp (w32path, "\\\\.\\physicaldrive", 17) == 0)
else if (strncasematch (w32path, "\\\\.\\physicaldrive", 17))
{
devn = FH_FLOPPY;
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
lexical sorted order. */
res = strcasecmp (ap->posix_path, bp->posix_path);
res = strcmp (ap->native_path, bp->native_path);
if (res == 0)
{

View File

@ -169,7 +169,7 @@ iscmd (const char *argv0, const char *what)
n = strlen (argv0) - strlen (what);
if (n >= 2 && argv0[1] != ':')
return 0;
return n >= 0 && strcasecmp (argv0 + n, what) == 0 &&
return n >= 0 && strcasematch (argv0 + n, what) &&
(n == 0 || isdirsep (argv0[n - 1]));
}

View File

@ -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
details. */
#include <ctype.h>
#include <stdlib.h>
#include <time.h>
#include "winsup.h"

View File

@ -11,7 +11,6 @@ details. */
#include <errno.h>
#include <unistd.h>
#include <utmp.h>
#include <ctype.h>
#include "winsup.h"
extern fhandler_tty_master *tty_master;

View File

@ -41,7 +41,7 @@ internal_getlogin (struct pinfo *pi)
if ((env = getenv ("USERDOMAIN")) != NULL)
strcpy (pi->domain, env);
/* 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);
/* If that failed, try to get that info from NetBIOS */
else if (!NetWkstaUserGetInfo (NULL, 1, (LPBYTE *)&wui))
@ -53,7 +53,7 @@ internal_getlogin (struct pinfo *pi)
wcstombs (pi->domain, wui->wkui1_logon_domain,
(wcslen (wui->wkui1_logon_domain) + 1) * sizeof (WCHAR));
/* Save values in environment */
if (strcasecmp (pi->username, "SYSTEM")
if (!strcasematch (pi->username, "SYSTEM")
&& pi->domain[0] && pi->logsrv[0])
{
LPUSER_INFO_3 ui = NULL;
@ -139,7 +139,7 @@ internal_getlogin (struct pinfo *pi)
PSID psid = (PSID) psidbuf;
pi->psid = (PSID) pi->sidbuf;
if (strcasecmp (pi->username, "SYSTEM")
if (!strcasematch (pi->username, "SYSTEM")
&& pi->domain[0] && pi->logsrv[0])
{
if (get_registry_hive_path (pi->psid, buf))