/[gxemul]/trunk/src/misc.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/src/misc.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 6 by dpavlin, Mon Oct 8 16:18:11 2007 UTC revision 42 by dpavlin, Mon Oct 8 16:22:32 2007 UTC
# Line 1  Line 1 
1  /*  /*
2   *  Copyright (C) 2005  Anders Gavare.  All rights reserved.   *  Copyright (C) 2005-2007  Anders Gavare.  All rights reserved.
3   *   *
4   *  Redistribution and use in source and binary forms, with or without   *  Redistribution and use in source and binary forms, with or without
5   *  modification, are permitted provided that the following conditions are met:   *  modification, are permitted provided that the following conditions are met:
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *   *
27   *   *
28   *  $Id: misc.c,v 1.2 2005/05/07 02:13:29 debug Exp $   *  $Id: misc.c,v 1.9 2007/06/15 17:02:38 debug Exp $
29     *
30     *  This file contains things that don't fit anywhere else, and fake/dummy
31     *  implementations of libc functions that are missing on some systems.
32   */   */
33    
34  #include <stdio.h>  #include <stdio.h>
35  #include <stdlib.h>  #include <stdlib.h>
36    #include <string.h>
37  #include <fcntl.h>  #include <fcntl.h>
38    
39    #include "cpu.h"
40  #include "misc.h"  #include "misc.h"
41    
42    
# Line 123  int mymkstemp(char *template) Line 128  int mymkstemp(char *template)
128          return h;          return h;
129  }  }
130    
131    
132    #ifdef USE_STRLCPY_REPLACEMENTS
133    /*
134     *  mystrlcpy():
135     *
136     *  Quick hack strlcpy() replacement for systems that lack that function.
137     *  NOTE: No length checking is done.
138     */
139    size_t mystrlcpy(char *dst, const char *src, size_t size)
140    {
141            strcpy(dst, src);
142            return strlen(src);
143    }
144    
145    
146    /*
147     *  mystrlcat():
148     *
149     *  Quick hack strlcat() replacement for systems that lack that function.
150     *  NOTE: No length checking is done.
151     */
152    size_t mystrlcat(char *dst, const char *src, size_t size)
153    {
154            size_t orig_dst_len = strlen(dst);
155            strcat(dst, src);
156            return strlen(src) + orig_dst_len;
157    }
158    #endif
159    
160    
161    /*
162     *  print_separator_line():
163     *
164     *  Prints a line of "----------".
165     */
166    void print_separator_line(void)
167    {
168            int i = 79;
169            while (i-- > 0)
170                    debug("-");
171            debug("\n");
172    }
173    

Legend:
Removed from v.6  
changed lines
  Added in v.42

  ViewVC Help
Powered by ViewVC 1.1.26