--- pflash.c.orig 2005-05-31 18:39:49 +0500 +++ pflash.c 2005-06-01 20:19:03 +0500 @@ -653,9 +653,9 @@ #ifndef FREE_BSD -void usage(void) { +void usage(const char *name) { printf("\n"); - printf("Usage: pflash [pflash-options]\n"); + printf("Usage: %s [pflash-options]\n", name); printf(" [-h|--help|-?] Print this help.\n"); printf(" default: enable\n"); printf("\n"); @@ -670,9 +670,9 @@ exit(1); } #else -void usage(void) { +void usage(const char *name) { printf("\n"); - printf("Usage: pflash [pflash-options]\n"); + printf("Usage: %s [pflash-options]\n", name); printf(" [-h|-?] Print this help.\n"); printf(" default: disable\n"); printf("\n"); @@ -700,6 +700,12 @@ int ccc=0,hi_ccc,lo_ccc,new_hi_ccc,new_lo_ccc,i,per_sent=0,offset1 = 0; char *line; + char *name=argv[0]; + char *nametmp=name; + + while (*nametmp) { + if ( *(nametmp++) == '/' ) name=nametmp; + } void restart(void) { buffer[0]=0x1; buflen=1; @@ -737,7 +743,7 @@ switch(opt) { case 'h': - usage(); + usage(name); break; case 'i': @@ -764,14 +770,14 @@ break; case '?': - usage(); + usage(name); break; default: break; } } - if ((opt == -1)&&(keys == 1)) { usage(); } + if ((opt == -1)&&(keys == 1)) { usage(name); } init_sighandler();