aboutsummaryrefslogtreecommitdiffstats
path: root/FICS
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2023-12-25 18:03:29 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2023-12-25 18:03:29 +0100
commit436c2c2bf609ee2da75bf416c4aba9ced14445a1 (patch)
treefd504efc578b764e316abf5f82649404460bb183 /FICS
parentcfc2de8cb0abf2d2d3daf35849168d613d985a39 (diff)
Reformatted psend_command()
Diffstat (limited to 'FICS')
-rw-r--r--FICS/utils.c45
1 files changed, 24 insertions, 21 deletions
diff --git a/FICS/utils.c b/FICS/utils.c
index 9f8ef39..ad7e6ee 100644
--- a/FICS/utils.c
+++ b/FICS/utils.c
@@ -465,29 +465,32 @@ PUBLIC int pmore_file(int p)
return 0;
}
-PUBLIC int psend_command(int p, char *command, char *input)
+PUBLIC int
+psend_command(int p, char *command, char *input)
{
- FILE *fp;
- char tmp[MAX_LINE_SIZE];
- int num;
+ FILE *fp;
+ char tmp[MAX_LINE_SIZE];
+ int num;
- if (input)
- fp = popen(command, "w");
- else
- fp = popen(command, "r");
- if (!fp)
- return -1;
- if (input) {
- fwrite(input, sizeof(char), strlen(input), fp);
- } else {
- while (!feof(fp)) {
- num = fread(tmp, sizeof(char), MAX_LINE_SIZE - 1, fp);
- tmp[num] = '\0';
- net_send_string(parray[p].socket, tmp, 1);
- }
- }
- pclose(fp);
- return 0;
+ if (input)
+ fp = popen(command, "w");
+ else
+ fp = popen(command, "r");
+ if (!fp)
+ return -1;
+
+ if (input) {
+ fwrite(input, sizeof(char), strlen(input), fp);
+ } else {
+ while (!feof(fp)) {
+ num = fread(tmp, sizeof(char), MAX_LINE_SIZE - 1, fp);
+ tmp[num] = '\0';
+ net_send_string(parray[p].socket, tmp, 1);
+ }
+ }
+
+ pclose(fp);
+ return 0;
}
PUBLIC char *