Skip to content

Commit

Permalink
Small code tidyup
Browse files Browse the repository at this point in the history
  • Loading branch information
dmcoles committed Jun 29, 2021
1 parent c441b27 commit 39ee1c4
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 27 deletions.
4 changes: 2 additions & 2 deletions ACP.e
Original file line number Diff line number Diff line change
Expand Up @@ -3420,8 +3420,8 @@ PROC updateVersion(expVer:PTR TO CHAR,expDate:PTR TO CHAR)
d:=Val(tmp)
StringF(expDate,'\d[2]-\s[3]-\d[4]',d,'JanFebMarAprMayJunJulAugSepOctNovDec'+((m-1)*3),y)
ELSE
StrCopy(expVer,v,ALL)
StrCopy(expDate,'',ALL)
StrCopy(expVer,v)
StrCopy(expDate,'')
ENDIF
ENDPROC

Expand Down
8 changes: 4 additions & 4 deletions MiscFuncs.e
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ EXPORT PROC makeIntList(src:PTR TO CHAR)

ENDPROC res

EXPORT PROC strCmpi(test1: PTR TO CHAR, test2: PTR TO CHAR, len)
EXPORT PROC strCmpi(test1: PTR TO CHAR, test2: PTR TO CHAR, len = ALL)
/* case insensitive string compare */
DEF i,l1,l2

Expand Down Expand Up @@ -205,7 +205,7 @@ EXPORT PROC findAssign(name: PTR TO CHAR)
Forbid()
WHILE(devicelist.next)
bStrC(devicelist.name,temp2)
IF(strCmpi(temp2,temp,ALL)/* && devicelist->dl_Type!=DLT_DEVICE*/)
IF(strCmpi(temp2,temp)/* && devicelist->dl_Type!=DLT_DEVICE*/)
Permit()
RETURN 0
ENDIF
Expand Down Expand Up @@ -482,11 +482,11 @@ EXPORT PROC fileWrite(fh,str: PTR TO CHAR)
IF s<>StrLen(str) THEN RETURN RESULT_FAILURE
ENDPROC RESULT_SUCCESS

EXPORT PROC strCpy(dest: PTR TO CHAR, source: PTR TO CHAR, len)
EXPORT PROC strCpy(dest: PTR TO CHAR, source: PTR TO CHAR, len=ALL)
DEF c,endfound=FALSE
DEF i
IF len=ALL
AstrCopy(dest,source,ALL)
AstrCopy(dest,source)
ELSE
FOR i:=0 TO len-1
c:=source[i]
Expand Down
15 changes: 5 additions & 10 deletions ftpd.e
Original file line number Diff line number Diff line change
Expand Up @@ -364,22 +364,17 @@ PROC readLine(sb,sockd, vptr:PTR TO CHAR, maxlen)
FOR n:=0 TO maxlen-1
rc:=recv(sb,sockd, c, 1,0)
IF ( rc = 1 )
IF(c[] = "\b") THEN JUMP next
IF (c[] = "\n") THEN JUMP brk
CONT c[] = "\b"
EXIT c[] = "\n"
buffer[]++:=c[]
ELSEIF ( rc = 0 )
IF ( n = 1 )
RETURN 0
ELSE
JUMP brk
ENDIF
IF ( n = 1 ) THEN RETURN 0
EXIT TRUE
ELSE
IF ( errno(sb) = EINTR ) THEN JUMP next
CONT errno(sb) = EINTR
RETURN -1
ENDIF
next:
ENDFOR
brk:
buffer[]:=0
ENDPROC n

