From 2f90e851f14bb23046f40d9d90fefffce854939a Mon Sep 17 00:00:00 2001 From: Mikhail Osipov Date: Fri, 4 Oct 2019 15:59:15 +0300 Subject: special files check fix --- main.s | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'main.s') diff --git a/main.s b/main.s index 45c960a..3cf3cbe 100644 --- a/main.s +++ b/main.s @@ -118,18 +118,23 @@ _start: movl 16(%esp), %eax andl $S_IFMT, %eax - subl $S_IFDIR, %eax - testl %eax, %eax + testl $S_IFDIR, %eax jnz 1f + testl $S_IFREG, %eax + jnz 2f + + movl $1, (binary) + jmp 2f + 1: pushl $0 pushl $str_fnot pushl 8(%ebp) call print_strings jmp restore - 1: - addl $(64 - 6), %esp + 2: + addl $(128 - 6), %esp # test if stdin refers to linux console @@ -364,6 +369,10 @@ read_next: .charloop: lodsb + + testl $1, (binary) + jnz 1f + cmpb $0x0a, %al jne 1f @@ -1027,3 +1036,4 @@ timespec: .comm pollfd, 8 .comm child_pid, 4 .comm pause, 4 +.comm binary, 4 -- cgit v1.2.3-70-g09d2