Changeset 70d689a in rtems for cpukit/libmisc/shell/cmds.c


Ignore:
Timestamp:
Aug 9, 2001, 10:08:46 PM (20 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
b6a2d2fa
Parents:
bd520203
Message:

2001-08-09 Fernando-Ruiz Casas <correo@…>

  • shell/Makefile.am, shell/README, shell/cmds.c, shell/shell.c, shell/shell.h: Updates.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libmisc/shell/cmds.c

    rbd520203 r70d689a  
    335335int main_mkdir (int argc, char *argv[]) {
    336336   char *dir;
    337    dir=NULL;
    338    if (argc>1) dir=argv[1];
    339    if (mkdir(dir,S_IRWXU|S_IRWXG|S_IRWXO)) {
    340      printf("mkdir '%s' failed:%s\n",dir,strerror(errno));
     337   int n;
     338   n=1;
     339   while (n<argc) {
     340    dir=argv[n++];
     341    if (mkdir(dir,S_IRWXU|S_IRWXG|S_IRWXO)) {
     342      printf("mkdir '%s' failed:%s\n",dir,strerror(errno));
     343    }; 
    341344   }; 
    342345   return errno;
     
    346349{
    347350   char *dir;
    348    dir=NULL;
    349    if (argc>1) dir=argv[1];
    350    if (rmdir(dir)) printf("rmdir '%s' failed:%s\n",dir,strerror(errno));
     351   int n;
     352   n=1;
     353   while (n<argc) {
     354    dir=argv[n++];
     355    if (rmdir(dir)) printf("rmdir '%s' failed:%s\n",dir,strerror(errno));
     356   };
    351357   return errno;
    352358}
     
    384390}
    385391/*-----------------------------------------------------------*/         
    386 /* date - print or set time and date */
    387 
    388 static int set_time(char *t)
    389 {
    390   rtems_time_of_day tod;       
    391   FILE * rtc;
    392   int len;
    393 
    394   if ( rtems_clock_get(RTEMS_CLOCK_GET_TOD,&tod) != RTEMS_SUCCESSFUL )
    395      memset( &tod, 0, sizeof(tod) );
    396 
    397   /* JRS
    398    *
    399    *  This code that was used to parse the command line was taken
    400    *  from an inappropriate source.  It has been removed and needs
    401    *  to be replaced.
    402    */
    403 
    404   if (!_TOD_Validate(&tod)) {
    405     fprintf(stderr, "Invalid date value\n");
    406   } else {
    407    rtems_clock_set(&tod);         
    408    rtems_clock_get(RTEMS_CLOCK_GET_TOD,&tod);     
    409    rtc=fopen("/dev/rtc","r+");
    410    if (rtc) {
    411     fwrite(&tod,sizeof(tod),1,rtc);
    412     fclose(rtc);
    413    };
    414   };
    415   return 1;
    416 }
     392/* date - print time and date */
    417393
    418394int main_date(int argc,char *argv[])
    419395{
    420396  time_t t;
    421   if (argc == 2)
    422     set_time(argv[1]);
    423397  time(&t);
    424398  printf("%s", ctime(&t));
     
    529503  shell_add_cmd  ("logoff","misc","logoff from the system"                    ,main_logoff);
    530504  shell_alias_cmd("logoff","exit");
    531   shell_add_cmd  ("date" ,"misc","date [[MMDDYY]hhmm[ss]]"                    ,main_date);
     505  shell_add_cmd  ("date" ,"misc","date"                                       ,main_date);
    532506  shell_add_cmd  ("reset","misc","reset the BSP"                              ,main_reset);
    533507  shell_add_cmd  ("alias","misc","alias old new"                              ,main_alias);
Note: See TracChangeset for help on using the changeset viewer.