Expand Down
6 changes: 3 additions & 3 deletions httpd.e
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ PROC extractFileData(sb,socket,httpData:PTR TO httpData,boundary:PTR TO CHAR,con
WHILE((readMemLine(lineBuff,sb,socket,buff,{readSize},{pos},255,bufsize,{contentLength})) > 0)
IF (p:=InStr(lineBuff,'filename="'))>=0
StrCopy(fname,httpData.workingPath)
StrAdd(fname,lineBuff+p+10,ALL)
StrAdd(fname,lineBuff+p+10)
p:=InStr(fname,'"')
SetStr(fname,p)
ENDIF
Expand Down Expand Up @@ -651,7 +651,7 @@ EXPORT PROC doHttpd(node,httphost,httpports:PTR TO LONG,httppath,aePutsPtr, read

IF StrLen(getCmd)>0
IF (spcPos:=InStr(getCmd,' '))>=0 THEN SetStr(getCmd,spcPos)
IF StrCmp(getCmd,'/',ALL)
IF StrCmp(getCmd,'/')
generatePage(sb,http_c,httppath,node,uploadMode,fileList)

ELSEIF (StrCmp(getCmd,'/',1))
Expand Down Expand Up @@ -725,7 +725,7 @@ EXPORT PROC doHttpd(node,httphost,httpports:PTR TO LONG,httppath,aePutsPtr, read

IF StrLen(postCmd)>0
IF (spcPos:=InStr(postCmd,' '))>=0 THEN SetStr(postCmd,spcPos)
IF StrCmp(postCmd,'/',ALL)
IF StrCmp(postCmd,'/')
extractFileData(sb,http_c,httpData,boundary,contentLength)
generatePage(sb,http_c,httppath,node,uploadMode,fileList)
ENDIF
Expand Down
4 changes: 2 additions & 2 deletions jsonImport.e
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ PROC main() HANDLE

fr:=NIL

AstrCopy(infile,'',ALL)
AstrCopy(outpath,'',ALL)
AstrCopy(infile,'')
AstrCopy(outpath,'')

myargs:=[0,0,0]:LONG
IF rdargs:=ReadArgs('CONFIG/K,WRITEPATH/K,CFGFILES/S',myargs,NIL)
Expand Down
5 changes: 2 additions & 3 deletions jsonParser.e
Original file line number Diff line number Diff line change
Expand Up @@ -121,20 +121,19 @@ PROC jsmn_parse_primitive(parser:PTR TO jsmn_parser, js: PTR TO CHAR,len,tokens,
ELSEIF (ch="\t") OR (ch="\b") OR (ch="\n") OR (ch=" ") OR (ch=",") OR (ch="]") OR (ch="}")
found:=TRUE
ENDIF
IF found THEN JUMP foundit
EXIT found
IF ((ch < 32) OR (ch >= 127))
parser.pos:=start
RETURN JSMN_ERROR_INVAL
ENDIF
parser.pos:=parser.pos+1
ENDWHILE
IF JSMN_STRICT
IF JSMN_STRICT AND (found=FALSE)
/* In strict mode primitive must be followed by a comma/object/array */
parser.pos:=start
RETURN JSMN_ERROR_PART
ENDIF

foundit:
IF (tokens = NIL)
parser.pos:=parser.pos-1
RETURN 0
Expand Down
4 changes: 2 additions & 2 deletions tooltypes.e
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ EXPORT PROC readToolType(toolType,tooltypeSelector,key,outValue)
do:=getOrCreateCacheItem(nodeFile)
IF (do)
tooltypes:=do.tooltypes
IF (s:=FindToolType(tooltypes,key)) THEN StrCopy(outValue,s,ALL)
IF (s:=FindToolType(tooltypes,key)) THEN StrCopy(outValue,s)
ENDIF
IF diskObjectCache=NIL THEN FreeDiskObject(do)
ENDPROC s<>NIL
Expand Down Expand Up @@ -227,7 +227,7 @@ EXPORT PROC getOrCreateCacheItem(fileName:PTR TO CHAR)
i:=0
WHILE (i<cnt) AND (found=FALSE)
IF (cacheObj:=diskObjectCache.item(i))
IF strCmpi(fileName,cacheObj.fileName,ALL)
IF strCmpi(fileName,cacheObj.fileName)
do:=cacheObj.diskObject
found:=TRUE
ENDIF
Expand Down
2 changes: 1 addition & 1 deletion xymodem.e
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ PROC xmodem_send_file(xym:PTR TO xymodem_t, fname:PTR TO CHAR, sent:PTR TO LONG,
,xym.total_files ->-xym.sent_files
,xym.total_bytes ->-xym.sent_bytes
)
AstrCopy(block+StrLen(block)+1,tempstr,ALL)
AstrCopy(block+StrLen(block)+1,tempstr)
block_len:=StrLen(block)+1+StrLen(tempstr)

StringF(tempstr,'Sending YMODEM header block: ''\s''',block+StrLen(block)+1)
Expand Down

0 comments on commit 39ee1c4

Please sign in to comment.