Fix warnings and indentation

svn path=/trunk/; revision=25592
This commit is contained in:
Hervé Poussineau 2007-01-22 09:48:26 +00:00
parent e51baab788
commit 50d8fb4688
3 changed files with 176 additions and 178 deletions

View file

@ -176,15 +176,15 @@ char *hookup(char *host, int port)
code = -1; code = -1;
goto bad; goto bad;
} }
cin = cout = s; cin = cout = s;
if (verbose) { if (verbose) {
printf("Connected to %s.\n", hostname); printf("Connected to %s.\n", hostname);
(void) fflush(stdout); (void) fflush(stdout);
} }
if (getreply(0) > 2) { /* read startup message from server */ if (getreply(0) > 2) { /* read startup message from server */
closesocket(cin); closesocket(cin);
code = -1; code = -1;
goto bad; goto bad;
} }
#ifdef SO_OOBINLINE #ifdef SO_OOBINLINE
{ {
@ -222,26 +222,26 @@ int login(const char *host)
acct = pacct; acct = pacct;
} }
while (user == NULL) { while (user == NULL) {
const char *myname = "none"; // This needs to become the usename env const char *myname = "none"; // This needs to become the usename env
if (myname) if (myname)
printf("Name (%s:%s): ", host, myname); printf("Name (%s:%s): ", host, myname);
else else
printf("Name (%s): ", host); printf("Name (%s): ", host);
(void) fflush(stdout); (void) fflush(stdout);
(void) fgets(tmp, sizeof(tmp) - 1, stdin); (void) fgets(tmp, sizeof(tmp) - 1, stdin);
tmp[strlen(tmp) - 1] = '\0'; tmp[strlen(tmp) - 1] = '\0';
if (*tmp == '\0') if (*tmp == '\0')
user = myname; user = myname;
else else
user = tmp; user = tmp;
} }
n = command("USER %s", user); n = command("USER %s", user);
if (n == CONTINUE) { if (n == CONTINUE) {
if (pass == NULL) if (pass == NULL)
pass = getpass("Password:"); pass = getpass("Password:");
n = command("PASS %s", pass); n = command("PASS %s", pass);
fflush(stdin); fflush(stdin);
} }
if (n == CONTINUE) { if (n == CONTINUE) {
aflag++; aflag++;
@ -284,7 +284,7 @@ int command(const char *fmt, ...)
{ {
va_list ap; va_list ap;
int r; int r;
void (*oldintr)(int), cmdabort(int); void (*oldintr)(int);
abrtflag = 0; abrtflag = 0;
if (debug) { if (debug) {
@ -301,16 +301,16 @@ int command(const char *fmt, ...)
return (0); return (0);
} }
oldintr = signal(SIGINT,cmdabort); oldintr = signal(SIGINT,cmdabort);
{ {
char buffer[1024]; char buffer[1024];
va_start(ap, fmt); va_start(ap, fmt);
vsprintf(buffer, fmt, ap); vsprintf(buffer, fmt, ap);
va_end(ap); va_end(ap);
//DLJ: to work through firewalls - send the command as a single message //DLJ: to work through firewalls - send the command as a single message
strcat(buffer,"\r\n"); strcat(buffer,"\r\n");
fprintfSocket(cout, buffer); fprintfSocket(cout, buffer);
} }
//DLJ: the following two lines are replaced by the strcat above - seems to //DLJ: the following two lines are replaced by the strcat above - seems to
// make it work through firewalls. // make it work through firewalls.
// fprintfSocket(cout, "\r\n"); // fprintfSocket(cout, "\r\n");
@ -335,7 +335,7 @@ getreply(expecteof)
register int dig; register int dig;
register char *cp; register char *cp;
int originalcode = 0, continuation = 0; int originalcode = 0, continuation = 0;
void (*oldintr)(int), cmdabort(int); void (*oldintr)(int);
int pflag = 0; int pflag = 0;
char *pt = pasv; char *pt = pasv;
@ -460,7 +460,7 @@ void abortsend()
void sendrequest(const char *cmd, const char *local, const char *remote, int printnames) void sendrequest(const char *cmd, const char *local, const char *remote, int printnames)
{ {
FILE *fin; FILE *fin;
int dout = 0; int dout = 0;
int (*closefunc)(), _pclose(), fclose(); int (*closefunc)(), _pclose(), fclose();
sig_t (*oldintr)(), (*oldintp)(); sig_t (*oldintr)(), (*oldintp)();
char buf[BUFSIZ], *bufp; char buf[BUFSIZ], *bufp;
@ -624,39 +624,39 @@ null();// oldintp = signal(SIGPIPE, SIG_IGN);
case TYPE_A: case TYPE_A:
{ {
char buf[1024]; char buf[1024];
static int bufsize = 1024; static int bufsize = 1024;
int ipos=0; int ipos=0;
while ((c = getc(fin)) != EOF) { while ((c = getc(fin)) != EOF) {
if (c == '\n') { if (c == '\n') {
while (hash && (bytes >= hashbytes)) { while (hash && (bytes >= hashbytes)) {
(void) putchar('#'); (void) putchar('#');
(void) fflush(stdout); (void) fflush(stdout);
hashbytes += HASHBYTES; hashbytes += HASHBYTES;
} }
// Szurgot: The following code is unncessary on Win32. // Szurgot: The following code is unncessary on Win32.
// (void) fputcSocket(dout, '\r'); // (void) fputcSocket(dout, '\r');
// bytes++; // bytes++;
} }
if (ipos >= bufsize) { if (ipos >= bufsize) {
fputSocket(dout,buf,ipos); fputSocket(dout,buf,ipos);
if(!hash) (void) putchar('.'); if(!hash) (void) putchar('.');
ipos=0; ipos=0;
} }
buf[ipos]=c; ++ipos; buf[ipos]=c; ++ipos;
bytes++; bytes++;
} }
if (ipos) { if (ipos) {
fputSocket(dout,buf,ipos); fputSocket(dout,buf,ipos);
ipos=0; ipos=0;
} }
if (hash) { if (hash) {
if (bytes < hashbytes) if (bytes < hashbytes)
(void) putchar('#'); (void) putchar('#');
(void) putchar('\n'); (void) putchar('\n');
(void) fflush(stdout); (void) fflush(stdout);
} }
else { else {
(void) putchar('.'); (void) putchar('.');
@ -664,13 +664,13 @@ null();// oldintp = signal(SIGPIPE, SIG_IGN);
(void) fflush(stdout); (void) fflush(stdout);
} }
if (ferror(fin)) if (ferror(fin))
perror(local); perror(local);
// if (ferror(dout)) { // if (ferror(dout)) {
// if (errno != EPIPE) // if (errno != EPIPE)
// perror("netout"); // perror("netout");
// bytes = -1; // bytes = -1;
// } // }
break; break;
} }
} }
(void) gettimeofday(&stop, (struct timezone *)0); (void) gettimeofday(&stop, (struct timezone *)0);
@ -734,13 +734,13 @@ void recvrequest(const char *cmd, const char *local, const char *remote, const c
int printnames) int printnames)
{ {
FILE *fout = stdout; FILE *fout = stdout;
int din = 0; int din = 0;
int (*closefunc)(), _pclose(), fclose(); int (*closefunc)(), _pclose(), fclose();
void (*oldintr)(int), (*oldintp)(int); void (*oldintr)(int), (*oldintp)(int);
int oldverbose = 0, oldtype = 0, is_retr, tcrflag, nfnd, bare_lfs = 0; int oldverbose = 0, oldtype = 0, is_retr, tcrflag, nfnd, bare_lfs = 0;
char msg; char msg;
// static char *buf; // Szurgot: Shouldn't this go SOMEWHERE? // static char *buf; // Szurgot: Shouldn't this go SOMEWHERE?
char buf[1024]; char buf[1024];
static int bufsize = 1024; static int bufsize = 1024;
long bytes = 0, hashbytes = HASHBYTES; long bytes = 0, hashbytes = HASHBYTES;
// struct // struct
@ -783,45 +783,45 @@ null();// oldintr = signal(SIGINT, abortrecv);
if (strcmp(local, "-") && *local != '|') { if (strcmp(local, "-") && *local != '|') {
#ifndef _WIN32 #ifndef _WIN32
// This whole thing is a problem... access Won't work on non-existent files // This whole thing is a problem... access Won't work on non-existent files
if (access(local, 2) < 0) { if (access(local, 2) < 0) {
char *dir = rindex(local, '/'); char *dir = rindex(local, '/');
if (errno != ENOENT && errno != EACCES) { if (errno != ENOENT && errno != EACCES) {
perror(local); perror(local);
(void) signal(SIGINT, oldintr); (void) signal(SIGINT, oldintr);
code = -1; code = -1;
return; return;
} }
if (dir != NULL) if (dir != NULL)
*dir = 0; *dir = 0;
d = access(dir ? local : ".", 2); d = access(dir ? local : ".", 2);
if (dir != NULL) if (dir != NULL)
*dir = '/'; *dir = '/';
if (d < 0) { if (d < 0) {
perror(local); perror(local);
(void) signal(SIGINT, oldintr); (void) signal(SIGINT, oldintr);
code = -1; code = -1;
return; return;
} }
if (!runique && errno == EACCES && if (!runique && errno == EACCES &&
chmod(local, 0600) < 0) { chmod(local, 0600) < 0) {
perror(local); perror(local);
(void) signal(SIGINT, oldintr); (void) signal(SIGINT, oldintr);
code = -1; code = -1;
return; return;
} }
if (runique && errno == EACCES && if (runique && errno == EACCES &&
(local = gunique(local)) == NULL) { (local = gunique(local)) == NULL) {
(void) signal(SIGINT, oldintr); (void) signal(SIGINT, oldintr);
code = -1; code = -1;
return; return;
} }
} }
else if (runique && (local = gunique(local)) == NULL) { else if (runique && (local = gunique(local)) == NULL) {
(void) signal(SIGINT, oldintr); (void) signal(SIGINT, oldintr);
code = -1; code = -1;
return; return;
} }
#endif #endif
} }
if (initconn()) { if (initconn()) {
@ -926,15 +926,15 @@ null();// oldintp = signal(SIGPIPE, SIG_IGN);
// if ((d = write(fileno(fout), buf, c)) != c) // if ((d = write(fileno(fout), buf, c)) != c)
// break; // break;
while ((c = recv(din, buf, bufsize, 0)) > 0) { while ((c = recv(din, buf, bufsize, 0)) > 0) {
write(fileno(fout), buf, c); write(fileno(fout), buf, c);
bytes += c; bytes += c;
if (hash) { if (hash) {
while (bytes >= hashbytes) { while (bytes >= hashbytes) {
(void) putchar('#'); (void) putchar('#');
hashbytes += HASHBYTES; hashbytes += HASHBYTES;
} }
(void) fflush(stdout); (void) fflush(stdout);
} }
} }
if (hash && bytes > 0) { if (hash && bytes > 0) {
if (bytes < HASHBYTES) if (bytes < HASHBYTES)
@ -981,23 +981,23 @@ done:
if (c == '\n') if (c == '\n')
bare_lfs++; bare_lfs++;
while (c == '\r') { while (c == '\r') {
while (hash && (bytes >= hashbytes)) { while (hash && (bytes >= hashbytes)) {
(void) putchar('#'); (void) putchar('#');
(void) fflush(stdout); (void) fflush(stdout);
hashbytes += HASHBYTES; hashbytes += HASHBYTES;
} }
bytes++; bytes++;
if ((c = fgetcSocket(din)) != '\n' || tcrflag) { if ((c = fgetcSocket(din)) != '\n' || tcrflag) {
if (ferror(fout)) if (ferror(fout))
goto break2; goto break2;
(void) putc('\r', fout); (void) putc('\r', fout);
if (c == '\0') { if (c == '\0') {
bytes++; bytes++;
goto contin2; goto contin2;
} }
if (c == EOF) if (c == EOF)
goto contin2; goto contin2;
} }
} }
(void) putc(c, fout); (void) putc(c, fout);
bytes++; bytes++;
@ -1089,7 +1089,7 @@ null();// (void) signal(SIGINT,oldintr);
fprintfSocket(cout,"%c%c",IAC,IP); fprintfSocket(cout,"%c%c",IAC,IP);
msg = (char)IAC; msg = (char)IAC;
/* send IAC in urgent mode instead of DM because UNIX places oob mark */ /* send IAC in urgent mode instead of DM because UNIX places oob mark */
/* after urgent byte rather than before as now is protocol */ /* after urgent byte rather than before as now is protocol */
if (send(cout,&msg,1,MSG_OOB) != 1) { if (send(cout,&msg,1,MSG_OOB) != 1) {
perror("abort"); perror("abort");
} }
@ -1154,51 +1154,51 @@ initconn()
if (passivemode) { if (passivemode) {
data = socket(AF_INET, SOCK_STREAM, 0); data = socket(AF_INET, SOCK_STREAM, 0);
if (data < 0) { if (data < 0) {
perror("ftp: socket"); perror("ftp: socket");
return(1); return(1);
} }
if ((options & SO_DEBUG) && if ((options & SO_DEBUG) &&
setsockopt(data, SOL_SOCKET, SO_DEBUG, (char *)&on, setsockopt(data, SOL_SOCKET, SO_DEBUG, (char *)&on,
sizeof (on)) < 0) sizeof (on)) < 0)
perror("ftp: setsockopt (ignored)"); perror("ftp: setsockopt (ignored)");
if (command("PASV") != COMPLETE) { if (command("PASV") != COMPLETE) {
printf("Passive mode refused.\n"); printf("Passive mode refused.\n");
goto bad; goto bad;
} }
/* /*
* What we've got at this point is a string of comma * What we've got at this point is a string of comma
* separated one-byte unsigned integer values. * separated one-byte unsigned integer values.
* The first four are the an IP address. The fifth is * The first four are the an IP address. The fifth is
* the MSB of the port number, the sixth is the LSB. * the MSB of the port number, the sixth is the LSB.
* From that we'll prepare a sockaddr_in. * From that we'll prepare a sockaddr_in.
*/ */
if (sscanf(pasv,"%d,%d,%d,%d,%d,%d", if (sscanf(pasv,"%d,%d,%d,%d,%d,%d",
&a0, &a1, &a2, &a3, &p0, &p1) != 6) { &a0, &a1, &a2, &a3, &p0, &p1) != 6) {
printf("Passive mode address scan failure. Shouldn't happen!\n"); printf("Passive mode address scan failure. Shouldn't happen!\n");
goto bad; goto bad;
} }
bzero(&data_addr, sizeof(data_addr)); bzero(&data_addr, sizeof(data_addr));
data_addr.sin_family = AF_INET; data_addr.sin_family = AF_INET;
a = (char *)&data_addr.sin_addr.s_addr; a = (char *)&data_addr.sin_addr.s_addr;
a[0] = a0 & 0xff; a[0] = a0 & 0xff;
a[1] = a1 & 0xff; a[1] = a1 & 0xff;
a[2] = a2 & 0xff; a[2] = a2 & 0xff;
a[3] = a3 & 0xff; a[3] = a3 & 0xff;
p = (char *)&data_addr.sin_port; p = (char *)&data_addr.sin_port;
p[0] = p0 & 0xff; p[0] = p0 & 0xff;
p[1] = p1 & 0xff; p[1] = p1 & 0xff;
if (connect(data, (struct sockaddr *)&data_addr, if (connect(data, (struct sockaddr *)&data_addr,
sizeof(data_addr)) < 0) { sizeof(data_addr)) < 0) {
perror("ftp: connect"); perror("ftp: connect");
goto bad; goto bad;
} }
return(0); return(0);
} }
@ -1262,26 +1262,26 @@ bad:
int dataconn(const char *mode) int dataconn(const char *mode)
{ {
struct sockaddr_in from; struct sockaddr_in from;
int s, fromlen = sizeof (from); int s, fromlen = sizeof (from);
if (passivemode) if (passivemode)
return (data); return (data);
s = accept(data, (struct sockaddr *) &from, &fromlen); s = accept(data, (struct sockaddr *) &from, &fromlen);
if (s < 0) { if (s < 0) {
perror("ftp: accept"); perror("ftp: accept");
(void) closesocket(data), data = -1; (void) closesocket(data), data = -1;
return (int) (NULL); return (int) (NULL);
} }
if(closesocket(data)) { if(closesocket(data)) {
int iret=WSAGetLastError (); int iret=WSAGetLastError ();
fprintf(stdout,"Error closing socket(%d)\n",iret); fprintf(stdout,"Error closing socket(%d)\n",iret);
(void) fflush(stdout); (void) fflush(stdout);
} }
data = s; data = s;
return (data); return (data);
} }
void ptransfer(direction, bytes, t0, t1) void ptransfer(direction, bytes, t0, t1)
@ -1356,7 +1356,7 @@ void pswitch(int flag)
struct comvars *ip, *op; struct comvars *ip, *op;
abrtflag = 0; abrtflag = 0;
oldintr = signal(SIGINT, psabort); oldintr = signal(SIGINT, psabort);
if (flag) { if (flag) {
if (proxy) if (proxy)
return; return;
@ -1415,7 +1415,7 @@ void pswitch(int flag)
(void) strncpy(ip->mo, mapout, MAXPATHLEN - 1); (void) strncpy(ip->mo, mapout, MAXPATHLEN - 1);
(ip->mo)[strlen(ip->mo)] = '\0'; (ip->mo)[strlen(ip->mo)] = '\0';
(void) strcpy(mapout, op->mo); (void) strcpy(mapout, op->mo);
// (void) signal(SIGINT, oldintr); // (void) signal(SIGINT, oldintr);
if (abrtflag) { if (abrtflag) {
abrtflag = 0; abrtflag = 0;
(*oldintr)(1); (*oldintr)(1);
@ -1816,5 +1816,5 @@ gunique(local)
int null(void) int null(void)
{ {
return 0; return 0;
} }

View file

@ -2249,7 +2249,7 @@ BOOL pe_load_debug_directory(const struct process* pcs, struct module* module,
const IMAGE_SECTION_HEADER* sectp, DWORD nsect, const IMAGE_SECTION_HEADER* sectp, DWORD nsect,
const IMAGE_DEBUG_DIRECTORY* dbg, int nDbg) const IMAGE_DEBUG_DIRECTORY* dbg, int nDbg)
{ {
BOOL ret; BOOL ret = FALSE;
int i; int i;
struct msc_debug_info msc_dbg; struct msc_debug_info msc_dbg;
@ -2261,8 +2261,6 @@ BOOL pe_load_debug_directory(const struct process* pcs, struct module* module,
_SEH_TRY _SEH_TRY
{ {
ret = FALSE;
/* First, watch out for OMAP data */ /* First, watch out for OMAP data */
for (i = 0; i < nDbg; i++) for (i = 0; i < nDbg; i++)
{ {

View file

@ -109,7 +109,7 @@ BOOL WINAPI StackWalk(DWORD MachineType, HANDLE hProcess, HANDLE hThread,
if (curr_mode == stm_start) if (curr_mode == stm_start)
{ {
THREAD_BASIC_INFORMATION info; /*THREAD_BASIC_INFORMATION info;*/
if ((frame->AddrPC.Mode == AddrModeFlat) && if ((frame->AddrPC.Mode == AddrModeFlat) &&
(frame->AddrFrame.Mode != AddrModeFlat)) (frame->AddrFrame.Mode != AddrModeFlat))