Subversion Repositories SvarDOS

Compare Revisions

Ignore whitespace Rev 500 → Rev 501

/svarcom/trunk/cmd/copy.c
55,7 → 55,8
char last_asciimode; /* /A or /B impacts the file preceding it and becomes the new default for all files that follow */
char verifyflag;
char lastitemwasplus;
char databuf[BUFFER_SIZE - 1024];
unsigned short databufsz;
char databuf[1];
};
 
 
185,6 → 186,7
/* parse cmdline and fill the setup struct accordingly */
 
memset(setup, 0, sizeof(*setup));
setup->databufsz = p->BUFFERSZ - sizeof(*setup);
 
for (i = 0; i < p->argc; i++) {
 
341,7 → 343,8
}
outputnl(setup->dst);
 
t = cmd_copy_internal(setup->dst, 0, setup->databuf, 0, appendflag, setup->databuf, sizeof(setup->databuf));
// TODO: reusing setup->databuf not good idea: when 2+ files are being copied, the content of the first one overwrites the pathname of the second one!
t = cmd_copy_internal(setup->dst, 0, setup->databuf, 0, appendflag, setup->databuf, setup->databufsz);
if (t != 0) {
outputnl(doserr(t));
return(-1);
/svarcom/trunk/cmd/date.c
132,7 → 132,7
 
static int cmd_date(struct cmd_funcparam *p) {
struct nls_patterns *nls = (void *)(p->BUFFER);
char *buff = p->BUFFER + (BUFFER_SIZE / 2);
char *buff = p->BUFFER + sizeof(*nls);
unsigned short i;
unsigned short year = 0;
unsigned char mo, dy;
/svarcom/trunk/cmd/dir.c
106,8 → 106,8
unsigned short availrows; /* counter of available rows on display (used for /P) */
unsigned short wcols = screen_getwidth() / WCOLWIDTH; /* number of columns in wide mode */
unsigned char wcolcount;
struct nls_patterns *nls = (void *)(p->BUFFER + (BUFFER_SIZE / 3));
char *buff2 = p->BUFFER + (BUFFER_SIZE / 3 * 2);
struct nls_patterns *nls = (void *)(p->BUFFER + (p->BUFFERSZ / 2));
char *buff2 = p->BUFFER + (p->BUFFERSZ / 2) + sizeof(*nls);
unsigned long summary_fcount = 0;
unsigned long summary_totsz = 0;
unsigned char drv = 0;
/svarcom/trunk/cmd/rename.c
28,9 → 28,9
 
static int cmd_rename(struct cmd_funcparam *p) {
char *src = p->BUFFER;
char *dst = p->BUFFER + (BUFFER_SIZE / 4);
char *buff1 = p->BUFFER + (BUFFER_SIZE / 4 * 2);
char *buff2 = p->BUFFER + (BUFFER_SIZE / 4 * 3);
char *dst = p->BUFFER + 256;
char *buff1 = p->BUFFER + 512;
char *buff2 = p->BUFFER + 1024;
unsigned short i, fnameoffset;
struct DTA *dta = (void *)0x80; /* use default DTA in PSP */
 
/svarcom/trunk/cmd/time.c
136,7 → 136,7
 
static int cmd_time(struct cmd_funcparam *p) {
struct nls_patterns *nls = (void *)(p->BUFFER);
char *buff = p->BUFFER + (BUFFER_SIZE / 2);
char *buff = p->BUFFER + sizeof(*nls);
unsigned short i;
signed char ho = -1, mi = -1, se = -1;
 
/svarcom/trunk/cmd.c
39,16 → 39,17
#include "rmodinit.h"
#include "sayonara.h"
 
#define BUFFER_SIZE 2048 /* make sure this is not bigger than the static buffer in command.c */
 
struct cmd_funcparam {
int argc; /* number of arguments */
const char *argv[256]; /* pointers to each argument */
const char *argv[128]; /* pointers to each argument */
char argvbuf[256]; /* buffer that hold data pointed out by argv[] */
unsigned short env_seg; /* segment of environment block */
struct rmod_props far *rmod; /* rmod settings */
unsigned short argoffset; /* offset of cmdline where first argument starts */
const char *cmdline; /* original cmdline (terminated by a NULL) */
char BUFFER[BUFFER_SIZE]; /* a buffer for whatever is needed */
unsigned short BUFFERSZ; /* avail space in BUFFER */
char BUFFER[1]; /* a buffer for whatever is needed (must be last) */
};
 
/* scans argv for the presence of a "/?" parameter. returns 1 if found, 0 otherwise */
167,7 → 168,7
 
/* explodes a command into an array of arguments where last arg is NULL
* returns number of args */
unsigned short cmd_explode(char *buff, const char far *s, char const **argvlist) {
static unsigned short cmd_explode(char *buff, const char far *s, char const **argvlist) {
int si = 0, argc = 0, i = 0;
for (;;) {
/* skip to next non-space character */
189,10 → 190,11
}
 
 
int cmd_process(struct rmod_props far *rmod, unsigned short env_seg, const char *cmdline, char *BUFFER) {
int cmd_process(struct rmod_props far *rmod, unsigned short env_seg, const char *cmdline, void *BUFFER, unsigned short BUFFERSZ) {
const struct CMD_ID *cmdptr;
unsigned short argoffset;
struct cmd_funcparam *p = (void *)BUFFER;
p->BUFFERSZ = BUFFERSZ - sizeof(*p);
 
/* special case: is this a drive change? (like "E:") */
if ((cmdline[0] != 0) && (cmdline[1] == ':') && ((cmdline[2] == ' ') || (cmdline[2] == 0))) {
228,7 → 230,7
/* printf("recognized internal command: '%s', tail of command at offset %u\r\n", cmdptr->cmd, argoffset); */
 
/* prepare function parameters and feed it to the cmd handling function */
p->argc = cmd_explode(BUFFER + sizeof(*p), cmdline + argoffset, p->argv);
p->argc = cmd_explode(p->argvbuf, cmdline + argoffset, p->argv);
p->env_seg = env_seg;
p->rmod = rmod;
p->argoffset = argoffset;
/svarcom/trunk/cmd.h
28,10 → 28,6
#include "rmodinit.h"
 
/* process internal commands */
int cmd_process(struct rmod_props far *rmod, unsigned short env_seg, const char *cmdline, char *BUFFER);
int cmd_process(struct rmod_props far *rmod, unsigned short env_seg, const char *cmdline, void *BUFFER, unsigned short BUFFERSZ);
 
/* explodes a command into an array of arguments where last arg is NULL
* returns number of args */
unsigned short cmd_explode(char *buff, const char far *s, char const **argvlist);
 
#endif