[1] project init

This commit is contained in:
xdrm-brackets 2017-05-13 12:30:39 +02:00
commit ea61d8d6f0
5 changed files with 92 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
/src/linter
/phptest/
*.o

47
php-linter Executable file
View File

@ -0,0 +1,47 @@
#!/bin/bash
usage(){
echo -e "Usage: php-linter {path}\n";
}
# [1] Manage config
#========================================================#
# (1) Check argc #
if [ $# -lt 1 ]; then
usage;
echo "* Missing argument 'path'";
exit 1;
fi;
# (2) Check argument @filename #
FILENAME="`realpath $1`";
if [ ! -e $FILENAME ]; then
usage;
echo "* path '$FILENAME' doesn't exist";
exit 1;
fi;
# (3) Check file or dir #
if [ -d $FILENAME ]; then
count=0;
## {1} Exec for each file in directory ##
for phpfile in `find $FILENAME -name '*.php'`; do
count=`expr $count + 1`;
echo "($count) file $phpfile";
./src/linter $phpfile;
done;
else
## {2} Exec file ##
./src/linter $FILENAME;
fi;

15
src/Makefile Normal file
View File

@ -0,0 +1,15 @@
GCCARGV=-Wall
default: compile
compile: install
install: linter
linter: linter.c linter.h
gcc $(GCCARGV) -o linter -c linter.c;

10
src/linter.c Normal file
View File

@ -0,0 +1,10 @@
/**************************
* PHP-Linter *
***************************
* Designed & Developed by *
* Adrien Marquès *
* <xdrm-brackets> *
***************************
* doowap31@gmail.com *
**************************/
#include "linter.h"

17
src/linter.h Normal file
View File

@ -0,0 +1,17 @@
/**************************
* PHP-Linter *
***************************
* Designed & Developed by *
* Adrien Marquès *
* <xdrm-brackets> *
***************************
* doowap31@gmail.com *
**************************/
#ifndef _LINTER_H_
#define _LINTER_H_
#include <stdio.h>
#include <stdlib.h>
#endif