From 46ca19beecc512d05729b3595318d179e772b937 Mon Sep 17 00:00:00 2001 From: AKuHAK Date: Fri, 29 Jan 2021 11:56:25 +0200 Subject: [PATCH] Fixed identation and formatting --- .editorconfig | 20 ++++++++++++++++++++ Makefile | 2 +- doc/license.txt | 8 ++++---- doc/ps2link-protocol.txt | 2 +- src/fsclient.c | 2 +- src/network.c | 2 +- src/ps2link.c | 18 +++++++++--------- src/ps2netfs.h | 26 +++++++++++++------------- 8 files changed, 50 insertions(+), 30 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..4b27880 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,20 @@ +# EditorConfig: http://EditorConfig.org + +# Top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +charset = utf-8 + +# 1 space indentation +[*.{c,h,js,css,html}] +indent_style = space +indent_size = 1 + +# Tab indentation +[Makefile*] +indent_style = tab diff --git a/Makefile b/Makefile index 25bff02..c4f39a0 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ else LIBS = -lwsock32 -lpthreadGC2 endif - + ifeq "x$(PREFIX)" "x" PREFIX = $(PS2DEV) endif diff --git a/doc/license.txt b/doc/license.txt index 2fb97cb..c109b49 100644 --- a/doc/license.txt +++ b/doc/license.txt @@ -14,17 +14,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * 3. The name of the author(s) may not be used to endorse or promote products + * 3. The name of the author(s) may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. diff --git a/doc/ps2link-protocol.txt b/doc/ps2link-protocol.txt index 674e05f..7dc4443 100644 --- a/doc/ps2link-protocol.txt +++ b/doc/ps2link-protocol.txt @@ -31,7 +31,7 @@ tell it what to do. These are simple commands sent as single packets for executing programs, resetting ps2link or other things. This list may grow as time goes on and new functionality is added to ps2link. - + ---------------------------- 0xBABE0201 (reset command) ---------------------------- diff --git a/src/fsclient.c b/src/fsclient.c index a90b66b..86606fa 100644 --- a/src/fsclient.c +++ b/src/fsclient.c @@ -236,7 +236,7 @@ if (!strcmp(temp, "pfs")) { printf(" pfs - Playstation File System.\n"); } else if (!strcmp(temp, "dev9x")) { printf(" dev9x - Blah blah blah.\n"); } else - // + // { printf(" %s\n", temp); } // Increment temp. diff --git a/src/network.c b/src/network.c index 561d9c7..e599e7d 100644 --- a/src/network.c +++ b/src/network.c @@ -23,7 +23,7 @@ // Start up winsock. if (WSAStartup(MAKEWORD(2, 0), &wsaData) != 0) { return -1; } - // End function. + // End function. return 0; } diff --git a/src/ps2link.c b/src/ps2link.c index 1e133e1..c60a702 100644 --- a/src/ps2link.c +++ b/src/ps2link.c @@ -555,13 +555,13 @@ // Perform the request. // do we need to use mode in here: request->mode ? - + #ifdef _WIN32 - result = mkdir(request->name); + result = mkdir(request->name); #else result = mkdir(request->name, request->mode); #endif - + // Send the response. return ps2link_response_mkdir(result); } @@ -589,10 +589,10 @@ int ps2link_request_getstat(void *packet) { // Fix the arguments. fix_pathname(request->name); - + // Fetch the entry's statistics. ret = stat(request->name, &stats); - + if (ret == 0) { // Convert the mode. mode = (stats.st_mode & 0x07); @@ -601,7 +601,7 @@ int ps2link_request_getstat(void *packet) { if (S_ISLNK(stats.st_mode)) { mode |= 0x08; } #endif if (S_ISREG(stats.st_mode)) { mode |= 0x10; } - + // Convert the creation time. loctime = localtime(&(stats.st_ctime)); ctime[6] = (unsigned char)loctime->tm_year; @@ -610,7 +610,7 @@ int ps2link_request_getstat(void *packet) { ctime[3] = (unsigned char)loctime->tm_hour; ctime[2] = (unsigned char)loctime->tm_min; ctime[1] = (unsigned char)loctime->tm_sec; - + // Convert the access time. loctime = localtime(&(stats.st_atime)); atime[6] = (unsigned char)loctime->tm_year; @@ -619,7 +619,7 @@ int ps2link_request_getstat(void *packet) { atime[3] = (unsigned char)loctime->tm_hour; atime[2] = (unsigned char)loctime->tm_min; atime[1] = (unsigned char)loctime->tm_sec; - + // Convert the last modified time. loctime = localtime(&(stats.st_mtime)); mtime[6] = (unsigned char)loctime->tm_year; @@ -629,7 +629,7 @@ int ps2link_request_getstat(void *packet) { mtime[2] = (unsigned char)loctime->tm_min; mtime[1] = (unsigned char)loctime->tm_sec; } - + return ps2link_response_getstat(ret, mode, 0, stats.st_size, ctime, atime, mtime, 0); } diff --git a/src/ps2netfs.h b/src/ps2netfs.h index 095056f..e79594a 100644 --- a/src/ps2netfs.h +++ b/src/ps2netfs.h @@ -63,27 +63,27 @@ #define PS2NETFS_COMMAND_DEVLIST 0xBEEF8F21 int ps2netfs_command_open(char *pathname, int flags); - + int ps2netfs_command_close(int fd); - + int ps2netfs_command_read(int fd, void *buffer, int size); - + int ps2netfs_command_write(int fd, void *buffer, int size); - + int ps2netfs_command_lseek(int fd, int offset, int whence); - + // ioctl - unimplemented int ps2netfs_command_delete(char *pathname, int flags); - + int ps2netfs_command_mkdir(char *pathname, int flags); - + int ps2netfs_command_rmdir(char *pathname, int flags); - + int ps2netfs_command_dopen(char *pathname, int flags); - + int ps2netfs_command_dclose(int dd); - + int ps2netfs_command_dread(int dd, DIRENT *dirent); // getstat - unimplemented @@ -97,9 +97,9 @@ // chdir - unimplemented int ps2netfs_command_sync(char *device, int flags); - + int ps2netfs_command_mount(char *device, char *fsname, int flags, char *argv, int argc); - + int ps2netfs_command_umount(char *device, int flags); // lseek64 - unimplemented @@ -117,5 +117,5 @@ // fstype - unimplemented int ps2netfs_command_devlist(char *pathname, int flags, char *devlist); - + #endif