Changeset 01cb6c9 in rtems-schedsim


Ignore:
Timestamp:
May 27, 2014, 2:06:47 PM (5 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
master
Children:
f6fe059
Parents:
d36a128
Message:

schedsim.c: Print basename of scenarion and verbose is on by default

File:
1 edited

Legend:

Unmodified
Added
Removed
  • schedsim/shell/shared/schedsim.c

    rd36a128 r01cb6c9  
    5858  rtems_shell_cmd_t *shell_cmd;
    5959 
    60  
    6160  while ( 1 ) {
    6261    cStatus = fgets( buffer, sizeof(buffer), script );
     
    7978        break;
    8079    }
    81 
    8280
    8381    if (!strcmp(c,"bye") || !strcmp(c,"exit")) {
     
    112110)
    113111{
    114   int  sc; 
    115   int  opt;
     112  int         sc; 
     113  int         opt;
     114  const char *short_p;
    116115
    117116  progname = argv[0];
     
    119118  while ((opt = getopt(argc, argv, "v")) != -1) {
    120119    switch (opt) {
    121       case 'v': verbose = 0;                break;
     120      case 'v': verbose = 0;  break;
    122121      default: /* '?' */
    123122        usage();
     
    133132  if ( !strcmp( scriptname, "-" ) ) {
    134133    scriptname = "/dev/stdin";
     134    short_p    = scriptname;
     135  } else {
     136    size_t  slen;
     137
     138    slen = strlen( scriptname );  /* Should not trust input but what's max? */
     139    for ( ; slen > 0 ; slen-- ) {
     140      if ( scriptname[slen] == '/' ) {
     141        slen++;
     142        break;
     143      }
     144    }
     145    short_p = &scriptname[ slen ];
    135146  }
    136147
     
    139150      "Script File               : %s\n"
    140151      "verbose                   : %d\n",
    141       scriptname,
     152      short_p,
    142153      verbose
    143154    );
Note: See TracChangeset for help on using the changeset viewer.