Skip to content

Commit 5bd3d58

Browse files
authored
Merge pull request #14 from uyjulian/cleanup1
General cleanup 1
2 parents 211df54 + 171b3e4 commit 5bd3d58

File tree

3 files changed

+29
-26
lines changed

3 files changed

+29
-26
lines changed

README.md

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
![CI](https://github.com/ps2dev/ps2client/workflows/CI/badge.svg)
44

5-
65
## PS2CLIENT USAGE AND INFORMATION
76

87
### THE INTRODUCTION
98

109
These programs, ps2client & fsclient, are command line tools used for interacting with a ps2 system running ps2link and/or ps2netfs. It will allow you to send various commands as well as respond to requests for data. This program was written and tested under Linux, Cygwin and Mac OS X but should compile on any reasonably unixlike system.
1110

1211
### BUILDING THE CLIENTS
12+
1313
Building and installing is very simple:
1414

1515
`make clean; make install`
@@ -26,80 +26,83 @@ These options can be used as follows:
2626
`make clean; make PREFIX=/new/path/prefix install`
2727

2828
### BUILDING WINDOWS BINARIES
29+
2930
For building windows binaries on Unix system, you need to setup mingw cross-compiler and win32 threads.
3031
Build command:
3132

3233
`make -f Makefile.mingw32`
3334

3435
### BASIC CLIENT USAGE
36+
3537
Basic usage:
3638

37-
```
39+
```txt
3840
ps2client [-h hostname] [-t timeout] <command> [arguments]
3941
fsclient [-h hostname] <command> <arguments>
4042
```
4143

42-
**[-h hostname]**
44+
#### \[-h hostname]
4345

4446
The address of the remote ps2. This can be an IP or a hostname. If none is given, the environment variable `$PS2HOSTNAME` will be checked for a valid address. If this variable isn't set, a default of 192.168.0.10 will be used.
4547

46-
**[-t timeout]**
48+
#### \[-t timeout]
4749

4850
An idle timeout period in seconds that the client will wait before exiting. This is useful to allow a script to continue after calling ps2client to send a command to ps2link or ps2netfs.
4951

5052
### PS2LINK COMMANDS
51-
- `reset`
53+
54+
* `reset`
5255

5356
Send a reset request to ps2link.
5457

55-
- `execiop <filename> [arguments]`
58+
* `execiop <filename> [arguments]`
5659

5760
Tell ps2link to load and execute a file on the IOP.
5861

59-
- `execee <filename> [arguments]`
62+
* `execee <filename> [arguments]`
6063

6164
Tell ps2link to load and execute a file on the EE.
6265

63-
- `poweroff`
66+
* `poweroff`
6467

6568
Send a poweroff request to ps2link.
6669

67-
- `scrdump`
70+
* `scrdump`
6871

6972
Tell ps2link to dump exceptions to the screen.
7073

71-
- `netdump`
74+
* `netdump`
7275

7376
Tell ps2link to dump execetions to the network console.
7477

75-
- `dumpmem <offset> <size> <filename>`
78+
* `dumpmem <offset> <size> <filename>`
7679

7780
Dump the contents of memory into a file.
7881

79-
- `startvu <vu>`
82+
* `startvu <vu>`
8083

8184
Tell the specified vector unit to start operation.
8285

83-
- `stopvu <vu>`
86+
* `stopvu <vu>`
8487

8588
Tell the specified vector unit to stop operation.
8689

87-
- `dumpreg <type> <filename>`
90+
* `dumpreg <type> <filename>`
8891

8992
Dump the registers of a given type into a file.
9093

91-
- `gsexec <size> <filename>`
94+
* `gsexec <size> <filename>`
9295

9396
Tell ps2link to load and send a file to the GS.
9497

95-
- `writemem <offset> <size> <filename>`
98+
* `writemem <offset> <size> <filename>`
9699

97100
Write the contents of a file into memory.
98101

99-
- `iopexcep`
102+
* `iopexcep`
100103

101104
I really don't know! OH NOES!!
102105

103-
- `listen`
106+
* `listen`
104107

105108
Listen to the ps2link network console.

src/fsclient.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,12 @@
212212

213213
}
214214

215-
int fsclient_devlist(void) { int result = 0;
215+
int fsclient_devlist(void) {
216216
int loop0, devcount; char devlist[256], *temp = devlist;
217217

218218
// Get the device listing.
219219
devcount = ps2netfs_command_devlist("", 0, devlist);
220-
if (devcount < 0) { printf("Error: Get device listing failed. (%d)\n", result); return -1; }
220+
if (devcount < 0) { printf("Error: Get device listing failed. (%d)\n", devcount); return -1; }
221221

222222
// Output the display header.
223223
printf("\n [Active Devices]\n\n");

src/ps2link.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -326,13 +326,13 @@
326326

327327
int ps2link_request_read(void *packet) {
328328
struct { unsigned int number; unsigned short length; int fd; int size; } PACKED *request = packet;
329-
int result = -1, size = -1; char buffer[65536], *bigbuffer;
329+
int result = -1, size = -1; char buffer[65536];
330330

331331
// If a big read is requested...
332332
if (ntohl(request->size) > sizeof(buffer)) {
333333

334334
// Allocate the bigbuffer.
335-
bigbuffer = malloc(ntohl(request->size));
335+
char *bigbuffer = malloc(ntohl(request->size));
336336

337337
// Perform the request.
338338
result = size = read(ntohl(request->fd), bigbuffer, ntohl(request->size));
@@ -367,13 +367,13 @@
367367

368368
int ps2link_request_write(void *packet) {
369369
struct { unsigned int number; unsigned short length; int fd; int size; } PACKED *request = packet;
370-
int result = -1; char buffer[65536], *bigbuffer;
370+
int result = -1; char buffer[65536];
371371

372372
// If a big write is requested...
373373
if (ntohl(request->size) > sizeof(buffer)) {
374374

375375
// Allocate the bigbuffer.
376-
bigbuffer = malloc(ntohl(request->size));
376+
char *bigbuffer = malloc(ntohl(request->size));
377377

378378
// Read the request data.
379379
network_receive_all(request_socket, bigbuffer, ntohl(request->size));
@@ -418,7 +418,7 @@
418418

419419
}
420420

421-
int ps2link_request_opendir(void *packet) { int loop0 = 0;
421+
int ps2link_request_opendir(void *packet) {
422422
struct { unsigned int command; unsigned short length; int flags; char pathname[256]; } PACKED *request = packet;
423423
int result = -1;
424424
struct stat stats;
@@ -429,7 +429,7 @@
429429
if((stat(request->pathname, &stats) == 0) && (S_ISDIR(stats.st_mode)))
430430
{
431431
// Allocate an available directory descriptor.
432-
for (loop0=0; loop0<10; loop0++) { if (ps2link_dd[loop0].dir == NULL) { result = loop0; break; } }
432+
for (int loop0=0; loop0<10; loop0++) { if (ps2link_dd[loop0].dir == NULL) { result = loop0; break; } }
433433

434434
// Perform the request.
435435
if (result != -1)

0 commit comments

Comments
 (0)