unified diffs

This commit is contained in:
brad 2000-03-26 22:42:05 +00:00
parent efd46b15f0
commit f750cb89a2
2 changed files with 80 additions and 122 deletions

View File

@ -1,45 +1,28 @@
*** smallfn.c.bak Mon May 19 23:58:11 1997
--- smallfn.c Tue May 20 00:19:28 1997
***************
*** 92,99 ****
}
if (Choice==4)
{
mprintf(MAskNewName);
! gets(Name);
continue;
}
if (Choice==5)
--- 92,103 ----
}
if (Choice==4)
{
+ char *s;
mprintf(MAskNewName);
! *Name = '\0';
! fgets(Name, NM, stdin);
! if ((s = strchr(Name, '\n')) != NULL)
! *s = '\0';
continue;
}
if (Choice==5)
***************
*** 110,116 ****
int GetKey(void)
{
char Str[80];
! gets(Str);
return(Str[0]);
}
--- 114,123 ----
int GetKey(void)
{
char Str[80];
! *Str = '\0';
! fgets(Str, 80, stdin);
! if (*Str == '\n')
! *Str = '\0';
return(Str[0]);
}
--- smallfn.c.orig Sat Apr 17 10:53:02 1999
+++ smallfn.c Sun Mar 26 17:40:24 2000
@@ -92,8 +92,12 @@
}
if (Choice==4)
{
+ char *s;
mprintf(MAskNewName);
- gets(Name);
+ *Name = '\0';
+ fgets(Name, NM, stdin);
+ if ((s = strchr(Name, '\n')) != NULL)
+ *s = '\0';
continue;
}
if (Choice==5)
@@ -110,7 +114,10 @@
int GetKey(void)
{
char Str[80];
- gets(Str);
+ *Str = '\0';
+ fgets(Str, 80, stdin);
+ if (*Str == '\n')
+ *Str = '\0';
return(Str[0]);
}

View File

@ -1,77 +1,52 @@
*** os.c.orig Sat Apr 17 18:53:01 1999
--- os.c Tue Apr 20 04:45:20 1999
***************
*** 82,88 ****
--- 82,91 ----
SetConsoleMode(hConIn,ConInMode);
SetConsoleMode(hConOut,ConOutMode);
#else
+ char *s;
fgets(Str,sizeof(Password)-1,stdin);
+ if ((s = strchr(Str, '\n')) != NULL)
+ *s = '\0';
#endif
}
***************
*** 408,433 ****
}
#endif
#ifdef _UNIX
switch(NewLhd.HostOS)
{
case MS_DOS:
case OS2:
case WIN_32:
if (NewLhd.FileAttr & 0x10)
! NewLhd.FileAttr=0x41ff;
else
if (NewLhd.FileAttr & 1)
! NewLhd.FileAttr=0x816d;
else
! NewLhd.FileAttr=0x81ff;
break;
case UNIX:
break;
default:
if ((NewLhd.Flags & LHD_WINDOWMASK)==LHD_DIRECTORY)
! NewLhd.FileAttr=0x41ff;
else
! NewLhd.FileAttr=0x81ff;
break;
}
#endif
--- 411,443 ----
}
#endif
#ifdef _UNIX
+ static mode_t mask = -1;
+
+ if (mask == (mode_t) -1)
+ {
+ mask = umask(022);
+ (void) umask(mask);
+ }
switch(NewLhd.HostOS)
{
case MS_DOS:
case OS2:
case WIN_32:
if (NewLhd.FileAttr & 0x10)
! NewLhd.FileAttr=0x41ff & ~mask;
else
if (NewLhd.FileAttr & 1)
! NewLhd.FileAttr=0x8124 & ~mask;
else
! NewLhd.FileAttr=0x81b6 & ~mask;
break;
case UNIX:
break;
default:
if ((NewLhd.Flags & LHD_WINDOWMASK)==LHD_DIRECTORY)
! NewLhd.FileAttr=0x41ff & ~mask;
else
! NewLhd.FileAttr=0x81b6 & ~mask;
break;
}
#endif
--- os.c.orig Sat Apr 17 10:53:01 1999
+++ os.c Sun Mar 26 17:40:24 2000
@@ -82,7 +82,10 @@
SetConsoleMode(hConIn,ConInMode);
SetConsoleMode(hConOut,ConOutMode);
#else
+ char *s;
fgets(Str,sizeof(Password)-1,stdin);
+ if ((s = strchr(Str, '\n')) != NULL)
+ *s = '\0';
#endif
}
@@ -408,26 +411,33 @@
}
#endif
#ifdef _UNIX
+ static mode_t mask = -1;
+
+ if (mask == (mode_t) -1)
+ {
+ mask = umask(022);
+ (void) umask(mask);
+ }
switch(NewLhd.HostOS)
{
case MS_DOS:
case OS2:
case WIN_32:
if (NewLhd.FileAttr & 0x10)
- NewLhd.FileAttr=0x41ff;
+ NewLhd.FileAttr=0x41ff & ~mask;
else
if (NewLhd.FileAttr & 1)
- NewLhd.FileAttr=0x816d;
+ NewLhd.FileAttr=0x8124 & ~mask;
else
- NewLhd.FileAttr=0x81ff;
+ NewLhd.FileAttr=0x81b6 & ~mask;
break;
case UNIX:
break;
default:
if ((NewLhd.Flags & LHD_WINDOWMASK)==LHD_DIRECTORY)
- NewLhd.FileAttr=0x41ff;
+ NewLhd.FileAttr=0x41ff & ~mask;
else
- NewLhd.FileAttr=0x81ff;
+ NewLhd.FileAttr=0x81b6 & ~mask;
break;
}
#endif