summaryrefslogtreecommitdiffstats
path: root/cpukit/libmisc/shell
diff options
context:
space:
mode:
authorRalf Corsepius <ralf.corsepius@rtems.org>2004-04-16 12:06:28 +0000
committerRalf Corsepius <ralf.corsepius@rtems.org>2004-04-16 12:06:28 +0000
commitaed742c9a09fc443418ba4ef8f31892ef00df984 (patch)
treee9d0138d2456e7ec94be79b66f1f06181d308743 /cpukit/libmisc/shell
parentRemove stray white spaces. (diff)
downloadrtems-aed742c9a09fc443418ba4ef8f31892ef00df984.tar.bz2
Remove stray white spaces.
Diffstat (limited to 'cpukit/libmisc/shell')
-rw-r--r--cpukit/libmisc/shell/cmds.c104
-rw-r--r--cpukit/libmisc/shell/shell.c138
-rw-r--r--cpukit/libmisc/shell/shell.h24
3 files changed, 133 insertions, 133 deletions
diff --git a/cpukit/libmisc/shell/cmds.c b/cpukit/libmisc/shell/cmds.c
index 3272c8ff32..50a086c0cf 100644
--- a/cpukit/libmisc/shell/cmds.c
+++ b/cpukit/libmisc/shell/cmds.c
@@ -5,19 +5,19 @@
* Home: correo@fernando-ruiz.com
*
* This file is inspired in rtems_monitor & Chris John MyRightBoot
- *
+ *
* But I want to make it more user friendly
* A 'monitor' command is added to adapt the call rtems monitor commands
* at my call procedure
- *
- * TODO: A lot of improvements of course.
+ *
+ * TODO: A lot of improvements of course.
* cp, mv, ...
* hexdump,
- *
+ *
* More? Say me it, please...
- *
+ *
* The BSP Specific are not welcome here.
- *
+ *
* C&S welcome...
*
* $Id$
@@ -53,7 +53,7 @@
- str to int "0xaffe" "0b010010" "0123" "192939"
* ----------------------------------------------- */
int str2int(char * s) {
- int sign=1;
+ int sign=1;
int base=10;
int value=0;
int digit;
@@ -78,7 +78,7 @@ int str2int(char * s) {
default :base=8;
break;
}
- };
+ };
while (*s) {
switch(*s) {
case '0':
@@ -92,28 +92,28 @@ int str2int(char * s) {
case '8':
case '9':digit=*s-'0';
break;
- case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
+ case 'A':
+ case 'B':
+ case 'C':
+ case 'D':
+ case 'E':
case 'F':digit=*s-'A'+10;
break;
- case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
+ case 'a':
+ case 'b':
+ case 'c':
+ case 'd':
+ case 'e':
case 'f':digit=*s-'a'+10;
break;
- default:return value*sign;
+ default:return value*sign;
};
if (digit>base) return value*sign;
value=value*base+digit;
s++;
};
};
- return value*sign;
+ return value*sign;
}
/*----------------------------------------------------------------------------*
* RAM MEMORY COMMANDS
@@ -219,8 +219,8 @@ int main_mmove(int argc,char * argv[]) {
/*----------------------------------------------------------------------------*/
#ifdef MALLOC_STATS /* /rtems/s/src/lib/libc/malloc.c */
int main_malloc_dump(int argc,char * argv[]) {
- void malloc_dump(void);
- malloc_dump();
+ void malloc_dump(void);
+ malloc_dump();
return 0;
}
#endif
@@ -234,7 +234,7 @@ int main_reset (int argc, char **argv)
tcdrain(fileno(stdout));
rtems_interrupt_disable (level);
- for (;;)
+ for (;;)
;
return 0;
}
@@ -251,8 +251,8 @@ int main_alias (int argc, char **argv)
printf("unable to make an alias(%s,%s)\n",argv[1],argv[2]);
};
return 0;
-}
-/*-----------------------------------------------------------*
+}
+/*-----------------------------------------------------------*
* Directory commands
*-----------------------------------------------------------*/
int main_ls(int argc, char *argv[])
@@ -286,7 +286,7 @@ int main_ls(int argc, char *argv[])
strcat(nbuf,dp->d_name); /* always the fullpathname. Avoid ftpd problem.*/
if (stat(nbuf, &stat_buf) == 0)
{ /* AWFUL buts works...*/
- strftime(sbuf,sizeof(sbuf)-1,"%b %d %H:%M",gmtime(&stat_buf.st_mtime));
+ strftime(sbuf,sizeof(sbuf)-1,"%b %d %H:%M",gmtime(&stat_buf.st_mtime));
pwd=getpwuid(stat_buf.st_uid);
user=pwd?pwd->pw_name:"nouser";
grp=getgrgid(stat_buf.st_gid);
@@ -304,7 +304,7 @@ int main_ls(int argc, char *argv[])
(stat_buf.st_mode & S_IWOTH)?('w'):('-'),
(stat_buf.st_mode & S_IXOTH)?('x'):('-'),
(int)stat_buf.st_nlink,
- user,group,
+ user,group,
(int)stat_buf.st_size,
sbuf,
dp->d_name,
@@ -317,14 +317,14 @@ int main_ls(int argc, char *argv[])
closedir(dirp);
return 0;
}
-/*-----------------------------------------------------------*/
+/*-----------------------------------------------------------*/
int main_pwd (int argc, char *argv[]) {
char dir[1024];
getcwd(dir,1024);
printf("%s\n",dir);
return 0;
}
-/*-----------------------------------------------------------*/
+/*-----------------------------------------------------------*/
int main_chdir (int argc, char *argv[]) {
char *dir;
dir="/";
@@ -332,10 +332,10 @@ int main_chdir (int argc, char *argv[]) {
if (chdir(dir)) {
printf("chdir to '%s' failed:%s\n",dir,strerror(errno));
return errno;
- };
+ };
return 0;
}
-/*-----------------------------------------------------------*/
+/*-----------------------------------------------------------*/
int main_mkdir (int argc, char *argv[]) {
char *dir;
int n;
@@ -344,11 +344,11 @@ int main_mkdir (int argc, char *argv[]) {
dir=argv[n++];
if (mkdir(dir,S_IRWXU|S_IRWXG|S_IRWXO)) {
printf("mkdir '%s' failed:%s\n",dir,strerror(errno));
- };
- };
+ };
+ };
return errno;
}
-/*-----------------------------------------------------------*/
+/*-----------------------------------------------------------*/
int main_rmdir (int argc, char *argv[])
{
char *dir;
@@ -360,7 +360,7 @@ int main_rmdir (int argc, char *argv[])
};
return errno;
}
-/*-----------------------------------------------------------*/
+/*-----------------------------------------------------------*/
int main_chroot(int argc,char * argv[]) {
char * new_root="/";
if (argc==2) new_root=argv[1];
@@ -370,7 +370,7 @@ int main_chroot(int argc,char * argv[]) {
};
return 0;
}
-/*-----------------------------------------------------------*/
+/*-----------------------------------------------------------*/
int main_cat (int argc, char *argv[])
{
int n;
@@ -378,7 +378,7 @@ int main_cat (int argc, char *argv[])
while (n<argc) cat_file(stdout,argv[n++]);
return 0;
}
-/*-----------------------------------------------------------*/
+/*-----------------------------------------------------------*/
int main_rm (int argc, char *argv[])
{
int n;
@@ -392,10 +392,10 @@ int main_rm (int argc, char *argv[])
};
return 0;
}
-/*-----------------------------------------------------------*/
+/*-----------------------------------------------------------*/
/* date - print time and date */
-int main_date(int argc,char *argv[])
+int main_date(int argc,char *argv[])
{
time_t t;
time(&t);
@@ -403,20 +403,20 @@ int main_date(int argc,char *argv[])
return 0;
}
/*-----------------------------------------------------------*/
-int main_logoff(int argc,char *argv[])
+int main_logoff(int argc,char *argv[])
{
- printf("logoff from the system...");
- current_shell_env->exit_shell=TRUE;
+ printf("logoff from the system...");
+ current_shell_env->exit_shell=TRUE;
return 0;
}
/*-----------------------------------------------------------*/
-int main_tty (int argc,char *argv[])
+int main_tty (int argc,char *argv[])
{
printf("%s\n",ttyname(fileno(stdin)));
return 0;
}
/*-----------------------------------------------------------*/
-int main_whoami(int argc,char *argv[])
+int main_whoami(int argc,char *argv[])
{
struct passwd * pwd;
pwd=getpwuid(getuid());
@@ -424,7 +424,7 @@ int main_whoami(int argc,char *argv[])
return 0;
}
/*-----------------------------------------------------------*/
-int main_id (int argc,char *argv[])
+int main_id (int argc,char *argv[])
{
struct passwd * pwd;
struct group * grp;
@@ -441,7 +441,7 @@ int main_id (int argc,char *argv[])
return 0;
}
/*-----------------------------------------------------------*/
-int main_umask(int argc,char *argv[])
+int main_umask(int argc,char *argv[])
{
mode_t msk=umask(0);
if (argc == 2) msk=str2int(argv[1]);
@@ -452,7 +452,7 @@ int main_umask(int argc,char *argv[])
return 0;
}
/*-----------------------------------------------------------*/
-int main_chmod(int argc,char *argv[])
+int main_chmod(int argc,char *argv[])
{
int n;
mode_t mode;
@@ -463,10 +463,10 @@ int main_chmod(int argc,char *argv[])
};
return 0;
}
-/*-----------------------------------------------------------*
+/*-----------------------------------------------------------*
* with this you can call at all the rtems monitor commands.
* Not all work fine but you can show the rtems status and more.
- *-----------------------------------------------------------*/
+ *-----------------------------------------------------------*/
int main_monitor(int argc,char * argv[]) {
rtems_monitor_command_entry_t *command;
rtems_task_ident(RTEMS_SELF,0,&rtems_monitor_task_id);
@@ -476,7 +476,7 @@ int main_monitor(int argc,char * argv[]) {
command->command_function(argc, argv, &command->command_arg, 0);
return 0;
}
-/*-----------------------------------------------------------*/
+/*-----------------------------------------------------------*/
void register_cmds(void) {
rtems_monitor_command_entry_t *command;
/* monitor topic */
@@ -503,7 +503,7 @@ void register_cmds(void) {
/* misc. topic */
shell_add_cmd ("logoff","misc","logoff from the system" ,main_logoff);
- shell_alias_cmd("logoff","exit");
+ shell_alias_cmd("logoff","exit");
shell_add_cmd ("date" ,"misc","date" ,main_date);
shell_add_cmd ("reset","misc","reset the BSP" ,main_reset);
shell_add_cmd ("alias","misc","alias old new" ,main_alias);
@@ -521,6 +521,6 @@ void register_cmds(void) {
shell_add_cmd ("mmove","mem" ,"mmove dst src size" ,main_mmove);
#ifdef MALLOC_STATS /* /rtems/s/src/lib/libc/malloc.c */
shell_add_cmd ("malloc","mem","mem show memory malloc'ed" ,main_mem);
-#endif
+#endif
}
/*-----------------------------------------------------------*/
diff --git a/cpukit/libmisc/shell/shell.c b/cpukit/libmisc/shell/shell.c
index 048de82c29..4f106d5390 100644
--- a/cpukit/libmisc/shell/shell.c
+++ b/cpukit/libmisc/shell/shell.c
@@ -2,9 +2,9 @@
*
* Instantatiate a new terminal shell.
*
- * Author:
+ * Author:
*
- * WORK: fernando.ruiz@ctv.es
+ * WORK: fernando.ruiz@ctv.es
* HOME: correo@fernando-ruiz.com
*
* Thanks at:
@@ -22,8 +22,8 @@
#include <rtems.h>
#include <rtems/error.h>
#include <rtems/libio.h>
-#include <rtems/libio_.h>
-#include <rtems/system.h>
+#include <rtems/libio_.h>
+#include <rtems/system.h>
#include <rtems/shell.h>
#include <termios.h>
@@ -65,7 +65,7 @@ struct shell_topic_tt {
static shell_cmd_t * shell_first_cmd;
static shell_topic_t * shell_first_topic;
/* ----------------------------------------------- *
- * Using Chain I can reuse the rtems code.
+ * Using Chain I can reuse the rtems code.
* I am more comfortable with this, sorry.
* ----------------------------------------------- */
shell_topic_t * shell_lookup_topic(char * topic) {
@@ -81,7 +81,7 @@ shell_topic_t * shell_lookup_topic(char * topic) {
shell_topic_t * shell_add_topic(char * topic) {
shell_topic_t * current,*aux;
if (!shell_first_topic) {
- aux=malloc(sizeof(shell_topic_t));
+ aux=malloc(sizeof(shell_topic_t));
aux->topic=topic;
aux->next=(shell_topic_t*)NULL;
return shell_first_topic=aux;
@@ -91,8 +91,8 @@ shell_topic_t * shell_add_topic(char * topic) {
while (current->next) {
if (!strcmp(topic,current->next->topic)) return current->next;
current=current->next;
- };
- aux=malloc(sizeof(shell_topic_t));
+ };
+ aux=malloc(sizeof(shell_topic_t));
aux->topic=topic;
aux->next=(shell_topic_t*)NULL;
current->next=aux;
@@ -185,7 +185,7 @@ int shell_help_cmd(shell_cmd_t * shell_cmd) {
line=1;
if (shell_cmd->alias) {
printf("is an <alias> for command '%s'",shell_cmd->alias->name);
- } else
+ } else
if (shell_cmd->usage) {
pc=shell_cmd->usage;
while (*pc) {
@@ -198,7 +198,7 @@ int shell_help_cmd(shell_cmd_t * shell_cmd) {
col++;
break;
};
- pc++;
+ pc++;
if(col>78) { /* What daring... 78?*/
if (*pc) {
putchar('\n');
@@ -208,7 +208,7 @@ int shell_help_cmd(shell_cmd_t * shell_cmd) {
if (!col && *pc) {
printf(" ");
col=12;line++;
- };
+ };
};
};
puts("");
@@ -220,12 +220,12 @@ int shell_help_cmd(shell_cmd_t * shell_cmd) {
* The same with all the commands....
* ----------------------------------------------- */
int shell_help(int argc,char * argv[]) {
- int col,line,arg;
+ int col,line,arg;
shell_topic_t *topic;
shell_cmd_t * shell_cmd=shell_first_cmd;
if (argc<2) {
- printf("help: ('r' repeat last cmd - 'e' edit last cmd)\n"
- " TOPIC? The topics are\n");
+ printf("help: ('r' repeat last cmd - 'e' edit last cmd)\n"
+ " TOPIC? The topics are\n");
topic=shell_first_topic;
col=0;
while (topic) {
@@ -237,7 +237,7 @@ int shell_help(int argc,char * argv[]) {
col=printf(" %s",topic->topic);
} else {
col+=printf(", %s",topic->topic);
- };
+ };
};
topic=topic->next;
};
@@ -264,7 +264,7 @@ int shell_help(int argc,char * argv[]) {
printf("help: list for the topic '%s'\n",argv[arg]);
line++;
while (shell_cmd) {
- if (!strcmp(topic->topic,shell_cmd->topic))
+ if (!strcmp(topic->topic,shell_cmd->topic))
line+=shell_help_cmd(shell_cmd);
if (line>16) {
printf("Press any key to continue...");getchar();
@@ -273,7 +273,7 @@ int shell_help(int argc,char * argv[]) {
};
shell_cmd=shell_cmd->next;
};
- };
+ };
puts("");
return 0;
}
@@ -284,13 +284,13 @@ int shell_scanline(char * line,int size,FILE * in,FILE * out) {
int c,col;
col=0;
if (*line) {
- col=strlen(line);
+ col=strlen(line);
if (out) fprintf(out,"%s",line);
};
tcdrain(fileno(in ));
if (out) tcdrain(fileno(out));
for (;;) {
- line[col]=0;
+ line[col]=0;
c=fgetc(in);
switch (c) {
case 0x04:/*Control-d*/
@@ -299,7 +299,7 @@ int shell_scanline(char * line,int size,FILE * in,FILE * out) {
case '\n':break;
case '\f':if (out) fputc('\f',out);
case 0x03:/*Control-C*/
- line[0]=0;
+ line[0]=0;
case '\r':if (out) fputc('\n',out);
return 1;
case 127:
@@ -316,13 +316,13 @@ int shell_scanline(char * line,int size,FILE * in,FILE * out) {
break;
default :if (!iscntrl(c)) {
if (col<size-1) {
- line[col++]=c;
+ line[col++]=c;
if (out) fputc(c,out);
} else {
if (out) fputc('\a',out);
};
} else {
- if (out)
+ if (out)
if (c=='\a') fputc('\a',out);
};
break;
@@ -330,14 +330,14 @@ int shell_scanline(char * line,int size,FILE * in,FILE * out) {
};
}
/* ----------------------------------------------- *
- * - The shell TASK
+ * - The shell TASK
* Poor but enough..
* TODO: Redirection. Tty Signals. ENVVARs. Shell language.
* ----------------------------------------------- */
shell_env_t global_shell_env ,
- * current_shell_env=&global_shell_env;
+ * current_shell_env=&global_shell_env;
-extern char **environ;
+extern char **environ;
void cat_file(FILE * out,char * name) {
FILE * fd;
@@ -348,7 +348,7 @@ void cat_file(FILE * out,char * name) {
while ((c=fgetc(fd))!=EOF) fputc(c,out);
fclose(fd);
};
- };
+ };
}
void write_file(char * name,char * content) {
@@ -357,7 +357,7 @@ void write_file(char * name,char * content) {
if (fd) {
fwrite(content,1,strlen(content),fd);
fclose(fd);
- };
+ };
}
void init_issue(void) {
@@ -366,11 +366,11 @@ void init_issue(void) {
if (issue_inited) return;
issue_inited=TRUE;
getpwnam("root"); /* dummy call to init /etc dir */
- if (stat("/etc/issue",&buf))
+ if (stat("/etc/issue",&buf))
write_file("/etc/issue",
"Welcome to @V\\n"
"Login into @S(@L)\\n");
- if (stat("/etc/issue.net",&buf))
+ if (stat("/etc/issue.net",&buf))
write_file("/etc/issue.net",
"Welcome to %v\n"
"running on %m\n");
@@ -415,7 +415,7 @@ int shell_login(FILE * in,FILE * out) {
default :fprintf(out,"@%c",c);
break;
};
- } else
+ } else
if (c=='\\') {
switch(c=fgetc(fd)) {
case '\\':fprintf(out,"\\");
@@ -429,12 +429,12 @@ int shell_login(FILE * in,FILE * out) {
case '@':fprintf(out,"@"); break;
};
} else {
- fputc(c,out);
- };
+ fputc(c,out);
+ };
};
fclose(fd);
- }
- } else {
+ }
+ } else {
fd=fopen("/etc/issue.net","r");
if (fd) {
while ((c=fgetc(fd))!=EOF) {
@@ -463,11 +463,11 @@ int shell_login(FILE * in,FILE * out) {
break;
};
} else {
- fputc(c,out);
- };
+ fputc(c,out);
+ };
};
fclose(fd);
- }
+ }
};
};
times=0;
@@ -483,13 +483,13 @@ int shell_login(FILE * in,FILE * out) {
if (out) fprintf(out,"\n");
if ((passwd=getpwnam(name))) {
if (strcmp(passwd->pw_passwd,"!")) { /* valid user */
- setuid(passwd->pw_uid);
- setgid(passwd->pw_gid);
+ setuid(passwd->pw_uid);
+ setgid(passwd->pw_gid);
rtems_current_user_env->euid=
rtems_current_user_env->egid=0;
chown(current_shell_env->devname,passwd->pw_uid,0);
- rtems_current_user_env->euid=passwd->pw_uid;
- rtems_current_user_env->egid=passwd->pw_gid;
+ rtems_current_user_env->euid=passwd->pw_uid;
+ rtems_current_user_env->egid=passwd->pw_gid;
if (!strcmp(passwd->pw_passwd,"*")) {
/* /etc/shadow */
return 0;
@@ -513,7 +513,7 @@ rtems_task shell_shell(rtems_task_argument task_argument) {
rtems_status_code sc;
- struct termios term;
+ struct termios term;
char * devname;
char curdir[256];
@@ -524,17 +524,17 @@ rtems_task shell_shell(rtems_task_argument task_argument) {
sc=rtems_task_variable_add(RTEMS_SELF,(void*)&current_shell_env,free);
if (sc!=RTEMS_SUCCESSFUL) {
- rtems_error(sc,"rtems_task_variable_add(current_shell_env):");
+ rtems_error(sc,"rtems_task_variable_add(current_shell_env):");
rtems_task_delete(RTEMS_SELF);
- };
+ };
+
+ current_shell_env=shell_env;
- current_shell_env=shell_env;
-
sc=rtems_libio_set_private_env();
if (sc!=RTEMS_SUCCESSFUL) {
- rtems_error(sc,"rtems_libio_set_private_env():");
+ rtems_error(sc,"rtems_libio_set_private_env():");
rtems_task_delete(RTEMS_SELF);
- };
+ };
devname=shell_env->devname;
@@ -544,7 +544,7 @@ rtems_task shell_shell(rtems_task_argument task_argument) {
rtems_current_user_env->egid=0;
stdin =fopen(devname,"r+");
-
+
if (!stdin) {
fprintf(stderr,"shell:unable to open stdin.%s:%s\n",devname,strerror(errno));
rtems_task_delete(RTEMS_SELF);
@@ -578,10 +578,10 @@ rtems_task shell_shell(rtems_task_argument task_argument) {
};
shell_add_cmd(NULL,NULL,NULL,NULL); /* init the chain list*/
do {
- /* Set again root user and root filesystem, side effect of set_priv..*/
+ /* Set again root user and root filesystem, side effect of set_priv..*/
sc=rtems_libio_set_private_env();
if (sc!=RTEMS_SUCCESSFUL) {
- rtems_error(sc,"rtems_libio_set_private_env():");
+ rtems_error(sc,"rtems_libio_set_private_env():");
rtems_task_delete(RTEMS_SELF);
};
if (!shell_login(stdin,stdout)) {
@@ -593,30 +593,30 @@ rtems_task shell_shell(rtems_task_argument task_argument) {
chdir("/"); /* XXX: chdir to getpwent homedir */
shell_env->exit_shell=FALSE;
for (;;) {
- /* Prompt section */
+ /* Prompt section */
/* XXX: show_prompt user adjustable */
getcwd(curdir,sizeof(curdir));
printf("%s [%s] %c ",shell_env->taskname,curdir,geteuid()?'$':'#');
- /* getcmd section */
+ /* getcmd section */
if (!shell_scanline(cmd,sizeof(cmd),stdin,stdout)) break; /*EOF*/
- /* evaluate cmd section */
+ /* evaluate cmd section */
if (!strcmp(cmd,"e")) { /* edit last command */
strcpy(cmd,last_cmd);
continue;
- } else
+ } else
if (!strcmp(cmd,"r")) { /* repeat last command */
strcpy(cmd,last_cmd);
- } else
+ } else
if (strcmp(cmd,"")) { /* only for get a new prompt */
strcpy(last_cmd,cmd);
- };
- /* exec cmd section */
- /* TODO:
- * To avoid user crash catch the signals.
+ };
+ /* exec cmd section */
+ /* TODO:
+ * To avoid user crash catch the signals.
* Open a new stdio files with posibility of redirection *
* Run in a new shell task background. (unix &)
* Resuming. A little bash.
- */
+ */
if (shell_make_args(cmd,&argc,argv)) {
if ((shell_cmd=shell_lookup_cmd(argv[0]))!=NULL) {
shell_env->errorlevel=shell_cmd->command(argc,argv);
@@ -625,7 +625,7 @@ rtems_task shell_shell(rtems_task_argument task_argument) {
shell_env->errorlevel=-1;
};
};
- /* end exec cmd section */
+ /* end exec cmd section */
if (shell_env->exit_shell) break;
cmd[0]=0;
};
@@ -633,7 +633,7 @@ rtems_task shell_shell(rtems_task_argument task_argument) {
};
} while (shell_env->forever);
fclose(stdin );
- fclose(stdout);
+ fclose(stdout);
fclose(stderr);
rtems_task_delete(RTEMS_SELF);
}
@@ -654,14 +654,14 @@ rtems_status_code shell_init (char * task_name,
RTEMS_LOCAL | RTEMS_FLOATING_POINT,
&task_id);
if (sc!=RTEMS_SUCCESSFUL) {
- rtems_error(sc,"creating task %s in shell_init()",task_name);
+ rtems_error(sc,"creating task %s in shell_init()",task_name);
return sc;
- };
+ };
shell_env=malloc(sizeof(shell_env_t));
if (!shell_env) {
rtems_task_delete(task_id);
- sc=RTEMS_NO_MEMORY;
- rtems_error(sc,"allocating shell_env %s in shell_init()",task_name);
+ sc=RTEMS_NO_MEMORY;
+ rtems_error(sc,"allocating shell_env %s in shell_init()",task_name);
return sc;
};
if (global_shell_env.magic!=new_rtems_name("SENV")) {
@@ -671,8 +671,8 @@ rtems_status_code shell_init (char * task_name,
global_shell_env.tcflag =0;
global_shell_env.exit_shell=0;
global_shell_env.forever =TRUE;
- };
- shell_env->magic =global_shell_env.magic;
+ };
+ shell_env->magic =global_shell_env.magic;
shell_env->devname =devname;
shell_env->taskname =task_name;
shell_env->tcflag =tcflag;
diff --git a/cpukit/libmisc/shell/shell.h b/cpukit/libmisc/shell/shell.h
index ba57d7ca2a..c4bf49067a 100644
--- a/cpukit/libmisc/shell/shell.h
+++ b/cpukit/libmisc/shell/shell.h
@@ -2,9 +2,9 @@
*
* Instantatiate a new terminal shell.
*
- * Author:
+ * Author:
*
- * WORK: fernando.ruiz@ctv.es
+ * WORK: fernando.ruiz@ctv.es
* HOME: correo@fernando-ruiz.com
*
* Thanks at:
@@ -18,11 +18,11 @@
#ifdef __cplusplus
extern "C" {
-#endif
+#endif
-#include <rtems.h>
-#include <stdio.h>
-#include <termios.h>
+#include <rtems.h>
+#include <stdio.h>
+#include <termios.h>
typedef int (*shell_command_t)(int argc,char * argv[]);
@@ -51,7 +51,7 @@ int shell_make_args(char * cmd,
char * argv[]);
typedef struct {
- rtems_name magic; /* 'S','E','N','V': Shell Environment */
+ rtems_name magic; /* 'S','E','N','V': Shell Environment */
char * devname;
char * taskname;
tcflag_t tcflag;
@@ -65,24 +65,24 @@ typedef struct {
int shell_scanline(char * line,int size,FILE * in,FILE * out) ;
void cat_file(FILE * out,char *name);
void write_file(char *name,char * content);
-
+
rtems_status_code shell_init(char * task_name ,
uint32_t task_stacksize,/*0 default*/
rtems_task_priority task_priority ,
char * devname ,
tcflag_t tcflag ,
- int forever );
+ int forever );
extern shell_env_t global_shell_env,
* current_shell_env;
/*--------*/
-/* cmds.c */
+/* cmds.c */
/*--------*/
int str2int(char * s);
void register_cmds(void);
-
+
#ifdef __cplusplus
}
-#endif
+#endif
#endif