|
From: Pascal B. <pb...@us...> - 2001-11-27 12:45:45
|
Update of /cvsroot/mpkg/mpkg/src
In directory usw-pr-cvs1:/tmp/cvs-serv26310/src
Modified Files:
dist.c
Log Message:
Put verbose level 4 for parsing informations.
Index: dist.c
===================================================================
RCS file: /cvsroot/mpkg/mpkg/src/dist.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** dist.c 2001/10/29 10:50:30 1.5
--- dist.c 2001/11/27 12:45:40 1.6
***************
*** 101,104 ****
--- 101,109 ----
#define SKIP_MASK 7 /* Bits to look at */
+ #define LOGVERBOSE(a) \
+ do \
+ if (Verbosity > 2) \
+ a; \
+ while (0);
/* Add a command to the distribution. */
***************
*** 146,149 ****
--- 151,156 ----
temp->command = strdup (command);
+ LOGVERBOSE (fprintf (stderr, "Add command <%s>\n", command));
+
if (temp->command == NULL)
{
***************
*** 151,155 ****
return;
}
-
dist->num_commands++;
}
--- 158,161 ----
***************
*** 167,175 ****
const char *lineptr; /* Temporary pointer into line */
-
- /*
- * Allocate memory for the dependency...
- */
-
if (dist->num_depends == 0)
temp = malloc (sizeof (depend_t));
--- 173,176 ----
***************
*** 188,197 ****
dist->num_depends++;
- /*
- * Initialize the dependency record...
- */
-
memset (temp, 0, sizeof (depend_t));
-
temp->type = type;
--- 189,193 ----
***************
*** 207,214 ****
line++;
/*
! * Get the version strings, if any...
*/
-
for (i = 0; *line && i < 2; i++)
{
--- 203,211 ----
line++;
+ LOGVERBOSE (printf (stderr, "Add dependency <%s>(%d).\n", temp->product,
+ dist->num_depends));
/*
! * Get the version strings, if any.
*/
for (i = 0; *line && i < 2; i++)
{
***************
*** 216,220 ****
* Handle <version, >version, etc.
*/
-
if (!isdigit ((int) *line))
{
--- 213,216 ----
***************
*** 233,239 ****
/*
! * Grab the version string...
*/
-
for (ptr = temp->version[i]; *line && !isspace ((int) *line); line++)
if (ptr < (temp->version[i] + sizeof (temp->version[i]) - 1))
--- 229,234 ----
/*
! * Grab the version string.
*/
for (ptr = temp->version[i]; *line && !isspace ((int) *line); line++)
if (ptr < (temp->version[i] + sizeof (temp->version[i]) - 1))
***************
*** 244,270 ****
/*
! * Get the version number, if any...
*/
!
! for (lineptr = line; isdigit ((int) *lineptr); lineptr++);
!
if (!*line || (!isspace ((int) *lineptr) && *lineptr))
! {
! /*
! * No version number specified, or the next number is a version
! * string...
! */
!
temp->vernumber[i] = get_vernumber (temp->version[i]);
- }
else
{
! /*
! * Grab the version number directly from the line...
! */
!
temp->vernumber[i] = atoi (line);
!
! for (line = lineptr; isspace ((int) *line); line++);
}
}
--- 239,256 ----
/*
! * Get the version number, if any.
*/
! for (lineptr = line; isdigit ((int) *lineptr); lineptr++)
! ;
if (!*line || (!isspace ((int) *lineptr) && *lineptr))
! /* No version number specified, or the next number is a version
! string. */
temp->vernumber[i] = get_vernumber (temp->version[i]);
else
{
! /* Grab the version number directly from the line. */
temp->vernumber[i] = atoi (line);
! for (line = lineptr; isspace ((int) *line); line++)
! ;
}
}
***************
*** 273,277 ****
* Handle assigning default values based on the number of version numbers...
*/
-
switch (i)
{
--- 259,262 ----
***************
*** 293,297 ****
file_t *file; /* New file */
-
if (dist->num_files == 0)
dist->files = (file_t *) malloc (sizeof (file_t));
--- 278,281 ----
***************
*** 337,351 ****
{
char *temp; /* Temporary pointer */
!
!
! /*
! * Get the system identification information...
! */
!
uname (platform);
! /*
! * Adjust the CPU type accordingly...
! */
#ifdef __sgi
--- 321,329 ----
{
char *temp; /* Temporary pointer */
!
! /* Get the system identification information. */
uname (platform);
! /* Adjust the CPU type accordingly. */
#ifdef __sgi
***************
*** 372,387 ****
#ifdef _AIX
! /*
! * AIX stores the major and minor version numbers separately;
! * combine them...
! */
sprintf (platform->release, "%d.%d", atoi (platform->version),
atoi (platform->release));
#else
! /*
! * Remove any extra junk from the release number - we just want the
! * major and minor numbers...
! */
while (!isdigit ((int) platform->release[0]) && platform->release[0])
--- 350,365 ----
#ifdef _AIX
! /*------------------------------------------------------------.
! | AIX stores the major and minor version numbers separately; |
! | combine them. |
! `------------------------------------------------------------*/
sprintf (platform->release, "%d.%d", atoi (platform->version),
atoi (platform->release));
#else
! /*------------------------------------------------------------------.
! | Remove any extra junk from the release number - we just want the |
! | major and minor numbers. |
! `------------------------------------------------------------------*/
while (!isdigit ((int) platform->release[0]) && platform->release[0])
***************
*** 399,406 ****
#endif /* _AIX */
! /*
! * Convert the operating system name to lowercase, and strip out
! * hyphens and underscores...
! */
for (temp = platform->sysname; *temp != '\0'; temp++)
--- 377,384 ----
#endif /* _AIX */
! /*----------------------------------------------------------------.
! | Convert the operating system name to lowercase, and strip out |
! | hyphens and underscores. |
! `----------------------------------------------------------------*/
for (temp = platform->sysname; *temp != '\0'; temp++)
***************
*** 413,420 ****
*temp = tolower (*temp);
! /*
! * SunOS 5.x is really Solaris 2.x, and OSF1 is really Digital UNIX a.k.a.
! * Compaq Tru64 UNIX...
! */
if (strcmp (platform->sysname, "sunos") == 0 && platform->release[0] >= '5')
--- 391,398 ----
*temp = tolower (*temp);
! /*-------------------------------------------------------------------------.
! | SunOS 5.x is really Solaris 2.x, and OSF1 is really Digital UNIX a.k.a. |
! | Compaq Tru64 UNIX. |
! `-------------------------------------------------------------------------*/
if (strcmp (platform->sysname, "sunos") == 0 && platform->release[0] >= '5')
***************
*** 439,443 ****
/* That's could very very to broke that function and to do an
! other one, because this one is very ugly, no modular.
-- Pascal. */
--- 417,421 ----
/* That's could very very to broke that function and to do an
! other one, because this one is very ugly, not modular.
-- Pascal. */
***************
*** 469,475 ****
--- 447,455 ----
/* Create a new, blank distribution. */
+ LOGVERBOSE (fprintf (stderr, "Alloc new distribution.\n"));
dist = (dist_t *) calloc (sizeof (dist_t), 1);
/* Open the main list file. */
+ LOGVERBOSE (fprintf (stderr, "Open file <%s>.\n", filename));
if ((listfiles[0] = fopen (filename, "r")) == NULL)
{
***************
*** 507,512 ****
if (strcmp (line, "%include") == 0)
{
! listlevel++;
!
if ((listfiles[listlevel] = fopen (temp, "r")) == NULL)
{
--- 487,492 ----
if (strcmp (line, "%include") == 0)
{
! LOGVERBOSE (fprintf (stderr, " Include file <%s>.\n", temp));
! listlevel++;
if ((listfiles[listlevel] = fopen (temp, "r")) == NULL)
{
***************
*** 544,547 ****
--- 524,529 ----
else if (strcmp (line, "%product") == 0)
{
+ LOGVERBOSE (fprintf (stderr, "Add product name <%s>.\n",
+ temp));
if (!dist->product[0])
strcpy (dist->product, temp);
***************
*** 552,555 ****
--- 534,539 ----
else if (strcmp (line, "%copyright") == 0)
{
+ LOGVERBOSE (fprintf (stderr, "Add copyright string <%s>.\n",
+ temp));
if (!dist->copyright[0])
strcpy (dist->copyright, temp);
***************
*** 560,563 ****
--- 544,549 ----
else if (strcmp (line, "%vendor") == 0)
{
+ LOGVERBOSE (fprintf (stderr, "Add vendor name <%s>.\n",
+ temp));
if (!dist->vendor[0])
strcpy (dist->vendor, temp);
***************
*** 568,571 ****
--- 554,559 ----
else if (strcmp (line, "%packager") == 0)
{
+ LOGVERBOSE (fprintf (stderr, "Add packager name <%s>.\n",
+ temp));
if (!dist->packager[0])
strcpy (dist->packager, temp);
***************
*** 576,579 ****
--- 564,569 ----
else if (strcmp (line, "%license") == 0)
{
+ LOGVERBOSE (fprintf (stderr, "Add license file path <%s>.\n",
+ temp));
if (!dist->license[0])
strcpy (dist->license, temp);
***************
*** 584,587 ****
--- 574,579 ----
else if (strcmp (line, "%readme") == 0)
{
+ LOGVERBOSE (fprintf (stderr, "Add readme file path <%s>.\n",
+ temp));
if (!dist->readme[0])
strcpy (dist->readme, temp);
***************
*** 594,597 ****
--- 586,591 ----
if (!dist->version[0])
{
+ LOGVERBOSE (fprintf (stderr, "Add version number <%s>.\n",
+ temp));
strcpy (dist->version, temp);
if ((temp = strchr (dist->version, ' ')) != NULL)
***************
*** 612,615 ****
--- 606,611 ----
else if (strcmp (line, "%release") == 0 && dist->relnumber == 0)
{
+ LOGVERBOSE (fprintf (stderr, "Add release number <%s>.\n",
+ temp));
dist->relnumber = atoi (temp);
dist->vernumber += dist->relnumber;
***************
*** 668,671 ****
--- 664,670 ----
else
{
+ LOGVERBOSE (fprintf (stderr, "Add file %c %o %s %s %s %s.\n",
+ type, mode, user, group, dst, src));
+
if (tolower (type) == 'd' || type == 'R')
src[0] = '\0';
***************
*** 794,809 ****
! /*
! * Sort the files...
! */
!
if (dist->num_files > 1)
qsort (dist->files, dist->num_files, sizeof (file_t),
(int (*)(const void *, const void *)) compare_files);
! /*
! * Remove duplicates...
! */
!
for (i = dist->num_files - 1, file = dist->files; i > 0; i--, file++)
if (strcmp (file[0].dst, file[1].dst) == 0)
--- 793,802 ----
! /* Sort the files. */
if (dist->num_files > 1)
qsort (dist->files, dist->num_files, sizeof (file_t),
(int (*)(const void *, const void *)) compare_files);
! /* Remove duplicates. */
for (i = dist->num_files - 1, file = dist->files; i > 0; i--, file++)
if (strcmp (file[0].dst, file[1].dst) == 0)
***************
*** 823,828 ****
char *string) /* I - String to add */
{
! char **temp, /* Temporary pointer to string array */
! buf[16384]; /* File import buffer */
--- 816,821 ----
char *string) /* I - String to add */
{
! char **temp; /* Temporary pointer to string array */
! char buf[16384]; /* File import buffer */
***************
*** 857,860 ****
--- 850,854 ----
temp += num_strings;
+ LOGVERBOSE (fprintf (stderr, "Add string <%s>.\n", string));
if ((*temp = strdup (string)) == NULL)
{
***************
*** 892,899 ****
if (*name == '$')
{
! /*
! * Insert a lone $...
! */
!
*buffer++ = *name++;
continue;
--- 886,890 ----
if (*name == '$')
{
! /* Insert a lone $. */
*buffer++ = *name++;
continue;
***************
*** 901,908 ****
else if (*name == '{')
{
! /*
! * Bracketed variable name...
! */
!
for (varptr = var, name++; *name != '}' && *name != '\0';)
*varptr++ = *name++;
--- 892,896 ----
else if (*name == '{')
{
! /* Bracketed variable name. */
for (varptr = var, name++; *name != '}' && *name != '\0';)
*varptr++ = *name++;
***************
*** 913,920 ****
else
{
! /*
! * Unbracketed variable name...
! */
!
for (varptr = var;
strchr ("/ \t-", *name) == NULL && *name != '\0';)
--- 901,905 ----
else
{
! /* Unbracketed variable name. */
for (varptr = var;
strchr ("/ \t-", *name) == NULL && *name != '\0';)
***************
*** 933,937 ****
*buffer++ = *name++;
}
-
*buffer = '\0';
}
--- 918,921 ----
***************
*** 945,949 ****
int i; /* Looping var */
-
for (i = 0; i < num_strings; i++)
free (strings[i]);
--- 929,932 ----
***************
*** 1403,1411 ****
const char *ptr; /* Pointer into string */
-
- /*
- * Loop through the version number string and construct a version number.
- */
memset (numbers, 0, sizeof (numbers));
--- 1386,1391 ----
const char *ptr; /* Pointer into string */
+ /* Loop through the version number string and construct a version number. */
memset (numbers, 0, sizeof (numbers));
***************
*** 1416,1423 ****
else
{
! /*
! * Add each mini version number (m.n.p) and patch/pre stuff...
! */
!
if (nnumbers < 4)
{
--- 1396,1400 ----
else
{
! /* Add each mini version number (m.n.p) and patch/pre stuff. */
if (nnumbers < 4)
{
***************
*** 1457,1464 ****
numbers[nnumbers] = temp;
! /*
! * Compute the version number as MMmmPPpp + offset
! */
!
return (((numbers[0] * 100 + numbers[1]) * 100 + numbers[2]) * 100 +
numbers[3] + offset);
--- 1434,1438 ----
numbers[nnumbers] = temp;
! /* Compute the version number as MMmmPPpp + offset */
return (((numbers[0] * 100 + numbers[1]) * 100 + numbers[2]) * 100 +
numbers[3] + offset);
***************
*** 1468,1472 ****
/* Pattern matching. */
! /* FIXME : Substitute this function to `fnmatch', which is standar on
GNU system, and it is presente in `deb' library. -- Pascal. */
--- 1442,1446 ----
/* Pattern matching. */
! /* FIXME : Substitute this function to `fnmatch', which is standard on
GNU system, and it is presente in `deb' library. -- Pascal. */
***************
*** 1475,1482 ****
const char *pat) /* I - Pattern to match against */
{
! /*
! * Range check the input...
! */
!
if (s == NULL || pat == NULL)
return (0);
--- 1449,1453 ----
const char *pat) /* I - Pattern to match against */
{
! /* Range check the input. */
if (s == NULL || pat == NULL)
return (0);
***************
*** 1491,1505 ****
if (*pat == '*')
{
! /*
! * Wildcard - 0 or more characters...
! */
!
pat++;
if (*pat == '\0')
! return (1); /* Last pattern char is *, so everything matches now... */
! /*
! * Test all remaining combinations until we get to the end of the string.
! */
while (*s != '\0')
--- 1462,1472 ----
if (*pat == '*')
{
! /* Wildcard - 0 or more characters. */
pat++;
if (*pat == '\0')
! return (1); /* Last pattern char is *, so everything matches now. */
! /* Test all remaining combinations until we get to the end of the
! string. */
while (*s != '\0')
***************
*** 1513,1520 ****
else if (*pat == '?')
{
! /*
! * Wildcard - 1 character...
! */
!
pat++;
s++;
--- 1480,1484 ----
else if (*pat == '?')
{
! /* Wildcard - 1 character. */
pat++;
s++;
***************
*** 1523,1530 ****
else if (*pat == '[')
{
! /*
! * Match a character from the input set [chars]...
! */
!
pat++;
while (*pat != ']' && *pat != '\0')
--- 1487,1491 ----
else if (*pat == '[')
{
! /* Match a character from the input set [chars]. */
pat++;
while (*pat != ']' && *pat != '\0')
***************
*** 1551,1565 ****
else if (*pat == '\\')
{
! /*
! * Handle quoted characters...
! */
!
pat++;
}
! /*
! * Stop if the pattern and string don't match...
! */
!
if (*pat++ != *s++)
return (0);
--- 1512,1520 ----
else if (*pat == '\\')
{
! /* Handle quoted characters. */
pat++;
}
! /* Stop if the pattern and string don't match. */
if (*pat++ != *s++)
return (0);
***************
*** 1570,1574 ****
* and 0 otherwise...
*/
-
return (*s == *pat);
}
--- 1525,1528 ----
|