Task

Delete a file called "input.txt" and delete a directory called "docs".

This should be done twice: once "here", i.e. in the current working directory and once in the filesystem root.




 
;syscall numbers for readability. :]
%define sys_rmdir 40
%define sys_unlink 10
 
section .text
	global _start
 
	_start:
		mov ebx, fn
		mov eax, sys_unlink
		int 0x80
		test eax, eax
		js _ragequit
 
		mov ebx, dn
		mov eax, sys_rmdir			
		int 0x80
 
		mov ebx, rfn
		mov eax, sys_unlink
		int 0x80
		cmp eax, 0
		je _exit
 
		_ragequit:
			mov edx, err_len
			mov ecx, err_msg
			mov ebx, 4
			mov eax ,1
			int 0x80
 
		_exit:
			push 0x1
			mov eax, 1
			push eax
			int 0x80
			ret
 
section .data
fn		db 'input.txt',0
rfn		db '/input.txt',0
dn		db 'doc',0
 
err_msg		db "Something went wrong! :[",0xa
err_len		equ $-err_msg
 