cvs commit: ALFS/halfling/src help.c help.h lib.c lib.h tags.c tags.h Makefile.am main.c

highos at linuxfromscratch.org highos at linuxfromscratch.org
Thu May 9 13:52:34 PDT 2002


highos      02/05/09 13:52:34

  Modified:    halfling/src Makefile.am main.c
  Added:       halfling/src help.c help.h lib.c lib.h tags.c tags.h
  Log:
   o Moved the help related stuff into there own module.
   o Added the lib and tags modules.
   o The tag module should have one function per tag in the spec.
   o The lib module should provide additional functions for those tag functions.
  
  Revision  Changes    Path
  1.3       +1 -1      ALFS/halfling/src/Makefile.am
  
  Index: Makefile.am
  ===================================================================
  RCS file: /home/cvsroot/ALFS/halfling/src/Makefile.am,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Makefile.am	17 Apr 2002 19:03:43 -0000	1.2
  +++ Makefile.am	9 May 2002 20:52:34 -0000	1.3
  @@ -3,4 +3,4 @@
   bin_PROGRAMS = halfling
   halfling_CFLAGS = $(LIBXML2_CFLAGS)
   halfling_LDADD = $(LIBXML2_LIBS)
  -halfling_SOURCES = main.c
  +halfling_SOURCES = main.c help.c lib.c tags.c
  
  
  
  1.2       +11 -22    ALFS/halfling/src/main.c
  
  Index: main.c
  ===================================================================
  RCS file: /home/cvsroot/ALFS/halfling/src/main.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- main.c	17 Apr 2002 19:03:43 -0000	1.1
  +++ main.c	9 May 2002 20:52:34 -0000	1.2
  @@ -37,6 +37,8 @@
   #include <getopt.h>
   #include <libxml/tree.h>
   #include <libxml/parser.h>
  +#include "help.h"
  +#include "tags.h"
   
   
   static struct option long_options[] = {
  @@ -46,27 +48,6 @@
   };
   
   
  -void print_usage(void) {
  -    printf("Usage: halfling [options] profile...\n");
  -}
  -
  -
  -void print_help(void) {
  -    print_usage();
  -    printf("\
  -Options:\n\
  -  -h,  --help       display this help and exit.\n\
  -  -v,  --version    print the version information and exit.\
  -\n");
  -}
  -
  -
  -void print_version(void) {
  -    printf("halfling version CVS, by Jesse Tie-Ten-Quee.\n");
  -
  -}
  -
  -
   int parse_profile(const char *filename) {
       xmlDoc *doc = NULL;
       xmlNode *cur = NULL;
  @@ -86,7 +67,15 @@
   	return (-1);
       }
   
  -    printf("So far so good.\n");
  +    cur = cur->xmlChildrenNode;
  +
  +    while (cur != NULL) {
  +	if (!strcmp(cur->name, "package")) {
  +	    tag_package(doc, cur);
  +	}
  +
  +	cur = cur->next;
  +    }
   
       xmlFreeDoc(doc);
   
  
  
  
  1.1                  ALFS/halfling/src/help.c
  
  Index: help.c
  ===================================================================
  /* Copyright (c) 2001, 2002, Jesse Tie-Ten-Quee
   * All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   *    o Redistributions of source code must retain the above copyright
   *      notice, this list of conditions and the following disclaimer.
   *
   *    o Redistributions in binary form must reproduce the above copyright
   *      notice, this list of conditions and the following disclaimer in
   *      the documentation and/or other materials provided with the
   *      distribution.
   *
   *    o Neither the name of "Automated Linux From Scratch" nor the names
   *      of its contributors may be used to endorse or promote products
   *      derived from this software without specific prior written
   *      permission.
   *
   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
   * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
   * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
   * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
   * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
   * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   * POSSIBILITY OF SUCH DAMAGE.
   */
  
  
  #include <stdio.h>
  
  void print_usage(void) {
      printf("Usage: halfling [options] profile...\n");
  }
  
  
  void print_help(void) {
      print_usage();
      printf("\
  Options:\n\
    -h,  --help       display this help and exit.\n\
    -v,  --version    print the version information and exit.\
  \n");
  }
  
  
  void print_version(void) {
      printf("halfling version CVS, by Jesse Tie-Ten-Quee.\n");
  }
  
  
  
  1.1                  ALFS/halfling/src/help.h
  
  Index: help.h
  ===================================================================
  /* Copyright (c) 2001, 2002, Jesse Tie-Ten-Quee
   * All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   *    o Redistributions of source code must retain the above copyright
   *      notice, this list of conditions and the following disclaimer.
   *
   *    o Redistributions in binary form must reproduce the above copyright
   *      notice, this list of conditions and the following disclaimer in
   *      the documentation and/or other materials provided with the
   *      distribution.
   *
   *    o Neither the name of "Automated Linux From Scratch" nor the names
   *      of its contributors may be used to endorse or promote products
   *      derived from this software without specific prior written
   *      permission.
   *
   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
   * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
   * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
   * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
   * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
   * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   * POSSIBILITY OF SUCH DAMAGE.
   */
  
  
  #ifndef _HELP_H_
  #define _HELP_H_
  
  void print_usage(void);
  void print_help(void);
  void print_version(void);
  
  #endif /* _HELP_H_ */
  
  
  
  1.1                  ALFS/halfling/src/lib.c
  
  Index: lib.c
  ===================================================================
  /* Copyright (c) 2001, 2002, Jesse Tie-Ten-Quee
   * All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   *    o Redistributions of source code must retain the above copyright
   *      notice, this list of conditions and the following disclaimer.
   *
   *    o Redistributions in binary form must reproduce the above copyright
   *      notice, this list of conditions and the following disclaimer in
   *      the documentation and/or other materials provided with the
   *      distribution.
   *
   *    o Neither the name of "Automated Linux From Scratch" nor the names
   *      of its contributors may be used to endorse or promote products
   *      derived from this software without specific prior written
   *      permission.
   *
   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
   * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
   * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
   * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
   * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
   * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   * POSSIBILITY OF SUCH DAMAGE.
   */
  
  
  #include <stdio.h>
  #include <stdarg.h>
  
  void log (const char *format, ...) {
      va_list ap;
      char msg[256];
  
      va_start(ap, format);
      vsnprintf(msg, sizeof msg, format, ap);
      va_end(ap);
  
      printf("%s", msg);
  }
  
  
  
  1.1                  ALFS/halfling/src/lib.h
  
  Index: lib.h
  ===================================================================
  /* Copyright (c) 2001, 2002, Jesse Tie-Ten-Quee
   * All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   *    o Redistributions of source code must retain the above copyright
   *      notice, this list of conditions and the following disclaimer.
   *
   *    o Redistributions in binary form must reproduce the above copyright
   *      notice, this list of conditions and the following disclaimer in
   *      the documentation and/or other materials provided with the
   *      distribution.
   *
   *    o Neither the name of "Automated Linux From Scratch" nor the names
   *      of its contributors may be used to endorse or promote products
   *      derived from this software without specific prior written
   *      permission.
   *
   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
   * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
   * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
   * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
   * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
   * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   * POSSIBILITY OF SUCH DAMAGE.
   */
  
  
  #ifndef _LIB_H_
  #define _LIB_H_
  
  void log(const char *format, ...);
  
  #endif /* _LIB_H_ */
  
  
  
  1.1                  ALFS/halfling/src/tags.c
  
  Index: tags.c
  ===================================================================
  /* Copyright (c) 2001, 2002, Jesse Tie-Ten-Quee
   * All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   *    o Redistributions of source code must retain the above copyright
   *      notice, this list of conditions and the following disclaimer.
   *
   *    o Redistributions in binary form must reproduce the above copyright
   *      notice, this list of conditions and the following disclaimer in
   *      the documentation and/or other materials provided with the
   *      distribution.
   *
   *    o Neither the name of "Automated Linux From Scratch" nor the names
   *      of its contributors may be used to endorse or promote products
   *      derived from this software without specific prior written
   *      permission.
   *
   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
   * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
   * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
   * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
   * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
   * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   * POSSIBILITY OF SUCH DAMAGE.
   */
  
  
  #include <stdio.h>
  #include <libxml/tree.h>
  #include "lib.h"
  
  void tag_package(xmlDoc *doc, xmlNode *cur) {
  
      cur = cur->xmlChildrenNode;
  
      while (cur != NULL) {
  	if (!strcmp(cur->name, "info")) {
  	    /* missing */
  	}
  
  	cur = cur->next;
      }
  
  }
  
  
  
  1.1                  ALFS/halfling/src/tags.h
  
  Index: tags.h
  ===================================================================
  /* Copyright (c) 2001, 2002, Jesse Tie-Ten-Quee
   * All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   *    o Redistributions of source code must retain the above copyright
   *      notice, this list of conditions and the following disclaimer.
   *
   *    o Redistributions in binary form must reproduce the above copyright
   *      notice, this list of conditions and the following disclaimer in
   *      the documentation and/or other materials provided with the
   *      distribution.
   *
   *    o Neither the name of "Automated Linux From Scratch" nor the names
   *      of its contributors may be used to endorse or promote products
   *      derived from this software without specific prior written
   *      permission.
   *
   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
   * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
   * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
   * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
   * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
   * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   * POSSIBILITY OF SUCH DAMAGE.
   */
  
  
  #ifndef _TAGS_H_
  #define _TAGS_H_
  
  void tag_package(xmlDoc *doc, xmlNode *cur);
  
  #endif /* _TAGS_H_ */
  
  
  
-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe alfs-discuss' in the subject header of the message



More information about the alfs-discuss mailing list