Skip to content

Commit

Permalink
added script
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre MARQUEZ committed Jul 25, 2017
1 parent 889f52c commit 0e670f1
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 3 deletions.
41 changes: 41 additions & 0 deletions close_port.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# **************************************************************************** #
# #
# ::: :::::::: #
# close_port.sh :+: :+: :+: #
# +:+ +:+ +:+ #
# By: amarquez <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2017/07/25 18:06:36 by amarquez #+# #+# #
# Updated: 2017/07/25 18:50:15 by amarquez ### ########.fr #
# #
# **************************************************************************** #

## number pattern

re='^[0-9]+$'

## ask for port number

printf "PORT #: ";

## assign port number

read -p "" port

## check if valid port number

if [ "$port" -eq "$port" ] 2>/dev/null; then

# get output from lsof ( including PID )

lsof="$(lsof -i :$port)"

printf "$lsof";

else

# not a valid port number

printf "error: not a valid port number";

fi
6 changes: 3 additions & 3 deletions src/server/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ int main(int argc, char **argv)
** initialize environment with variables we want
*/

ft_init_environ();
// ft_init_environ();

/*
** close to prevent zombies
Expand All @@ -84,7 +84,7 @@ int main(int argc, char **argv)
}

#ifndef __APPLE__
ft_free_environ();
// ft_free_environ();
#endif
/*
** kill the process
Expand All @@ -100,4 +100,4 @@ int main(int argc, char **argv)
ft_wclose(connfd);
}
return (0);
}
}

0 comments on commit 0e670f1

Please sign in to comment.