summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/main.c b/main.c
index 5bb398f..bbf1e7e 100644
--- a/main.c
+++ b/main.c
@@ -104,10 +104,10 @@ int check = 3; /* Block check */
int check = 1;
#endif /* F_CRC */
int remote = 1; /* 1 = Remote, 0 = Local */
-#ifdef DEBUG
+#ifdef SIMULATED_ERROR
int errorrate = 0; /* Simulated error rate */
int seed = 1234; /* Random number generator seed */
-#endif /* DEBUG */
+#endif /* SIMULATED_ERROR */
void
doexit(int status) {
@@ -134,10 +134,10 @@ usage() {
fprintf(stderr," -T Force text mode\n");
fprintf(stderr," -R Remote mode (vs local)\n");
fprintf(stderr," -L Local mode (vs remote)\n");
-#ifdef DEBUG
+#ifdef SIMULATED_ERROR
fprintf(stderr," -E <number> Simulated error rate (0-100)\n");
fprintf(stderr," -d Create debug.log\n");
-#endif /* DEBUG */
+#endif /* SIMULATED_ERROR */
fprintf(stderr," -h Help (this message)\n");
exit(FAILURE);
}
@@ -162,10 +162,10 @@ doarg(char c) { /* Command-line option parser */
struct stat statbuf;
xp = *xargv+1; /* Pointer for bundled args */
- while (c) {
-#ifdef DEBUG
+#ifdef SIMULATED_ERROR
if (errorrate) seed += (int)c;
-#endif /* DEBUG) */
+#endif /* SIMULATED_ERROR) */
+ while (c) {
switch (c) {
case 'r': /* Receive */
if (action) fatal("Conflicting actions",(char *)0,(char *)0);
@@ -183,9 +183,9 @@ doarg(char c) { /* Command-line option parser */
while (--xargc > 0) { /* Traverse the list */
xargv++;
s = *xargv;
-#ifdef DEBUG
+#ifdef SIMULATED_ERROR
if (errorrate) seed += (int)*s;
-#endif /* DEBUG) */
+#endif /* SIMULATED_ERROR */
if (**xargv == '-')
break;
errno = 0;
@@ -206,12 +206,12 @@ doarg(char c) { /* Command-line option parser */
#ifdef F_CRC
case 'b': /* Block-check type */
#endif /* F_CRC */
-#ifdef DEBUG
+#ifdef SIMULATED_ERROR
case 'E': /* Simulated error rate */
-#endif /* DEBUG */
+#endif /* SIMULATED_ERROR */
if (*(xp+1))
fatal("Invalid argument bundling",(char *)0,(char *)0);
- *xargv++, xargc--;
+ xargv++, xargc--;
if ((xargc < 1) || (**xargv == '-'))
fatal("Missing option argument",(char *)0,(char *)0);
s = *xargv;
@@ -224,12 +224,12 @@ doarg(char c) { /* Command-line option parser */
check = atoi(*xargv);
if (check < 1 || check > 5 || check == 4)
fatal("Invalid block check",(char *)0,(char *)0);
-#ifdef DEBUG
+#ifdef SIMULATED_ERROR
} else if (c == 'E') {
errorrate = atoi(*xargv);
if (errorrate > 100)
fatal("Invalid error rate",(char *)0,(char *)0);
-#endif /* DEBUG */
+#endif /* SIMULATED_ERROR */
}
break;
@@ -262,7 +262,7 @@ doarg(char c) { /* Command-line option parser */
case 'p': /* Parity */
if (*(xp+1))
fatal("Invalid argument bundling",(char *)0,(char *)0);
- *xargv++, xargc--;
+ xargv++; xargc--;
if ((xargc < 1) || (**xargv == '-'))
fatal("Missing parity",(char *)0,(char *)0);
switch(x = **xargv) {
@@ -292,9 +292,9 @@ doarg(char c) { /* Command-line option parser */
return(action);
}
-void
+int
main(int argc, char ** argv) {
- int status, rx_len, i, x;
+ int status, rx_len, x;
char c;
UCHAR *inbuf;
short r_slot;
@@ -319,10 +319,10 @@ main(int argc, char ** argv) {
if (!action) /* Nothing to do, give usage message */
usage();
-#ifdef DEBUG
+#ifdef SIMULATED_ERROR
debug(DB_LOG,"SIMULATED ERROR RATE:",0,errorrate);
if (errorrate) srand(seed); /* Init random error generator */
-#endif /* DEBUG */
+#endif /* SIMULATED_ERROR */
/* THE REAL STUFF IS FROM HERE DOWN */
@@ -432,8 +432,8 @@ main(int argc, char ** argv) {
date, size, and bytes transferred so far. These can be used in a
file-transfer progress display, log, etc.
*/
- debug(DB_LOG,"NAME",r.filename ? (char *)r.filename : "(NULL)",0);
- debug(DB_LOG,"DATE",r.filedate ? (char *)r.filedate : "(NULL)",0);
+ debug(DB_LOG,"NAME",r.filename ? r.filename : (UCHAR *)"(NULL)",0);
+ debug(DB_LOG,"DATE",r.filedate ? r.filedate : (UCHAR *)"(NULL)",0);
debug(DB_LOG,"SIZE",0,r.filesize);
debug(DB_LOG,"STATE",0,r.status);
debug(DB_LOG,"SOFAR",0,r.sofar);