|
|
1.1 ! root 1: #include <String.h> ! 2: #include <list.h> ! 3: ! 4: extern "C" { ! 5: extern char *getenv(char *); ! 6: extern int mkdir (char*, int); ! 7: extern int rmdir (char*); ! 8: int sleep (int); ! 9: extern int getlogname (char*); ! 10: } ! 11: ! 12: int mkdir (const String&, int); ! 13: int rmdir (const String&); ! 14: ! 15: ! 16: // decl.c ! 17: ! 18: listdeclare (String) ! 19: ! 20: struct mel { ! 21: friend class map; ! 22: String p; ! 23: String_list q; ! 24: String s; ! 25: mel () {} ! 26: mel (mel& x): p (x.p), q (x.q), s (x.s) {} ! 27: mel& operator= (mel& x) { p = x.p; q = x.q; s = x.s; return *this; } ! 28: bit operator== (mel& x) { return p == x.p && q == x.q && s == x.s; } ! 29: ostream& print (ostream&); ! 30: }; ! 31: ! 32: listdeclare (mel) ! 33: ! 34: struct map { ! 35: mel_list l; ! 36: map () {} ! 37: map (map& x): l (x.l) {} ! 38: map& operator= (map& x) { l = x.l; return *this; } ! 39: ostream& print (ostream&); ! 40: istream& read (istream&); ! 41: }; ! 42: ! 43: inline ostream& operator<< (ostream& o, map& m) { return m.print (o); } ! 44: inline istream& operator>> (istream& i, map& m) { return m.read (i); } ! 45: ! 46: String logname(); ! 47: ! 48: class charstr { ! 49: char* p; ! 50: public: ! 51: charstr (String s) { ! 52: p = new char[s.length() + 1]; ! 53: s.dump (p); ! 54: } ! 55: // !charstr(charstr&); ! 56: // !operator=(charstr); ! 57: ~charstr() { delete p; } ! 58: operator char*() { return p; }; ! 59: }; ! 60: ! 61: // path.c ! 62: ! 63: String pathnorm (String); ! 64: ! 65: class Path { ! 66: String s; ! 67: friend Path mkpath(String); ! 68: public: ! 69: Path() {} ! 70: Path(Path& p): s (p.s) {} ! 71: Path(String& st): s (pathnorm (st)) {} ! 72: Path(const char *cp): s (pathnorm (String (cp))) {} ! 73: Path& operator = (Path& p) { s = p.s; return *this; } ! 74: Path operator + (Path& p) { return s + p.s; } ! 75: Path operator + (char *cp) { return s + pathnorm (cp); } ! 76: friend Path operator + (char *p, Path q) ! 77: { return Path (p) + q; } ! 78: Path& operator += (Path& p) { s += Path(p.s); return *this; } ! 79: Path operator & (Path&); ! 80: Path operator & (String& s) { return *this & Path(s); } ! 81: Path operator & (const char *cp) { return *this & Path (cp); } ! 82: friend Path operator & (const char *p, Path q) ! 83: { return Path (p) & q; } ! 84: friend Path operator & (const char *p, String q) ! 85: { return Path (p) & Path(q); } ! 86: friend Path operator & (String& p, char* q) ! 87: { return Path(p) & q; } ! 88: Path& operator &= (Path& p) { *this = *this & p; return *this; } ! 89: operator String () { return s; } ! 90: Path first(); ! 91: Path last(); ! 92: Path rmfirst(); ! 93: Path rmlast(); ! 94: friend ostream& operator <<(ostream&, Path); ! 95: int operator < (Path& t) { return s < t.s; } ! 96: int operator > (Path& t) { return s > t.s; } ! 97: int operator <= (Path& t) { return s <= t.s; } ! 98: int operator >= (Path& t) { return s >= t.s; } ! 99: int operator == (Path& t) { return s == t.s; } ! 100: int operator != (Path& t) { return s != t.s; } ! 101: int operator < (char* t) { return s < t; } ! 102: int operator > (char* t) { return s > t; } ! 103: int operator <= (char* t) { return s <= t; } ! 104: int operator >= (char* t) { return s >= t; } ! 105: int operator == (char* t) { return s == t; } ! 106: int operator != (char* t) { return s != t; } ! 107: friend int operator < (char* p, Path q) { return p < q.s; } ! 108: friend int operator > (char* p, Path q) { return p > q.s; } ! 109: friend int operator <= (char* p, Path q) { return p <= q.s; } ! 110: friend int operator >= (char* p, Path q) { return p >= q.s; } ! 111: friend int operator == (char* p, Path q) { return p == q.s; } ! 112: friend int operator != (char* p, Path q) { return p != q.s; } ! 113: }; ! 114: ! 115: Path homedir(); ! 116: ! 117: listdeclare(Path) ! 118: ! 119: // lock.c ! 120: ! 121: void lock (Path&); ! 122: void unlock (Path&); ! 123: ! 124: // dir.c ! 125: ! 126: int isdir (Path&); ! 127: Path_list dircontents (Path&); ! 128: ! 129: // domach.c ! 130: ! 131: String domach (String, Path, String_list&); ! 132: ! 133: // checksum.c ! 134: ! 135: static const cksize = 37; ! 136: ! 137: class checksum { ! 138: char buf[cksize]; ! 139: char *bufptr; ! 140: char *bufend; ! 141: public: ! 142: checksum(); ! 143: void combine (char*, int); ! 144: int operator== (checksum&); ! 145: int operator!= (checksum& c) { return !(*this == c); } ! 146: friend int read (int fd, checksum& c) ! 147: { return ::read (fd, c.buf, cksize); } ! 148: friend int write (int fd, checksum& c) ! 149: { return ::write (fd, c.buf, cksize); } ! 150: }; ! 151: ! 152: // param.c ! 153: ! 154: extern char* spooldir; ! 155: extern char* etcdir; ! 156: extern char* inspkg; ! 157: extern char* tmpdir;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.