On Sat, Nov 07, 2015 at 12:20:42PM +0100, Tobias Stoeckmann wrote:
> Index: bin/mt/mt.c
> ===================================================================
> RCS file: /cvs/src/bin/mt/mt.c,v
> retrieving revision 1.36
> diff -u -p -u -p -r1.36 mt.c
> --- bin/mt/mt.c       12 Nov 2013 04:36:02 -0000      1.36
> +++ bin/mt/mt.c       7 Nov 2015 11:16:25 -0000
> @@ -88,6 +88,8 @@ int         _rmtmtioctop(int fd, struct mtop *c
>  struct mtget *_rmtstatus(int fd);
>  void         _rmtclose(void);
>  
> +extern char  *__progname;
> +
>  char *host = NULL;   /* remote host (if any) */
>  
>  int
> @@ -133,7 +135,6 @@ _rmtclose(void)
>  #endif
>  }
>  
> -char *progname;
>  int  eject = 0;
>  
>  int
> @@ -145,12 +146,7 @@ main(int argc, char *argv[])
>       char *p, *tape, *realtape, *opts;
>       size_t len;
>  
> -     if ((progname = strrchr(argv[0], '/')))
> -             progname++;
> -     else
> -             progname = argv[0];
> -
> -     if (strcmp(progname, "eject") == 0) {
> +     if (strcmp(__progname, "eject") == 0) {
>               opts = "t";
>               eject = 1;
>               tape = NULL;

As Ingo recently reminded me, OpenBSD actually did add getprogname() at
some point, which needs need a actually manual forward definition.

Joerg

Reply via email to