]> git.lyx.org Git - lyx.git/blob - src/support/lyxlib.h
removed a warning from screen and added CFLAGS in lyx.spec.in.
[lyx.git] / src / support / lyxlib.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ======================================================
4  * 
5  *           LyX, The Document Processor
6  *        
7  *           Copyright (C) 1995 Matthias Ettrich
8  *           Copyright (C) 1995-1999 The LyX Team.
9  *
10  * ======================================================*/
11
12 #ifndef LYX_LIB_H
13 #define LYX_LIB_H
14
15 #include <ctime>
16 #include "LString.h"
17 #include "gettext.h"
18 #include "support/filetools.h"
19
20 /// generates an checksum
21 unsigned long lyxsum(char const * file);
22
23 /// returns a date string
24 inline char * date() 
25 {
26         time_t tid;
27         if ((tid=time(0)) == (time_t)-1)
28                 return (char*)0;
29         else
30                 return (ctime(&tid));
31 }
32
33
34 // Where can I put this?  I found the occurence of the same code
35 // three/four times. Don't you think it better to use a macro definition
36 // (an inlined member of some class)?
37 ///
38 inline string getUserName()
39 {
40         string userName(GetEnv("LOGNAME"));
41         if (userName.empty())
42                 userName = GetEnv("USER");
43         if (userName.empty())
44                 userName = _("unknown");
45         return userName;
46 }
47 #endif