From nobody Sat May  3 09:35:46 1997
Received: from cygnus.com by tweedledumb.cygnus.com (4.1/4.7) id AA12452; Sat, 19 Apr 97 04:35:29 EDT
Received: from lists1.best.com (lists1.best.com [206.86.8.15])
	by cygnus.com (8.8.5/8.8.5) with ESMTP id BAA29648
	for <eichin@cygnus.com>; Sat, 19 Apr 1997 01:35:27 -0700 (PDT)
Received: (from daemon@localhost) by lists1.best.com (8.8.5/8.7.3) id XAA07612 for pilot-unix-errors@lists.best.com; Fri, 18 Apr 1997 23:22:10 -0700 (PDT)
Message-Id: <199704190622.XAA07612@lists1.best.com>
From: "Mark W. Eichin" <eichin@cygnus.com>
Subject: [Pilot-Unix] build-prc with subdirectories
Date: 19 Apr 1997 02:14:47 -0400
Bestservhost: lists.best.com
Sender: pilot-unix-errors@lists.best.com
Errors-To: pilot-unix-errors@lists.best.com
To: pilot-unix@lists.best.com
Lines: 61
Xref: maneki-neko.cygnus.com mail.personal.pilot:1404

I was trying to clean up the Makefile from the prc-tools example, and
pushed all the *.bin into a temporary subdirectory (it appears to be
the only way to allow building multiple prc's from the same
directory.) Unfortunately, build-prc extracts the resource id from the
pathname, so it was just getting the first four chars of the
subdirectory name (and the pilot itself isn't too impressed with
"mary" resources :-)  A simple fix follows -- skip to the last slash
if present, otherwise do what it did before.

It helps -- the obvious symptom was no icon, and the program crashing
the pilot (you get a dialog, but on reset it stays stuck at the
black-pilot screen...) and that's fixed now.  (Now to get back to
fixing *my* bugs :-)

*** build-prc.c	1997/04/18 19:07:37	1.1
--- build-prc.c	1997/04/18 19:10:49
***************
*** 8,13 ****
--- 8,14 ----
  #include <stdio.h>
  #include <fcntl.h>
  #include <malloc.h>
+ #include <string.h>
  #include "prc.h"
  
  #ifdef CYGWIN32
***************
*** 24,29 ****
--- 25,31 ----
    char *sd;
    char sname[5];
    int slen;
+   char *rname;
  
    if (argc < 5) {
      fprintf(stderr, "Usage: %s fname.prc 'App Name' apid resource resource ...\n", argv[0]);
***************
*** 50,56 ****
      read(fd, sd, slen);
      close (fd);
  
!     add_section_pfd(pf, argv[i], strtoul(argv[i] + 4, (void *)0, 16),
  		    sd, slen);
    }
  
--- 52,61 ----
      read(fd, sd, slen);
      close (fd);
  
!     rname = strrchr(argv[i], '/');
!     if (rname) rname++; else rname = argv[i];
! 
!     add_section_pfd(pf, rname, strtoul(rname + 4, (void *)0, 16),
  		    sd, slen);
    }
  

--WAA00264.861416869/depreciation.kitten.gen.ma.us--



