Use strchr and strlen more often; also use strchr in the init code.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@842 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
parent
deecf43882
commit
83f044fbe0
@ -335,8 +335,6 @@ dostrlen:
|
|||||||
|
|
||||||
jmp short pascal_return
|
jmp short pascal_return
|
||||||
|
|
||||||
%ifndef _INIT
|
|
||||||
|
|
||||||
;************************************************************
|
;************************************************************
|
||||||
; strchr (BYTE *src , int ch);
|
; strchr (BYTE *src , int ch);
|
||||||
|
|
||||||
@ -369,6 +367,7 @@ strchr_found1:
|
|||||||
|
|
||||||
jmp short pascal_return
|
jmp short pascal_return
|
||||||
|
|
||||||
|
%ifndef _INIT
|
||||||
|
|
||||||
;*****
|
;*****
|
||||||
; fstrchr (BYTE far *src , int ch);
|
; fstrchr (BYTE far *src , int ch);
|
||||||
|
@ -80,13 +80,10 @@ STATIC void WriteMenuLine(int MenuSelected)
|
|||||||
iregs r;
|
iregs r;
|
||||||
unsigned char attr = (unsigned char)MenuColor;
|
unsigned char attr = (unsigned char)MenuColor;
|
||||||
char *pText = MenuStruct[MenuSelected].Text;
|
char *pText = MenuStruct[MenuSelected].Text;
|
||||||
size_t len = 0;
|
|
||||||
|
|
||||||
if (pText[0] == 0)
|
if (pText[0] == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
do len++; while (pText[len]);
|
|
||||||
|
|
||||||
if(MenuStruct[MenuSelected].bSelected==1)
|
if(MenuStruct[MenuSelected].bSelected==1)
|
||||||
attr = ((attr << 4) | (attr >> 4));
|
attr = ((attr << 4) | (attr >> 4));
|
||||||
|
|
||||||
@ -95,7 +92,7 @@ STATIC void WriteMenuLine(int MenuSelected)
|
|||||||
r.b.b.h = attr;
|
r.b.b.h = attr;
|
||||||
r.c.b.l = r.d.b.l = MenuStruct[MenuSelected].x;
|
r.c.b.l = r.d.b.l = MenuStruct[MenuSelected].x;
|
||||||
r.c.b.h = r.d.b.h = MenuStruct[MenuSelected].y;
|
r.c.b.h = r.d.b.h = MenuStruct[MenuSelected].y;
|
||||||
r.d.b.l += len - 1;
|
r.d.b.l += strlen(pText) - 1;
|
||||||
init_call_intr(0x10, &r);
|
init_call_intr(0x10, &r);
|
||||||
|
|
||||||
/* set cursor position: */
|
/* set cursor position: */
|
||||||
@ -952,15 +949,13 @@ STATIC VOID sysScreenMode(BYTE * pLine)
|
|||||||
STATIC VOID sysVersion(BYTE * pLine)
|
STATIC VOID sysVersion(BYTE * pLine)
|
||||||
{
|
{
|
||||||
COUNT major, minor;
|
COUNT major, minor;
|
||||||
char *p;
|
char *p = strchr(pLine, '.');
|
||||||
|
|
||||||
p = pLine;
|
if (p == NULL)
|
||||||
while (*p && *p != '.')
|
|
||||||
p++;
|
|
||||||
|
|
||||||
if (*p++ == '\0')
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
p++;
|
||||||
|
|
||||||
/* Get major number */
|
/* Get major number */
|
||||||
if (GetNumArg(pLine, &major) == (BYTE *) 0)
|
if (GetNumArg(pLine, &major) == (BYTE *) 0)
|
||||||
return;
|
return;
|
||||||
@ -2561,9 +2556,7 @@ STATIC VOID InstallExec(struct instCmds *icmd)
|
|||||||
*d = 0;
|
*d = 0;
|
||||||
|
|
||||||
args--;
|
args--;
|
||||||
*args = 0;
|
*args = strlen(&args[1]);
|
||||||
while (args[*args+1])
|
|
||||||
++*args;
|
|
||||||
args[*args+1] = '\r';
|
args[*args+1] = '\r';
|
||||||
args[*args+2] = 0;
|
args[*args+2] = 0;
|
||||||
|
|
||||||
|
@ -58,10 +58,11 @@ VOID ASMPASCAL fmemcpy( void FAR *d, const void FAR *s, size_t n);
|
|||||||
VOID ASMPASCAL strcpy(char *d, const char *s);
|
VOID ASMPASCAL strcpy(char *d, const char *s);
|
||||||
size_t ASMPASCAL strlen(const char *s);
|
size_t ASMPASCAL strlen(const char *s);
|
||||||
size_t ASMPASCAL fstrlen(const char FAR *s);
|
size_t ASMPASCAL fstrlen(const char FAR *s);
|
||||||
|
char * ASMPASCAL strchr(const char *s, int ch);
|
||||||
|
|
||||||
#ifdef __WATCOMC__
|
#ifdef __WATCOMC__
|
||||||
/* dx and es not used or clobbered for all asmsupt.asm functions except
|
/* bx, cx, dx and es not used or clobbered for all asmsupt.asm functions except
|
||||||
(f)memchr/(f)strchr (which preserve es) */
|
(f)memchr/(f)strchr (which clobber dx) */
|
||||||
#pragma aux (pascal) pascal_ax modify exact [ax]
|
#pragma aux (pascal) pascal_ax modify exact [ax]
|
||||||
#pragma aux (pascal_ax) init_memset
|
#pragma aux (pascal_ax) init_memset
|
||||||
#pragma aux (pascal_ax) init_fmemset
|
#pragma aux (pascal_ax) init_fmemset
|
||||||
@ -72,6 +73,7 @@ size_t ASMPASCAL fstrlen(const char FAR *s);
|
|||||||
#pragma aux (pascal_ax) init_strcpy
|
#pragma aux (pascal_ax) init_strcpy
|
||||||
#pragma aux (pascal_ax) init_strlen modify nomemory
|
#pragma aux (pascal_ax) init_strlen modify nomemory
|
||||||
#pragma aux (pascal_ax) init_fstrlen modify nomemory
|
#pragma aux (pascal_ax) init_fstrlen modify nomemory
|
||||||
|
#pragma aux (pascal) init_strchr modify exact [ax dx] nomemory
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#undef LINESIZE
|
#undef LINESIZE
|
||||||
|
Loading…
Reference in New Issue
Block a user