home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume31 / mbox / part05 < prev    next >
Encoding:
Text File  |  1992-07-09  |  60.6 KB  |  2,710 lines

  1. Newsgroups: comp.sources.misc
  2. From: Volker.Schuermann@unnet.w.open.de@unnet (Volker Schuermann)
  3. Subject:  v31i021:  mbox - A BBS for UNIX and MINIX v1.6 PL10, Part05/11
  4. Message-ID: <1992Jul10.050313.27492@sparky.imd.sterling.com>
  5. X-Md4-Signature: 2133737ce41d82abfa37ecdf8179bb78
  6. Date: Fri, 10 Jul 1992 05:03:13 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: Volker.Schuermann@unnet.w.open.de@unnet (Volker Schuermann)
  10. Posting-number: Volume 31, Issue 21
  11. Archive-name: mbox/part05
  12. Environment: MINIX, ISC, ESIX, SVR3
  13. Supersedes: mbox: Volume 29, Issue 63-72
  14.  
  15. #! /bin/sh
  16. # This is a shell archive.  Remove anything before this line, then feed it
  17. # into a shell via "sh file" or similar.  To overwrite existing files,
  18. # type "sh file -c".
  19. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  20. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  21. # Contents:  src/loop.c src/misc.c src/portinfo.c
  22. # Wrapped by kent@sparky on Thu Jul  9 23:26:01 1992
  23. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  24. echo If this archive is complete, you will see the following message:
  25. echo '          "shar: End of archive 5 (of 11)."'
  26. if test -f 'src/loop.c' -a "${1}" != "-c" ; then 
  27.   echo shar: Will not clobber existing file \"'src/loop.c'\"
  28. else
  29.   echo shar: Extracting \"'src/loop.c'\" \(20414 characters\)
  30.   sed "s/^X//" >'src/loop.c' <<'END_OF_FILE'
  31. X/***************************************************************************/
  32. X/*        PROGRAMM  ix/Mbox                           */
  33. X/*             DATEI  loop.c                           */
  34. X/*        FUNKTIONEN  sigcatch(), cut_bef(), cut_arg(), rates(), loop()       */
  35. X/*             AUTOR  vs (Volker Schuermann/MINIX-Version)           */
  36. X/*  LETZTE AENDERUNG  06.06.1992                       */
  37. X/***************************************************************************/
  38. X   
  39. X#include <stdio.h>
  40. X#include <sys/types.h>
  41. X#include <sys/wait.h>
  42. X#include <time.h>
  43. X#include <setjmp.h>
  44. X#include <signal.h>
  45. X#include <sys/stat.h>
  46. X
  47. X#include "mbox.h"
  48. X
  49. X
  50. X
  51. Xextern time_t time_start, time_now;
  52. X
  53. Xjmp_buf jmpenv;
  54. X
  55. X
  56. X
  57. X/***************************************************************************/
  58. X/*      FUNKTION  sigcatch()                           */
  59. X/*  BESCHREIBUNG  Wird aufgerufen, wenn eines der abgefangen Signale       */
  60. X/*          eintrifft. Je nach Signal wird entweder ein CTRL-X       */
  61. X/*          simuliert, oder das Programm ordnungsgemaesst beendet.   */
  62. X/*     PARAMETER  sig  =  Nummer des ausloesenden Signals                  */
  63. X/*     RUECKGABE  keine                                                    */
  64. X/***************************************************************************/
  65. X
  66. Xvoid sigcatch(sig)
  67. Xint sig;
  68. X{
  69. X  char tmp[80];  
  70. X
  71. X  signal(SIGINT,   SIG_IGN);
  72. X  signal(SIGQUIT,  SIG_IGN);
  73. X  signal(SIGHUP,   SIG_IGN);
  74. X  signal(SIGABRT,  SIG_IGN);
  75. X  signal(SIGTERM,  SIG_IGN);
  76. X
  77. X  chdir( HOME );
  78. X  switch (sig) {
  79. X    case SIGINT:
  80. X    case SIGQUIT:
  81. X        sprintf(tmp, "%s/I.%d", TMP, getpid());
  82. X        unlink(tmp);
  83. X        sprintf(tmp, "%s/show%d", TMP, getpid());
  84. X        unlink(tmp);
  85. X        mbunlock( UDBASE );
  86. X        printf("\n");
  87. X        ansi("mr");
  88. X        printf("%s", LOP01_MSG);
  89. X        ansi("me");
  90. X        printf("\n\n");
  91. X        longjmp(jmpenv, 1);
  92. X        break;
  93. X      case SIGHUP:
  94. X      case SIGABRT:
  95. X      case SIGTERM:
  96. X        printf("\n\n");
  97. X        ansi("mr");
  98. X        printf("%s", LOP02_MSG);
  99. X        ansi("me");
  100. X        printf("");
  101. X        logout();
  102. X        exit(-1);
  103. X        break;
  104. X  }
  105. X}
  106. X
  107. X
  108. X
  109. X
  110. X/***************************************************************************/
  111. X/*      FUNKTION  cut_bef()                           */
  112. X/*  BESCHREIBUNG  Filtert den Befehl aus der Eingabe eines Users.          */
  113. X/*     PARAMETER  Eingabezeile                                             */
  114. X/*     RUECKGABE  Der isolierte Befehl                                     */
  115. X/***************************************************************************/
  116. X
  117. Xchar *cut_bef(s)
  118. Xchar s[];
  119. X{
  120. X  static char bef[STRING];
  121. X  int i = 0;
  122. X
  123. X  while (s[i] > 32) {
  124. X    bef[i] = s[i];
  125. X    i++;
  126. X  }
  127. X  bef[i] = '\0';
  128. X  return (char *) bef;
  129. X}
  130. X
  131. X
  132. X
  133. X/***************************************************************************/
  134. X/*      FUNKTION  cut_arg()                           */
  135. X/*  BESCHREIBUNG  Filtert das Argument aus der Eingabe des Users.          */
  136. X/*     PARAMETER  Eingabezeile                                                */
  137. X/*     RUECKGABE  Das isolierte Argument                                   */
  138. X/***************************************************************************/
  139. X
  140. Xchar *cut_arg(s)
  141. Xchar s[];
  142. X{
  143. X  static char arg[STRING];
  144. X  int i = 0, a = 0;
  145. X
  146. X  while (s[i] > 32) i++;
  147. X  if (s[i] == '\0') return (char *) "";
  148. X
  149. X  while (s[i] == 32) i++;
  150. X
  151. X  while (s[i] != '\0') {
  152. X    arg[a] = s[i];
  153. X    i++;
  154. X    a++;
  155. X  }
  156. X  arg[a] = '\0';
  157. X
  158. X  while((arg[(a-1)] < 33) && (a > 1)){
  159. X    a--;
  160. X    arg[a] = '\0';
  161. X  }
  162. X
  163. X  return (char *) arg;
  164. X}
  165. X
  166. X
  167. X
  168. X
  169. X/***************************************************************************/
  170. X/*      FUNKTION  rates()                           */
  171. X/*  BESCHREIBUNG  Ermittelt die Telefongebuehren des laufenden Anrufs und  */
  172. X/*          bereitet sie als PROMPT auf.                             */
  173. X/*     PARAMETER  keine                                                       */
  174. X/*     RUECKGABE  PROMPT-Zeile fuer Gebuehren                              */
  175. X/***************************************************************************/
  176. X
  177. Xchar *rates()
  178. X{
  179. X  static char s[STRING];
  180. X  char t[STRING];
  181. X  int nz, rz, wz;
  182. X  int dif;
  183. X  int n1, n2, r1, r2, w1, w2;
  184. X  struct tm *timeptr;
  185. X
  186. X  time(&time_now);
  187. X  dif = time_now - time_start;
  188. X
  189. X  n1 = dif / NZNT;
  190. X  n1++;
  191. X  n1 *= TARIF;
  192. X  n2 = dif / NZBT;
  193. X  n2++;
  194. X  n2 *= TARIF;
  195. X  r1 = dif / RZNT;
  196. X  r1++;
  197. X  r1 *= TARIF;
  198. X  r2 = dif / RZBT;
  199. X  r2++;
  200. X  r2 *= TARIF;
  201. X  w1 = dif / WZNT;
  202. X  w1++;
  203. X  w1 *= TARIF;
  204. X  w2 = dif / WZBT;
  205. X  w2++;
  206. X  w2 *= TARIF;
  207. X
  208. X  timeptr = localtime(&time_now);
  209. X  sprintf(t, "%s", asctime(timeptr));
  210. X
  211. X  if ((t[0] == 'S') || (timeptr->tm_hour > 18) || (timeptr->tm_hour < 8)) {
  212. X    sprintf(s, "(%ds) NZ %d.%02.2d, RZ %d.%02.2d, WZ %d.%02.2d",
  213. X     dif, fix(n2), flt(n2), fix(r2), flt(r2), fix(w2), flt(w2));
  214. X  }
  215. X  else {
  216. X    sprintf(s, "(%ds) NZ %d.%02.2d, RZ %d.%02.2d, WZ %d.%02.2d",
  217. X     dif, fix(n1), flt(n1), fix(r1), flt(r1), fix(w1), flt(w1));
  218. X  }
  219. X
  220. X  return (char *) s;
  221. X}
  222. X
  223. X
  224. X
  225. X
  226. X/***************************************************************************/
  227. X/*      FUNKTION  loop.c                           */
  228. X/*  BESCHREIBUNG  Die Eingaben des Users werden entgegengenommen und die   */
  229. X/*          entsprechenden Routinen aufgerufen und ausgefuehrt.      */
  230. X/*     PARAMETER  keine                                                       */
  231. X/*     RUECKGABE  keine                                                    */
  232. X/***************************************************************************/
  233. X
  234. Xvoid loop()
  235. X{
  236. X  char s[STRING];
  237. X  char t[STRING];
  238. X  char l[LONGSTRING];
  239. X  char befehl[STRING];
  240. X  char argument[STRING];
  241. X  char prompt[STRING];
  242. X
  243. X  char prev_befehl[10][STRING];
  244. X  int wasok;
  245. X
  246. X  char c;
  247. X
  248. X  char bef_buff[(STRING * 2)];
  249. X  int bef_rec;
  250. X
  251. X  int ende = 0, ok, dummy, i;
  252. X  int pp;
  253. X  int to_del;
  254. X  int fpid;
  255. X
  256. X  struct stat fst;
  257. X
  258. X
  259. X  sprintf(prev_befehl[1], "%s ", BEF[BB1].befehl);
  260. X  sprintf(prev_befehl[2], "%s ", BEF[BB2].befehl); 
  261. X  sprintf(prev_befehl[3], "%s ", BEF[BB3].befehl);
  262. X  sprintf(prev_befehl[4], "%s ", BEF[BB4].befehl);
  263. X  sprintf(prev_befehl[5], "%s ", BEF[BB5].befehl);
  264. X  sprintf(prev_befehl[6], "%s ", BEF[BB6].befehl);
  265. X  sprintf(prev_befehl[7], "%s ", BEF[BB7].befehl);
  266. X  sprintf(prev_befehl[8], "%s ", BEF[BB8].befehl);
  267. X  sprintf(prev_befehl[9], "%s ", BEF[BB9].befehl);
  268. X
  269. X  wasok = 1;
  270. X
  271. X  bef_buff[0] = '\0';
  272. X
  273. X  do {
  274. X
  275. X    if(setjmp(jmpenv) == 1){
  276. X        bef_buff[0] = '\0';
  277. X    }
  278. X
  279. X    FASTER:
  280. X    
  281. X    signal(SIGINT,  sigcatch);
  282. X    signal(SIGQUIT, sigcatch);
  283. X
  284. X    signal(SIGHUP,  sigcatch);
  285. X    signal(SIGABRT, sigcatch);
  286. X    signal(SIGTERM, sigcatch);
  287. X
  288. X
  289. X    sprintf(s, "%s/usr/%d/INDEX", HOME, USER.id);
  290. X    stat(s, &fst);
  291. X    if(fst.st_size > IDX_SIZE){
  292. X        printf("%c\n\n%s\n", BELL, LOP03_MSG); 
  293. X    }
  294. X        IDX_SIZE = (long) fst.st_size;
  295. X
  296. X    if(bef_buff[0] != '\0'){
  297. X        sprintf(s, "%s", bef_buff);        
  298. X        IS_BUFFERED = 1;
  299. X        bef_rec++;
  300. X        goto BUFFERING;
  301. X    }
  302. X        else 
  303. X        IS_BUFFERED = 0;
  304. X
  305. X
  306. X    bef_rec = 0;
  307. X
  308. X    ansi("md");
  309. X    prompt[0] = '\0';
  310. X
  311. X    switch (USER.prompt) {
  312. X        case 1:
  313. X            strcat(prompt, (char *) mytime(0));
  314. X            break;
  315. X        case 2:    
  316. X            strcat(prompt, NG);
  317. X            break;
  318. X        case 3:    
  319. X            strcat(prompt, (char *) rates());
  320. X            break;
  321. X    }
  322. X    printf("\n[%s] %s > ", prompt, LOP06_MSG);
  323. X    ansi("me");
  324. X    if (USER.bell == 1) printf("%c", BELL);
  325. X
  326. X    befehl[0] = '\0';
  327. X
  328. X#ifdef _CORELEFT
  329. X    if(coreleft() < _CORELEFT){
  330. X        sprintf(s, "%d", _CORELEFT);
  331. X        nerror( "loop.c", 288, "loop", "Speicherplatz kleiner ", s );
  332. X    }
  333. X#endif
  334. X
  335. X
  336. X    do {
  337. X        strcpy(s, (char *) getline(60, 11001, 32, befehl));
  338. X        to_del = length(befehl);
  339. X
  340. X        if (s[0] == 48) {
  341. X            headline( LOP05_MSG );
  342. X            printf("\n");
  343. X            for (i = 9; i > 0; i--) {
  344. X                printf(" %d: %s\n", i, prev_befehl[i]);
  345. X            }
  346. X            goto FASTER;
  347. X        }
  348. X        if ((s[0] > 48) && (s[0] < 58)) {
  349. X            sprintf(befehl, "%s", prev_befehl[(s[0] - 48)]);
  350. X            printf("%c", CR);
  351. X            if (ansi("ce") == 1) {
  352. X                printf("                                                               ");
  353. X            }
  354. X            ansi("md");
  355. X            printf("%c[%s] %s > ", CR, prompt, LOP06_MSG);
  356. X            ansi("me");
  357. X        }
  358. X    } while ((s[0] > 47) && (s[0] < 58));
  359. X
  360. X    
  361. X        if(makro_definition(s) != 0) goto FASTER;
  362. X
  363. X
  364. X    BUFFERING:
  365. X
  366. X    if((bef_rec > MAKRO_MAX_REK) && (USER.level < (ADMIN_LEV+1))){
  367. X        bef_buff[0] = '\0';
  368. X        goto FASTER;
  369. X    }
  370. X
  371. X        
  372. X    strcpy(t, (char *) makro(s));
  373. X    strcpy(s, t); 
  374. X        
  375. X    while ((s[0] == 32) || (s[0] == '.')) {
  376. X        sprintf(befehl, "%s", (char *) strcopy(s, 1, length(s)));
  377. X        sprintf(s, "%s", befehl);
  378. X    }
  379. X
  380. X    i = 0; ok = 0;
  381. X    while((ok == 0) && (s[i] != '\0')){
  382. X        if(s[i] == ','){ 
  383. X            strcpy(bef_buff, (char *) strcopy(s, (i+1), length(s)));
  384. X            s[i] = '\0';
  385. X            ok++;
  386. X        }            
  387. X        i++;
  388. X    }
  389. X    if(ok == 0) bef_buff[0] = '\0';
  390. X    
  391. X    strcpy(befehl, (char *) cut_bef(s));
  392. X    strcpy(argument, (char *) cut_arg(s));
  393. X    strcpy(s, (char *) upcased(befehl));
  394. X    strcpy(befehl, s);
  395. X
  396. X    sprintf(s, "%s %s", befehl, argument);
  397. X
  398. X    if (wasok == 1) {
  399. X        ok = 0;
  400. X        for (i = 9; i > 0; i--) {
  401. X            if ((strcomp(s, prev_befehl[i]) == 0) && (strcomp(prev_befehl[i], s) == 0))
  402. X                ok++;
  403. X        }
  404. X        if ((ok == 0) && (befehl[0] > 32)) {
  405. X            for (i = 9; i > 1; i--) {
  406. X                sprintf(prev_befehl[i], "%s", prev_befehl[(i - 1)]);
  407. X            }
  408. X            sprintf(prev_befehl[1], "%s %s", befehl, argument);
  409. X        }
  410. X    }
  411. X    else {
  412. X        sprintf(prev_befehl[1], "%s %s", befehl, argument);
  413. X    }
  414. X
  415. X    sprintf(s, "[%s] %s %s", LOP04_MSG, befehl, argument);
  416. X    control(s, 3);
  417. X
  418. X    sprintf(s, "%s %s", befehl, argument);
  419. X    whodo(s);
  420. X
  421. X
  422. X    wasok = 0;
  423. X
  424. X    if (befehl[0] == '"') {
  425. X        ansi("md");
  426. X        /*
  427. X        printf(" <- Nein, so daemlich kann kein User sein !\n");
  428. X        */
  429. X        printf(" %s\n", LOP07_MSG);
  430. X        ansi("me");
  431. X        goto FASTER;
  432. X    }
  433. X    if (befehl[0] == '\0') goto FASTER;
  434. X
  435. X
  436. X    if(argument[0] == '?') {
  437. X        strcpy(argument, befehl);
  438. X        strcpy(befehl, BEF[BB7].befehl);
  439. X     }
  440. X
  441. X/*  ?  */
  442. X
  443. X    if (befehl[0] == '?') {
  444. X        if (argument[0] != '*') {
  445. X            sprintf(s, " %s %d) ", LOP08_MSG, USER.level);
  446. X        } else {
  447. X            sprintf(s, " %s ", LOP09_MSG, USER.level);
  448. X        }
  449. X        headline(s);
  450. X        printf("\n");
  451. X        bef("?", argument);
  452. X        goto FASTER;
  453. X    }
  454. X
  455. X/* <BREAK> */
  456. X
  457. X    if (strcomp(befehl, "<BREAK>") == 0) {
  458. X        printf("!@#?");
  459. X        ansi("md");
  460. X        printf(" %s", LOP10_MSG);
  461. X        ansi("me");
  462. X        printf("\n");
  463. X        goto FASTER;
  464. X    }
  465. X    wasok = 1;
  466. X
  467. X
  468. X    switch (bef(befehl, argument)) {
  469. X
  470. X        case 275:        /* RELOGIN */
  471. X
  472. X        logout();
  473. X        intro();
  474. X        break;
  475. X
  476. X
  477. X        case 240:        /* MINIX */
  478. X
  479. X        if (argument[0] == '\0') {
  480. X            ansi("md");
  481. X            printf(" %s\n", LOP11_MSG);
  482. X            ansi("me");
  483. X        }
  484. X        else {
  485. X            printf("\n\n");
  486. X            sprintf(s, "exec %s %s %d %d", RSH, argument, OLDUID, OLDGID);
  487. X            system(s);
  488. X        }
  489. X        break;
  490. X
  491. X
  492. X        case 110:
  493. X        case 120:        /* + -  */
  494. X
  495. X        scanner(befehl[0]);
  496. X        break;
  497. X
  498. X
  499. X        case 190:        /* HILFE */
  500. X
  501. X        printf("\n\n");
  502. X        if (argument[0] < 33)
  503. X            help("=");
  504. X        else {
  505. X            if(argument[0] == '*'){    
  506. X                help("*");
  507. X            }
  508. X            else{
  509. X                strcpy(s, "#");
  510. X                strcat(s, upcased(argument));
  511. X                if (help(s) < 1) {
  512. X                    ansi("md");
  513. X                    printf("%s \"%s\" %s\n", LOP12_MSG, argument, LOP13_MSG);
  514. X                    ansi("me");
  515. X                }
  516. X            }
  517. X        }
  518. X        break;
  519. X
  520. X
  521. X        case 150:        /* BRETT */
  522. X
  523. X        if(strcomp("**", argument) == NULL) strcpy(argument, "^");
  524. X        brett(argument);
  525. X        break;
  526. X
  527. X
  528. X        case 130:        /* ANRUFER */
  529. X
  530. X        if(argument[0] == '#'){
  531. X            statistik();
  532. X            break;
  533. X        }
  534. X
  535. X        if(argument[0] == '%'){
  536. X            headline( LOP34_MSG );
  537. X            printf("%s\n", LOP35_MSG);
  538. X            printf("===============================================================================\n");
  539. X            printf("%s ..", LOP29_MSG);
  540. X    
  541. X            switch( (fpid = fork()) ){
  542. X                case -1 :
  543. X                    break;
  544. X                case  0 : 
  545. X                    while(1){
  546. X                        printf(".");
  547. X                        sleep(2);
  548. X                    }    
  549. X                    break;
  550. X            }
  551. X            sprintf(t, "%s/%d.srt", TMP, getpid());
  552. X            sprintf(l, SECONDCUT, CALLS, t);
  553. X            system(l);             
  554. X            kill( fpid, SIGKILL );
  555. X            (void) wait( &fpid );
  556. X            printf("%c", CR);
  557. X            show(t, 9999, USER.more + 100);
  558. X            unlink(t);
  559. X            break;
  560. X        }
  561. X
  562. X        headline( LOP14_MSG );
  563. X        printf("%s\n", LOP15_MSG);
  564. X        printf("===============================================================================\n");
  565. X
  566. X        if (argument[0] != '*') {
  567. X            show(CALLS, 19, USER.more);
  568. X        }
  569. X        else {
  570. X            show(CALLS, 9999, USER.more + 100);
  571. X        }
  572. X        break;
  573. X
  574. X
  575. X        case 200:        /* INHALT */
  576. X
  577. X        inhalt2(argument, 'I');
  578. X        break;
  579. X
  580. X
  581. X        case 210:        /* LESEN */
  582. X
  583. X        dummy = (pruefe(argument));
  584. X        if (dummy == 0) lesen(argument);
  585. X        if (dummy == -1) lesen2(argument, 'L');
  586. X        break;
  587. X
  588. X
  589. X
  590. X        case 230:        /* SCHREIBEN */
  591. X
  592. X        if (USER.level < WRITE_IN_LEV) {
  593. X            ansi("md");
  594. X            printf(" %s\n", LOP16_MSG);
  595. X            ansi("me");
  596. X        }
  597. X        else
  598. X            schreiben(argument);
  599. X        break;
  600. X
  601. X
  602. X        case 220:        /* LOESCHEN */
  603. X
  604. X        dummy = (pruefe(argument));
  605. X        if (dummy == 0) loeschen(argument);
  606. X        if (dummy == -1) loeschen2(argument, 'D');
  607. X        break;
  608. X
  609. X
  610. X        case 160:        /* BRIEF */
  611. X
  612. X        if (USER.level < WRITE_IN_LEV) {
  613. X            ansi("md");
  614. X            printf(" %s\n", LOP16_MSG);
  615. X            ansi("me");
  616. X        }
  617. X        else
  618. X            if((brief(argument) == 0) && (strcomp(GUEST, USER.name) != 0)){
  619. X                sprintf(s, "%s?", USER.name);
  620. X                brief(s);
  621. X                sprintf(s, "%s/usr/%d/INDEX", HOME, USER.id);
  622. X                stat(s, &fst);
  623. X                    IDX_SIZE = (int) fst.st_size;
  624. X            }
  625. X            else bef_buff[0] = '\0';
  626. X        break;
  627. X
  628. X
  629. X        case 170:        /* CHAT */
  630. X
  631. X        sprintf(s, "exec %s %s \"%s\" %d %d", RSH, CHAT, USER.nick, OLDUID, OLDGID);
  632. X        system(s);
  633. X        break;
  634. X
  635. X
  636. X        case 250:        /* PM */
  637. X
  638. X        strcpy(BRETT, "PM");
  639. X        printf("\n");
  640. X        sprintf(NG, "%s.PM", USER.name);
  641. X        sprintf(INHALT, "%s/usr/%d/INDEX", HOME, USER.id);
  642. X        break;
  643. X
  644. X
  645. X        case 260:        /* POSTFACH */
  646. X
  647. X        postfach("*");
  648. X        break;
  649. X
  650. X
  651. X        case 300:        /* USER */
  652. X
  653. X        userliste(argument);
  654. X        break;
  655. X
  656. X
  657. X        case 140:        /* ANSAGE */
  658. X
  659. X        ansage();
  660. X        break;
  661. X
  662. X
  663. X        case 310:        /* UNTERSCHRIFT */
  664. X
  665. X        unterschrift();
  666. X        break;
  667. X
  668. X
  669. X        case 320:        /* VERSION */
  670. X
  671. X        printf("\n\n");
  672. X        ansi("md");
  673. X        printf("Version: ");
  674. X        ansi("me");
  675. X        printf("%s %s %s\n", VERSION, PATCHLEVEL, AUTOR);
  676. X
  677. X        if(argument[0] == '#'){
  678. X            ansi("md");
  679. X            printf("\nMein spezieller Dank gilt folgenden Mitarbeitern, Beta-Testern und Ratgebern: \n\n");
  680. X            ansi("me");
  681. X            
  682. X            printf("andreas@xenox.ruhr.de       - fuer den \"NewsFeed\" und seine Geduld\n");
  683. X            printf("                              bei unseren \"Sonderwuenschen\"\n\n");
  684. X
  685. X            printf("az@unnet.w.open.de          - fuer seinen Einsatz beim \"Einrichten\"\n");
  686. X            printf("                              der Mailbox und der PD-Portierung\n\n");
  687. X
  688. X            printf("joergg@unnet.ruhr.sub.org   - fuer seine Ideen, Tips, konstruktive\n");
  689. X            printf("                              Kritik und gruendliche Tests\n\n");        
  690. X
  691. X            printf("klausr@skylink.ruhr.sub.org - fuer viele Vorschlaege, und vor allem\n");            
  692. X            printf("                              fuer seine praesizen Fehlerbeschreibungen\n\n");            
  693. X
  694. X            printf("stefans@coduck.ruhr.sub.org - fuer seine Hilfe bei der Installation\n");
  695. X            printf("                              der 386er Patches und der PD-Beschaffung\n\n");
  696. X
  697. X            printf("walterb@weller.ruhr.sub.org - fuer seine Unterstuetzung bei der Portierung auf\n");
  698. X            printf("                              UNIX SVR3 und bei der Installation\n\n");
  699. X
  700. X            printf("hergo@ivcmd.boerde.de       - fuer seine Hilfe bei der Bildung einer Referenz-\n");
  701. X            printf("                              Version zur Verwendung von CDIFFs\n\n");
  702. X            
  703. X        }
  704. X        
  705. X        if(argument[0] == '*'){
  706. X            ansi("md");
  707. X            printf("\n%s ", LOP17_MSG);
  708. X            ansi("me");
  709. X#ifdef _SYS7
  710. X            printf("-D_SYS7 ");
  711. X#endif
  712. X#ifdef _MBOX
  713. X            printf("-D_MBOX ");
  714. X#endif
  715. X#ifdef _MINIX
  716. X            printf("-D_MINIX ");
  717. X#endif
  718. X#ifdef _ESTDIO
  719. X            printf("-D_ESTDIO ");
  720. X#endif
  721. X#ifdef _CORELEFT
  722. X            printf("-D_CORELEFT ");
  723. X#endif
  724. X#ifdef _DATESTAMP
  725. X            printf("-D_DATESTAMP ");
  726. X#endif
  727. X#ifdef _BAUDRATE
  728. X            printf("-D_BAUDRATE ");
  729. X#endif
  730. X#ifdef _MULTIMEDIA
  731. X            printf("-D_MULTIMEDIA ");
  732. X#endif
  733. X#ifdef _METAMAIL
  734. X            printf("-D_METAMAIL ");
  735. X#endif
  736. X
  737. X            printf("\n");
  738. X        }
  739. X
  740. X        break;
  741. X
  742. X
  743. X        case 270:        /* PORTINFO */
  744. X
  745. X        port( argument );
  746. X        break;
  747. X
  748. X
  749. X        case 280:        /* SETUP */
  750. X
  751. X        sprintf(s, "%s", NG);
  752. X        sprintf(t, "%s", BRETT);
  753. X        setup();
  754. X        if (strcomp("PM", t) != 0) brett(s);
  755. X        break;
  756. X
  757. X
  758. X        case 125:        /* ADMIN */
  759. X
  760. X        sprintf(s, "%s", NG);
  761. X        sprintf(t, "%s", BRETT);
  762. X        admin();
  763. X        if (strcomp("PM", t) != 0) brett(s);
  764. X        break;
  765. X
  766. X
  767. X        case 205:        /* ID */
  768. X
  769. X        if(strcomp("-c", argument) == 0){ /* Memory fault - core dumped */
  770. X            printf("\n\nDebug-Modus: ");
  771. X            fclose(0);   
  772. X            break;
  773. X        }
  774. X
  775. X        if(strcomp("*", argument) == 0){
  776. X            BAUDRATE = baudrate( MAX_BPS );
  777. X            printf("\n\n>>> Baudrate %d\n", BAUDRATE);
  778. X            break;
  779. X        }
  780. X
  781. X        if(strcomp("#", argument) == 0){
  782. X            printf("\n\n>>> Coreleft %d\n", coreleft());
  783. X            break;
  784. X        }
  785. X
  786. X        printf("\n\n>>> %s (UID %d|%d|%d) (GID %d|%d|%d)\n", MYNAME,
  787. X               getuid(), geteuid(), OLDUID,
  788. X               getgid(), getegid(), OLDGID);
  789. X        break;
  790. X
  791. X
  792. X        case 215:        /* LEVEL */
  793. X
  794. X        show_level();
  795. X        break;
  796. X
  797. X
  798. X        case 290:        /* STATUS */
  799. X
  800. X        status();
  801. X        break;
  802. X
  803. X
  804. X        case 330:         /* MAKRO */
  805. X
  806. X        set_makros();
  807. X        break;
  808. X
  809. X
  810. X        case 340:        /* WEITERLEITEN */
  811. X
  812. X        weiterleiten( argument );
  813. X        break;
  814. X
  815. X
  816. X        case 350:           /* SLEEP */
  817. X
  818. X        dummy = atoi( argument );
  819. X        if(dummy < 1) dummy = 1;
  820. X        printf("\n");
  821. X        ansi( "mr" );
  822. X        printf(" %s ... ", LOP29_MSG);
  823. X        ansi( "me" );    
  824. X        sleep( dummy );
  825. X        break;        
  826. X
  827. X
  828. X        case 360:        /* KEYPRESSED */
  829. X
  830. X        printf("\n");
  831. X        ansi("mr");
  832. X        printf(" Taste ! ");
  833. X        ansi("me");
  834. X        dummy = getint();
  835. X        if((dummy == CTRL_X) || (dummy == 'x') || (dummy == 'q')){
  836. X            bef_buff[0] = '\0';
  837. X            printf("\n");
  838. X        }
  839. X        break;
  840. X
  841. X
  842. X        case 370:        /* DATUM */
  843. X        
  844. X        ansi("md");
  845. X        printf("\n\n%s ", LOP18_MSG);
  846. X        ansi("me"); 
  847. X        printf("%s, ", (char *) mydate( 2 ));
  848. X        printf("%s\n",  (char *) mydate( 0 ));
  849. X        break;
  850. X    
  851. X
  852. X        case 380:        /* ZEIT */
  853. X
  854. X        ansi("md");
  855. X        printf("\n\n%s ", LOP19_MSG);
  856. X        ansi("me");
  857. X        printf("%s\n", (char *) mytime( 0 ));
  858. X        ansi("md");
  859. X        printf("Online: ");
  860. X        ansi("me");
  861. X        time(&time_now);
  862. X        printf("%d %s\n",  (int) time_now - time_start, LOP20_MSG);
  863. X        break;
  864. X
  865. X
  866. X       case 390:        /* SPIELE */
  867. X
  868. X        games();
  869. X        break;
  870. X    
  871. X
  872. X        case 400:        /* RICHTUNG */
  873. X
  874. X        ansi("md");
  875. X        printf("\n\n%s ", LOP21_MSG);
  876. X        ansi("me");
  877. X
  878. X        if (USER.leserichtung == 1) {
  879. X            USER.leserichtung = 2;
  880. X            printf("%s\n", LOP22_MSG);
  881. X        }
  882. X        else {
  883. X            USER.leserichtung = 1;
  884. X            printf("%s\n", LOP22aMSG);
  885. X        }
  886. X        break;
  887. X
  888. X
  889. X        case 410:           /* STATISTIK */
  890. X
  891. X        if ((argument[0] != '#') && (argument[0] != '$') && (argument[0] != '%') && (argument[0] != '!')) {
  892. X            headline( LOP23_MSG );
  893. X            printf("%s\n", LOP24_MSG);
  894. X            printf("===============================================================================\n");
  895. X
  896. X            if (argument[0] != '*') {
  897. X                show(MB_DLOG, 19, USER.more);
  898. X            }
  899. X            else {
  900. X                show(MB_DLOG, 9999, USER.more + 100);
  901. X            }
  902. X        }
  903. X        if(argument[0] == '$') {
  904. X            headline( LOP25_MSG );
  905. X            show(UUCPCOSTS, 9999, USER.more);
  906. X        }
  907. X           if(argument[0] == '#') {
  908. X            headline( LOP26_MSG );
  909. X            printf("%s\n", LOP27_MSG);
  910. X            printf("===============================================================================\n");
  911. X
  912. X            show(PDLOG, 9999, USER.more + 100);
  913. X        }
  914. X        if(argument[0] == '%') {
  915. X            headline( LOP32_MSG );
  916. X            printf("%s\n", LOP33_MSG);
  917. X            printf("===============================================================================\n");
  918. X            printf("%s ..", LOP29_MSG);
  919. X    
  920. X            switch( (fpid = fork()) ){
  921. X                case -1 :
  922. X                    break;
  923. X                case  0 : 
  924. X                    while(1){
  925. X                        printf(".");
  926. X                        sleep(2);
  927. X                    }    
  928. X                    break;
  929. X            }
  930. X            sprintf(t, "%s/%d.srt", TMP, getpid());
  931. X            sprintf(l, SORTEDCUT, PDLOG, t);
  932. X            system(l);             
  933. X            kill( fpid, SIGKILL );
  934. X            (void) wait( &fpid );
  935. X            printf("%c", CR);
  936. X            show(t, 9999, USER.more + 100);
  937. X            unlink(t);
  938. X        }
  939. X        if(argument[0] == '!') {
  940. X            headline( " OUTDIAL " );
  941. X            show("/local/mbox/etc/outdial.log", 9999, USER.more);
  942. X        }
  943. X
  944. X        break;
  945. X
  946. X        case 430:        /* SUCHEN */
  947. X
  948. X        suchen( argument );
  949. X        break;    
  950. X
  951. X                    
  952. X        case 420:        /* RING */
  953. X
  954. X        ende = 1;
  955. X        break;
  956. X
  957. X
  958. X        case 440:        /* DOWNLOAD */
  959. X
  960. X        download( argument );
  961. X        break;
  962. X
  963. X         case 450:        /* OUTDIAL */
  964. X
  965. X        outdial();
  966. X        break;
  967. X
  968. X        case 460:        /* AREA */
  969. X
  970. X        if((strcomp("++", argument) == 0) || (strcomp("--", argument) == 0)){
  971. X            scanner( argument[0] + 1500 );
  972. X        }
  973. X        else{
  974. X            scanner( argument[0] + 500 );
  975. X        }    
  976. X        break;
  977. X
  978. X
  979. X        case 470:        /* SYSINFO */
  980. X
  981. X        headline( " SYSiNFO " );
  982. X        show(SYSINFO, 9999, USER.more);
  983. X        break;
  984. X
  985. X        case 480:        /* EDIT */
  986. X
  987. X        edit( argument );
  988. X        break;
  989. X
  990. X        case 1000:        /* User Defined Command */
  991. X
  992. X        /* See 'befehl.c' how that works ;-) */
  993. X        break;
  994. X
  995. X        case 180:        /* ENDE */
  996. X
  997. X#ifdef _MINIX
  998. X        if (tty() >= FIRST_EX_TTY) {
  999. X            printf("\n\n");
  1000. X            ansi("mr");
  1001. X            printf("%c%s [%c, %c] > ", CR, LOP28_MSG, GBL06_MSG, GBL07_MSG);
  1002. X            ansi("me");
  1003. X            
  1004. X            c = yesno();
  1005. X        } else
  1006. X#endif
  1007. X            c = GBL06_MSG;
  1008. X
  1009. X
  1010. X        if (c == GBL06_MSG)
  1011. X            ende = 1;
  1012. X        else
  1013. X            printf("\n");
  1014. X
  1015. X        if(argument[0] == '*'){
  1016. X            USER.lasttime = LASTTIME;
  1017. X            strcpy(USER.lastlog, (char *) datereconv( LASTLOG ));
  1018. X        }
  1019. X        else{
  1020. X            strcpy(s, (char *) mydate(0));
  1021. X            s[10] = '\0';
  1022. X            strcpy(USER.lastlog, s);
  1023. X            strcpy(s, (char *) mytime(1));
  1024. X            USER.lasttime = timeconv(s);
  1025. X        }
  1026. X
  1027. X        break;
  1028. X
  1029. X        case -1:        /* LEVEL ??? */
  1030. X
  1031. X        wasok = 0;
  1032. X        ansi("md");
  1033. X        printf(" %s %d ...\n", LOP30_MSG, USER.level);
  1034. X        ansi("me");
  1035. X        break;
  1036. X
  1037. X        default:
  1038. X
  1039. X        wasok = 0;
  1040. X        ansi("md");
  1041. X        printf(" %s\n", LOP31_MSG);
  1042. X        ansi("me");
  1043. X    }
  1044. X
  1045. X  } while (ende == 0);
  1046. X}
  1047. END_OF_FILE
  1048.   if test 20414 -ne `wc -c <'src/loop.c'`; then
  1049.     echo shar: \"'src/loop.c'\" unpacked with wrong size!
  1050.   fi
  1051.   # end of 'src/loop.c'
  1052. fi
  1053. if test -f 'src/misc.c' -a "${1}" != "-c" ; then 
  1054.   echo shar: Will not clobber existing file \"'src/misc.c'\"
  1055. else
  1056.   echo shar: Extracting \"'src/misc.c'\" \(21563 characters\)
  1057.   sed "s/^X//" >'src/misc.c' <<'END_OF_FILE'
  1058. X/***************************************************************************/
  1059. X/*        PROGRAMM  ix/Mbox                           */
  1060. X/*             DATEI  misc.c                           */
  1061. X/*        FUNKTIONEN  scanner(), schreiben(), prf(), pruefe()           */
  1062. X/*             AUTOR  vs (Volker Schuermann/MINIX-Version)           */
  1063. X/*  LETZTE AENDERUNG  10.05.1992                       */
  1064. X/***************************************************************************/
  1065. X
  1066. X#include <sys/types.h>
  1067. X#include <sys/stat.h>
  1068. X#include <unistd.h>
  1069. X#include <fcntl.h>
  1070. X#include <stdio.h>
  1071. X#include <utmp.h>
  1072. X#include <time.h>
  1073. X
  1074. X
  1075. X#include "mbox.h"
  1076. X
  1077. X
  1078. Xextern char headinfo[STRING];
  1079. X
  1080. X
  1081. Xint lastpoint( name )
  1082. Xchar name[];
  1083. X{
  1084. X  int a = 0, b = 0;
  1085. X
  1086. X  while(name[a] != '\0'){
  1087. X    if(name[a] == '.') b = a;
  1088. X    a++;
  1089. X  }
  1090. X  if(b == 0) return a;
  1091. X
  1092. X  return (int) b;
  1093. X}
  1094. X
  1095. X
  1096. X/***************************************************************************/
  1097. X/*      FUNKTION  scanner()                              */
  1098. X/*  BESCHREIBUNG  Wechselt BRETTER. Bei "B +" bzw. "B -" wird die Aktual-  */
  1099. X/*          litaet nicht beruecksichtigt. In den anderen Modi        */
  1100. X/*          werden nur aktuelle Bretter angesprungen.                */
  1101. X/*     PARAMETER  mode  =  '> 255'  =  nicht nur aktuelle Bretter       */
  1102. X/*                   '> 500'  =  zur nexten AREA               */
  1103. X/*               '+'      =  aufwaerts springen           */
  1104. X/*               '-'      =  abwaerts springen           */
  1105. X/*     RUECKGABE  keine                                                       */
  1106. X/***************************************************************************/
  1107. X
  1108. Xvoid scanner(mode)
  1109. Xint mode;
  1110. X{
  1111. X  FILE *fp;
  1112. X  char s[STRING];
  1113. X  char t[STRING];
  1114. X  char f[STRING];
  1115. X  char prevg[STRING];
  1116. X  char prevf[STRING];
  1117. X  int ok = 0, a, b;
  1118. X  int line = 0, l = 0;
  1119. X  int locmod = 0;
  1120. X  int max = 0;
  1121. X  int widerange = 0;
  1122. X
  1123. X
  1124. X  if (mode >= 1000) {
  1125. X    widerange = 1000;
  1126. X    mode -= 1000;
  1127. X  }
  1128. X
  1129. X  if (mode >= 500) {
  1130. X    locmod = 500;
  1131. X    mode -= 500;
  1132. X  }
  1133. X
  1134. X  if (mode >= 255) {
  1135. X    locmod = 255;
  1136. X    mode -= 255;
  1137. X  }
  1138. X  KEIN_ZUGRIFF:
  1139. X
  1140. X  if (locmod == 255) {
  1141. X    maybe_locked(NGROUPS, "r");
  1142. X    fp = fopen(NGROUPS, "r");
  1143. X    if (fp == NULL) {
  1144. X        nerror("misc.c", 26, "scanner", "Datei-Lesefehler", NGROUPS);
  1145. X    }
  1146. X }
  1147. X  else {
  1148. X    maybe_locked(UGROUPS, "r");
  1149. X    fp = fopen(UGROUPS, "r");
  1150. X    if (fp == NULL) {
  1151. X        nerror("misc.c", 34, "scanner", "Datei-Lesefehler", UGROUPS);
  1152. X    }
  1153. X  }
  1154. X
  1155. X  f[0] = '\0';
  1156. X  ok = 0;
  1157. X  strcpy(prevg, "L.I.S.A.");
  1158. X
  1159. X  while ((ok == 0) && (fscanf(fp, "%s %d %d %s", s, &a, &a, t) > 0)) {
  1160. X    l++;
  1161. X    if (strcomp(NG, s) == 0) {
  1162. X        ok = 1;
  1163. X    }
  1164. X    else {
  1165. X        strcpy(f, (char *) s);
  1166. X    
  1167. X        if(strcomp(prevg, s) != 0){
  1168. X            if(widerange == 0){
  1169. X                  a = lastpoint( s );
  1170. X                strcpy(prevg, (char *) s);
  1171. X                strcpy(prevf, (char *) s);
  1172. X                prevg[a] = '\0';
  1173. X            }
  1174. X            else{
  1175. X                strcpy(prevg, (char *) s); prevg[3] = '\0';
  1176. X                strcpy(prevf, (char *) s);
  1177. X            }
  1178. X        }
  1179. X    }
  1180. X  }
  1181. X
  1182. X  if (locmod == 500) {
  1183. X    if (mode == '+') {
  1184. X        ok = 0;
  1185. X        
  1186. X        if(widerange == 0){
  1187. X            a = lastpoint( NG );
  1188. X            strcpy(prevg, (char *) NG);
  1189. X            prevg[a] = '\0';
  1190. X        }
  1191. X        else{
  1192. X            strcpy(prevg, (char *) NG);
  1193. X            prevg[3] = '\0';
  1194. X        }
  1195. X
  1196. X        while ((ok == 0) && (fscanf(fp, "%s %d %d %s", s, &a, &a, t) > 0)) {
  1197. X            l++;
  1198. X            if (strcomp(prevg, s) != 0) {
  1199. X                ok = 1;
  1200. X                strcpy(f, (char *) s);
  1201. X            }
  1202. X        }
  1203. X        if(ok == 0) line = -1;
  1204. X    }
  1205. X    if (mode == '-') {
  1206. X        strcpy(f, (char *) prevf);
  1207. X    }
  1208. X  }
  1209. X  else{
  1210. X      if (mode == '+') {
  1211. X        if (fscanf(fp, "%s %d %d %s", f, &a, &a, t) < 1) {
  1212. X            if (ok == 0) {
  1213. X                rewind(fp);
  1214. X                fscanf(fp, "%s %d %d %s", f, &a, &a, t);
  1215. X            }
  1216. X              else {
  1217. X                line = -1;
  1218. X            }
  1219. X        }
  1220. X      }
  1221. X      if (mode == '-') {
  1222. X        if (f[0] == '\0') {
  1223. X            rewind(fp);
  1224. X            while (fscanf(fp, "%s %d %d %s", f, &a, &a, t) > 0);
  1225. X        }
  1226. X      }
  1227. X  }    
  1228. X  fclose(fp);
  1229. X
  1230. X  if (max > 20) line = -1;
  1231. X
  1232. X  if ((line == -1) || (f[0] == '\0')) {
  1233. X    strcpy(BRETT, (char *) "PM");
  1234. X    printf("\n");
  1235. X    sprintf(NG, "%s.PM", USER.name);
  1236. X    sprintf(INHALT, "%s/usr/%d/INDEX", HOME, USER.id);
  1237. X    return;
  1238. X  }
  1239. X  if (l == 0) {
  1240. X    ansi("md");
  1241. X    printf(" %s\n", MIS01_MSG);
  1242. X    ansi("me");
  1243. X    return;
  1244. X  }
  1245. X  if (chk_newsgrp(f) != 0) {
  1246. X    sprintf(NG, "%s", f);
  1247. X    max++;
  1248. X    goto KEIN_ZUGRIFF;
  1249. X  }
  1250. X  brett(f);
  1251. X}
  1252. X
  1253. X
  1254. X
  1255. X
  1256. X
  1257. X/***************************************************************************/
  1258. X/*      FUNKTION  schreiben()                           */
  1259. X/*  BESCHREIBUNG  Artikel fuer NEWS einlesen und verteilen. Die Distri-    */
  1260. X/*          bution ist abhaengig von der NG und vom Userlevel.       */
  1261. X/*     PARAMETER  arg = DUMMY (!)                                          */
  1262. X/*     RUECKGABE  keine                                                       */
  1263. X/***************************************************************************/
  1264. X
  1265. Xvoid schreiben(arg)
  1266. Xchar arg[];
  1267. X{
  1268. X  FILE *fp;
  1269. X  FILE *ff;
  1270. X  FILE *fl;
  1271. X  char s[STRING];
  1272. X  char t[STRING];
  1273. X  char f[STRING];
  1274. X  char g[LSTRING];
  1275. X  char ex[255];
  1276. X  char cmdl[STRING];
  1277. X  char rep[STRING];
  1278. X  char subj[STRING];
  1279. X  char keyw[STRING];
  1280. X  char summ[STRING];
  1281. X  char from[STRING];
  1282. X  char msid[STRING];
  1283. X  char refs[STRING];
  1284. X  char tmp[STRING];
  1285. X  char ng[STRING];
  1286. X  char reply[STRING];
  1287. X  char group[STRING];
  1288. X  char newsgroups[STRING];
  1289. X  char distribution[STRING];
  1290. X  char followup[STRING];
  1291. X  char expires[STRING];
  1292. X  char ctrl[STRING];
  1293. X  char sender[STRING];
  1294. X  char approved[STRING];
  1295. X  char content[STRING];
  1296. X  char iam[STRING];
  1297. X  char username[STRING];
  1298. X
  1299. X  int i, a, b, ok;
  1300. X  int app;
  1301. X
  1302. X  char protokoll = 0;
  1303. X  char c;
  1304. X  char lf;
  1305. X
  1306. X  int BINFILE;
  1307. X
  1308. X  struct stat fst;
  1309. X
  1310. X  char pubdir[STRING];
  1311. X  long tdummy;
  1312. X  long tn, ts;
  1313. X
  1314. X  if (strcomp(BRETT, "PM") == 0) {
  1315. X    ansi("md");
  1316. X    printf(" <- \"%s.PM\" %s\n\n", USER.name, MIS02_MSG);
  1317. X    ansi("me");
  1318. X    return;
  1319. X  }
  1320. X  BINFILE = 0;
  1321. X
  1322. X
  1323. X  i = 0;                /* Vorname.Name */
  1324. X  strcpy(ng, USER.name);
  1325. X  while (ng[i] != '\0') {
  1326. X    if (ng[i] == ' ') ng[i] = '.';
  1327. X    i++;
  1328. X  }
  1329. X  strcpy(username, ng);
  1330. X
  1331. X  strcpy(group, NG);
  1332. X
  1333. X
  1334. X  umask(0000);
  1335. X
  1336. X  if (arg[0] == '\0') {
  1337. X
  1338. X    subj[0] = '\0';
  1339. X    keyw[0] = '\0';
  1340. X    from[0] = '\0';
  1341. X    msid[0] = '\0';
  1342. X    summ[0] = '\0';
  1343. X    refs[0] = '\0';
  1344. X
  1345. X    sprintf(rep, "%s/%dRep", TMP, getpid());
  1346. X
  1347. X    fp = fopen(rep, "r");
  1348. X    if (fp != NULL) {        /* REPLY */
  1349. X        while ((fgets(s, 80, fp) != NULL) && (s[0] > 32)) {
  1350. X            if (strcomp("Subject:", s)   == 0) {
  1351. X                strcat(subj, strcopy(s, 8, 79));
  1352. X                strcpy(subj,  (char *) stripped(subj));                
  1353. X            }
  1354. X            if (strcomp("From:", s)      == 0) {
  1355. X                from[0] = '\0';
  1356. X                strcat(from, strcopy(s, 6, 79));
  1357. X                strcpy(from,  (char *) stripped(from));
  1358. X            }
  1359. X            if (strcomp("Reply-To:", s)  == 0) {
  1360. X                from[0] = '\0';
  1361. X                strcat(from, strcopy(s, 10, 79));
  1362. X                strcpy(from,  (char *) stripped(from));
  1363. X            }
  1364. X            if (strcomp("Keywords:", s)  == 0) {
  1365. X                strcat(keyw, strcopy(s, 10, 79));
  1366. X                strcpy(keyw,  (char *) stripped(keyw));
  1367. X            }
  1368. X            if (strcomp("Summary:", s)   == 0) {
  1369. X                strcat(summ, strcopy(s, 9, 79));
  1370. X                strcpy(summ,  (char *) stripped(summ));
  1371. X            }
  1372. X            if (strcomp("Message-ID:", s) == 0) {
  1373. X                strcat(msid, strcopy(s, 11, 79));
  1374. X                strcpy(msid,  (char *) stripped(msid));
  1375. X            }
  1376. X            if (strcomp("Content-Type:", s) == 0) {
  1377. X                strcat(content, strcopy(s, 14, 79));
  1378. X                strcpy(content,  (char *) stripped(content));
  1379. X            }
  1380. X            if (strcomp("Article-I.D.:", s) == 0) {
  1381. X                strcat(msid, strcopy(s, 13, 79));
  1382. X                strcpy(msid,  (char *) stripped(msid));
  1383. X            }
  1384. X            if (strcomp("References:", s) == 0) {
  1385. X                strcat(refs, strcopy(s, 12, 79));
  1386. X                strcpy(refs,  (char *) stripped(refs));
  1387. X            } 
  1388. X            if (strcomp("Followup-To:", s) == 0) {
  1389. X                strcpy(group, strcopy(s, 13, 79));
  1390. X                strcpy(group, (char *) stripped(group));
  1391. X            }
  1392. X        }
  1393. X        
  1394. X        if(strcomp("Poster", group) == 0){
  1395. X            printf(" <- %s\n", MIS02aMSG);
  1396. X            return;
  1397. X        }
  1398. X
  1399. X
  1400. X        sprintf(t, "%s/A%d", TMP, getpid());
  1401. X        ff = fopen(t, "w");
  1402. X
  1403. X        a = 0;
  1404. X        b = 0;
  1405. X        i = 0;
  1406. X        while (from[i] != '\0') {
  1407. X            if (from[i] == '(') a = i + 1;
  1408. X            if (from[i] == ')') b = i - 1;
  1409. X            i++;
  1410. X        }
  1411. X        if (a < b) {
  1412. X            strcpy(s, (char *) strcopy(from, a, b));
  1413. X            strcpy(from, (char *) s);
  1414. X        }
  1415. X        sprintf(ex, "In article %s,\n            %s writes:\n\n", msid, from);
  1416. X        fputs(ex, ff);
  1417. X        while (fgets(s, 80, fp) != NULL) {
  1418. X            if(s[0] != '\n') fputs("> ", ff);
  1419. X            fputs(s, ff);
  1420. X        }
  1421. X        fclose(fp);
  1422. X        fclose(ff);
  1423. X
  1424. X        sprintf(cmdl, "%s %s", EDDY, t);
  1425. X        printf("\n\n");
  1426. X        system(cmdl);
  1427. X        if (strcomp("Re:", subj) != 0) {
  1428. X            sprintf(f, "Re: %s", stripped(subj));
  1429. X            strcpy(subj, (char *) f);
  1430. X        }
  1431. X        unlink(rep);
  1432. X    }
  1433. X    else {        /* Interactive MAIL */
  1434. X
  1435. X        printf("\n\n%c", CR);
  1436. X        ansi("mr");
  1437. X        printf("%s", MIS03_MSG);
  1438. X        ansi("me");
  1439. X        printf(" %s (%s)\n%c", USER.name, USER.nick, CR);
  1440. X        ansi("mr");
  1441. X        printf("%s", MIS04_MSG);
  1442. X        ansi("me");
  1443. X        printf(" %s\n%c", NG, CR);
  1444. X        ansi("mr");
  1445. X        printf("%s", MIS05_MSG);
  1446. X        ansi("me");
  1447. X        printf(" ");
  1448. X        strcpy(subj, (char *) getline(57, 11, '.', ""));
  1449. X        printf("\n");
  1450. X        ansi("mr");
  1451. X        printf("%s", MIS06_MSG);
  1452. X        ansi("me");
  1453. X        printf(" ");
  1454. X        strcpy(keyw, (char *) getline(57, 11, '.', ""));
  1455. X        printf("\n");
  1456. X        ansi("mr");
  1457. X        printf("%s", MIS07_MSG);
  1458. X        ansi("me");
  1459. X        printf(" ");
  1460. X        strcpy(summ, (char *) getline(57, 11, '.', ""));
  1461. X
  1462. X        printf("\n\n");
  1463. X        ansi("mr");
  1464. X        printf("[%s] %s ? > ", NG, MIS08_MSG);
  1465. X        ansi("me");
  1466. X        printf("%c%c", MIS09_MSG, BS);
  1467. X
  1468. X        do {
  1469. X            c = getint();
  1470. X            if (c >= 97) c -= 32;
  1471. X            if (c == '?') {
  1472. X                clearline();
  1473. X                ansi("mr");
  1474. X                printf("%c%s > ", CR, MIS12_MSG);
  1475. X                ansi("me");
  1476. X            }
  1477. X            if (c == ENTER) c = MIS09_MSG;
  1478. X            if ((c != MIS09_MSG) && (c != MIS10_MSG) && (c != MIS11_MSG)) c = 0;
  1479. X        } while (c == 0);
  1480. X
  1481. X        printf("%c", c);
  1482. X
  1483. X        if (c == MIS11_MSG) {
  1484. X            printf("\n");
  1485. X            unlink(t);
  1486. X            return;
  1487. X        }
  1488. X        if (c == MIS10_MSG) {
  1489. X            printf("%c                                                                       ", CR);
  1490. X            ansi("mr");
  1491. X            printf("%c%s, ? > ", CR, MIS13_MSG);
  1492. X            ansi("me");
  1493. X
  1494. X            do {
  1495. X                protokoll = getint();
  1496. X                if (protokoll >= 97) protokoll -= 32;
  1497. X                if (protokoll == '?') {
  1498. X                    clearline();
  1499. X                    ansi("mr");
  1500. X                    printf("%c%s > ", CR, MIS14_MSG);
  1501. X                    ansi("me"); 
  1502. X                }
  1503. X                if ((protokoll != MIS15_MSG) && (protokoll != MIS15_MSG) &&
  1504. X                    (protokoll != MIS18_MSG) && (protokoll != MIS17_MSG ))
  1505. X                    protokoll = 0;
  1506. X            } while (protokoll == 0);
  1507. X
  1508. X            printf("%c", protokoll);
  1509. X
  1510. X        }
  1511. X        sprintf(tmp, "%s/A%d", TMP, getpid());
  1512. X        sprintf(cmdl, "%s %s", EDDY, tmp);
  1513. X        sprintf(pubdir, "%s/dir%d", TMP, getpid());
  1514. X
  1515. X        if (c == MIS09_MSG) {
  1516. X            noctrlx();
  1517. X            system(cmdl);
  1518. X            ctrlx();
  1519. X            protokoll = '*';
  1520. X        }
  1521. X        else {    /* UPLOAD */
  1522. X
  1523. X            printf("\n\n");
  1524. X            ansi("md");
  1525. X            printf("%s", MIS19_MSG);
  1526. X            ansi("me");
  1527. X
  1528. X            switch (protokoll) {
  1529. X                case MIS15_MSG:
  1530. X                    fp = fopen(tmp, "w");
  1531. X                    if (fp == NULL) {
  1532. X                        nerror("misc.c", 310, "schreiben", "DSF", tmp);
  1533. X                    }
  1534. X                    c = 0;
  1535. X                    lf = CR;
  1536. X                    fputc(LF, fp);
  1537. X
  1538. X                    while ((c != CTRL_X) && (c != CTRL_D)) {
  1539. X                        c = getint();
  1540. X                        if ((c == CR) && (lf == CR))
  1541. X                            fputc(LF, fp);
  1542. X                        if (c == CR) lf = CR;
  1543. X                        if (c == LF) lf = LF;
  1544. X                        if ((c != CTRL_X) && (c != CTRL_D) && (c != CR)) {
  1545. X                            fputc(c, fp);
  1546. X                        }
  1547. X                    }
  1548. X                    fclose(fp);
  1549. X                    break;
  1550. X                case MIS16_MSG:
  1551. X                    printf("\n");
  1552. X                    sprintf(s, "exec %s -bc TimeTravelAgency 2> /dev/null", RX);
  1553. X                    break;
  1554. X                case MIS17_MSG:
  1555. X                    printf("\n");
  1556. X                    sprintf(s, "exec %s -b 2> /dev/null", RB);
  1557. X                    break;
  1558. X                case MIS18_MSG:
  1559. X                    printf("\n");
  1560. X                    sprintf(s, "exec %s -b 2> /dev/null", RZ);
  1561. X                    break;
  1562. X            }
  1563. X            if (protokoll != MIS15_MSG){
  1564. X                mkdir( pubdir, 0777 );
  1565. X                chdir( pubdir );
  1566. X
  1567. X                time(&ts);
  1568. X                system( s );
  1569. X                time(&tn); tn = tn - ts;
  1570. X                tn -= 10;  /* 10 = "Toleranz" */
  1571. X    
  1572. X                chdir( HOME );
  1573. X                sprintf(s, "mv %s/* %s", pubdir, tmp);
  1574. X                system( s );
  1575. X                sprintf(s, "rm -r %s", pubdir);
  1576. X                system( s );
  1577. X            }
  1578. X            sync();
  1579. X            stat(tmp, &fst);
  1580. X            if (fst.st_size < 3L) {
  1581. X                printf("\n\n%s\n", MIS20_MSG);
  1582. X                control(MIS21_MSG, 3);
  1583. X                unlink(tmp);
  1584. X                return;
  1585. X            }
  1586. X            if (prf(tmp) == 1) {
  1587. X                if (strcomp(PDNG, NG) == 0) {
  1588. X                    USER.upratio += ((long) fst.st_size / 1024);
  1589. X                }
  1590. X                BINFILE++;
  1591. X                sprintf(s, MIS22_MSG);
  1592. X            }
  1593. X            else{
  1594. X                mkix(tmp);
  1595. X                sprintf(s, MIS23_MSG);
  1596. X            }
  1597. X            ansi( "md" );
  1598. X            printf("\n\n%ld %s %s %s.\n", fst.st_size, MIS24_MSG, s, MIS25_MSG);
  1599. X            ansi( "me" );
  1600. X            if(tn < 1) tn = 1L;
  1601. X            printf("%s %d cps (ca. %d bps).", MIS26_MSG,
  1602. X                (fst.st_size / tn), ((fst.st_size / tn) * 11));                
  1603. X        }
  1604. X    }
  1605. X
  1606. X    sprintf(iam, "%s <%s@%s>", USER.name, username, UUCPID);
  1607. X    sprintf(reply, "%s@%s (%s)", username, UUCPID, USER.name);
  1608. X    strcpy(newsgroups, group);
  1609. X    if (USER.level < WRITE_EX_LEV) {
  1610. X        strcpy(distribution, "local");
  1611. X    }
  1612. X    else {
  1613. X        /*
  1614. X        strcpy(ng, NG);
  1615. X        i = 0;
  1616. X        while ((ng[i] != '.') && (ng[i] != '\0')) i++;
  1617. X        ng[i] = '\0';
  1618. X        strcpy(distribution, ng);
  1619. X        */
  1620. X        strcpy(distribution, "world");
  1621. X    }
  1622. X    if(refs[0] != '\0') strcat(refs, " ");
  1623. X    strcat(refs, msid);    
  1624. X    followup[0] = '\0';
  1625. X    sender[0] = '\0';
  1626. X    ctrl[0] = '\0';
  1627. X    expires[0] = '\0';
  1628. X    approved[0] = '\0';
  1629. X    app = 0;
  1630. X    content[0] = '\0';    
  1631. X
  1632. X
  1633. X    ONCE_MORE:
  1634. X
  1635. X    printf("\n\n");
  1636. X    ansi("mr");
  1637. X    if(BINFILE == 0){
  1638. X        printf("[%s] %s, ? > ", NG, MIS27_MSG);
  1639. X    }
  1640. X    else{
  1641. X        printf("[%s] %s, ? > ", NG, MIS28_MSG);
  1642. X    }
  1643. X    ansi("me");
  1644. X    printf("%c%c", MIS29_MSG, BS);
  1645. X
  1646. X    do {
  1647. X        c = getint();
  1648. X        if (c >= 97) c -= 32;
  1649. X        if (c == '?') {
  1650. X            clearline();
  1651. X            ansi("mr");
  1652. X            if(BINFILE == 0){
  1653. X                printf("%c%s > ", CR, MIS32_MSG);
  1654. X            }
  1655. X            else{
  1656. X                printf("%c%s > ", CR, MIS33_MSG);
  1657. X            }
  1658. X            ansi("me");
  1659. X        }
  1660. X        if (c == ENTER) c = MIS29_MSG;
  1661. X        if ((c != MIS29_MSG) && (c != MIS30_MSG) && (c != MIS31_MSG) && (c != MIS31aMSG)) c = 0;
  1662. X    } while (c == 0);
  1663. X
  1664. X    printf("%c", c);
  1665. X    if (c == MIS30_MSG) {
  1666. X        unlink(f);
  1667. X        unlink(s);
  1668. X        unlink(t);
  1669. X        unlink(tmp); /* ??? */
  1670. X        unlink(rep);
  1671. X        printf("\n");
  1672. X        return;
  1673. X    }
  1674. X    if ((c == MIS31_MSG) && (BINFILE == 0)) {
  1675. X        noctrlx();
  1676. X        system(cmdl);
  1677. X        ctrlx();
  1678. X        goto ONCE_MORE;
  1679. X    }
  1680. X    if (c == MIS31aMSG) { /* HEADER */
  1681. X        headline( MIS38aMSG );
  1682. X        printf("\n");
  1683. X        time(&tdummy);
  1684. X
  1685. X        ansi( "md" );
  1686. X        printf("From: ");
  1687. X        ansi( "me" );
  1688. X        if(USER.level > ADMIN_LEV){
  1689. X            strcpy(s, (char *) getline(80, 1001, 32, iam));
  1690. X            if(strcomp(s, iam) != 0) app++;            
  1691. X            if(s[0] != '\0') strcpy(iam, s);
  1692. X            printf("\n");
  1693. X        }
  1694. X        else printf("%s\n", iam);
  1695. X
  1696. X        ansi( "md" );
  1697. X        printf("Reply-To: ");
  1698. X        ansi( "me" );
  1699. X        if(USER.level > GUEST_LEV){
  1700. X            strcpy(reply, (char *) getline(80, 1001, 32, reply));
  1701. X            printf("\n");
  1702. X        }
  1703. X        else printf("%s\n", reply);
  1704. X
  1705. X        ansi( "md" );
  1706. X        printf("Sender: ");
  1707. X        ansi( "me" );
  1708. X        if(USER.level >= ADMIN_LEV){
  1709. X            strcpy(sender, (char *) getline(80, 1001, 32, sender));
  1710. X            printf("\n");
  1711. X        }
  1712. X        else printf("%s\n", sender);    
  1713. X        
  1714. X        ansi( "md" );
  1715. X        printf("Control: ");
  1716. X        ansi( "me" );
  1717. X        if(USER.level >= ADMIN_LEV){
  1718. X            strcpy(ctrl, (char *) getline(80, 1001, 32, ctrl));
  1719. X            printf("\n");
  1720. X        }
  1721. X        else printf("%s\n", ctrl);    
  1722. X        
  1723. X        ansi( "md" );
  1724. X        printf("Approved: ");
  1725. X        ansi( "me" );
  1726. X        if(app != 0) sprintf(approved, "%s <%s@%s>", USER.name, username, UUCPID);
  1727. X        if(USER.level >= EXE_LEV){
  1728. X            strcpy(approved, (char *) getline(80, 1001, 32, approved));
  1729. X            printf("\n");
  1730. X        }
  1731. X        else printf("%s\n", approved);    
  1732. X    
  1733. X        ansi( "md" );
  1734. X        printf("Newsgroups: ");
  1735. X        ansi( "me" );
  1736. X        if(USER.level >= WRITE_EX_LEV){
  1737. X            strcpy(newsgroups, (char *) getline(80, 1001, 32, newsgroups));
  1738. X            printf("\n");
  1739. X        }
  1740. X        else printf("%s\n", newsgroups);    
  1741. X        
  1742. X        ansi( "md" );
  1743. X        printf("Distribution: ");
  1744. X        ansi( "me" );
  1745. X        if(USER.level >= WRITE_INTERNAT){
  1746. X            strcpy(distribution, (char *) getline(80, 1001, 32, distribution));
  1747. X            printf("\n");
  1748. X        }
  1749. X        else printf("%s\n", distribution);    
  1750. X        
  1751. X        ansi( "md" );
  1752. X        printf("Followup-To: ");
  1753. X        ansi( "me" );
  1754. X        if(USER.level >= WRITE_EX_LEV){
  1755. X            strcpy(followup, (char *) getline(80, 1001, 32, followup));
  1756. X            printf("\n");
  1757. X        }
  1758. X        else printf("%s\n", followup);    
  1759. X        
  1760. X        ansi( "md" );
  1761. X        printf("Subject: ");
  1762. X        ansi( "me" );
  1763. X        strcpy(subj, (char *) getline(80, 1001, 32, subj));
  1764. X
  1765. X        ansi( "md" );
  1766. X        printf("\nKeywords: ");
  1767. X        ansi( "me" );
  1768. X        strcpy(keyw, (char *) getline(80, 1001, 32, keyw));
  1769. X            
  1770. X        ansi( "md" );
  1771. X        printf("\nSummary: ");
  1772. X        ansi( "me" );
  1773. X        strcpy(summ, (char *) getline(80, 1001, 32, summ));
  1774. X
  1775. X/*
  1776. X#ifdef _MULTIMEDIA    
  1777. X        if(USER.level >= WRITE_INTERNAT){
  1778. X            strcpy(content, (char *) "text/richtext; charset=us-ascii");
  1779. X            ansi( "md" ); 
  1780. X            printf("\nContent-Type: ");
  1781. X            ansi( "me" );
  1782. X            strcpy(content, (char *) getline(80, 1001, 32, content));
  1783. X        }
  1784. X#endif
  1785. X*/
  1786. X        ansi( "md" );
  1787. X        printf("\nX-News-Reader: ");
  1788. X        ansi( "me" );
  1789. X            printf("%s %s %s\n", VERSION, PATCHLEVEL, AUTOR);
  1790. X
  1791. X        ansi( "md" );
  1792. X        printf("References: ");
  1793. X        ansi( "me" );
  1794. X        printf("%s\n", refs);
  1795. X        
  1796. X        ansi( "md" );
  1797. X        printf("Message-ID: ");
  1798. X        ansi( "me" );
  1799. X        printf("<%x.%d@%s>\n", tdummy, USER.id, UUCPID);
  1800. X        
  1801. X        ansi( "md" );
  1802. X        printf("Expires: ");
  1803. X        ansi( "me" );
  1804. X        if(USER.level >= WRITE_INTERNAT){
  1805. X            strcpy(expires, (char *) getline(80, 1001, 32, expires));
  1806. X            printf("\n");
  1807. X        }
  1808. X        else printf("%s\n", expires);    
  1809. X
  1810. X        goto ONCE_MORE;        
  1811. X    }
  1812. X
  1813. X    ansi( "md" );
  1814. X    printf("\n\n%s\n", MIS34_MSG);
  1815. X    ansi( "me" );
  1816. X
  1817. X    sprintf(f, "%s/A%d", TMP, getpid());
  1818. X    sprintf(t, "%s/B%d", TMP, getpid());
  1819. X
  1820. X    fp = fopen(f, "r");
  1821. X    if (fp == NULL) {
  1822. X        printf("\n");
  1823. X        ansi("md");
  1824. X        printf("%s ...\n", MIS35_MSG);
  1825. X        ansi("me");
  1826. X        control(MIS36_MSG, 3);
  1827. X        unlink(rep);
  1828. X        return;
  1829. X    }
  1830. X
  1831. X    ff = fopen(t, "w");
  1832. X
  1833. X    time(&tdummy);
  1834. X
  1835. X    fprintf(ff, "From: %s\n", iam);
  1836. X    if(reply[0] != '\0')
  1837. X        fprintf(ff, "Reply-To: %s\n", reply);
  1838. X    if(sender[0] != '\0')
  1839. X        fprintf(ff, "Sender: %s\n", sender);
  1840. X    if(approved[0] != '\0')
  1841. X        fprintf(ff, "Approved: %s\n", approved);
  1842. X    if(newsgroups[0] != '\0')
  1843. X        fprintf(ff, "Newsgroups: %s\n", newsgroups);
  1844. X    if(distribution[0] != '\0')
  1845. X        fprintf(ff, "Distribution: %s\n", distribution);
  1846. X    if(ctrl[0] != '\0')
  1847. X        fprintf(ff, "Control: %s\n", ctrl);
  1848. X    if(followup[0] != '\0')
  1849. X        fprintf(ff, "Followup-To: %s\n", followup);
  1850. X    if(subj[0] != '\0')
  1851. X        fprintf(ff, "Subject: %s\n", subj);
  1852. X    if(keyw[0] != '\0')
  1853. X        fprintf(ff, "Keywords: %s\n", keyw);
  1854. X    if(summ[0] != '\0')
  1855. X        fprintf(ff, "Summary: %s\n", summ);
  1856. X    if(content[0] != '\0')
  1857. X        fprintf(ff, "Content-Type: %s\n", content);
  1858. X    fprintf(ff, "X-News-Reader: %s %s %s\n", VERSION, PATCHLEVEL, AUTOR);
  1859. X    fprintf(ff, "Message-ID: <%x.%d@%s>\n", tdummy, USER.id, UUCPID);
  1860. X    if(expires[0] != '\0')
  1861. X        fprintf(ff, "Expires: %s\n", expires);
  1862. X    if(refs[0] != '\0')
  1863. X        fprintf(ff, "References: %s\n", refs);    
  1864. X    fputs("\n", ff);    
  1865. X    
  1866. X    if (BINFILE == 0) {
  1867. X        while (fgets(s, 80, fp) != 0) {
  1868. X            fputs(s, ff);
  1869. X        }
  1870. X    }
  1871. X    else {
  1872. X        time(&tdummy);
  1873. X        fputs("BINFILE\n", ff);
  1874. X        sprintf(s, "%s/PD.%d", BRETT, tdummy);
  1875. X        fputs(s, ff);
  1876. X        sprintf(f, "cp %s %s &", tmp, s);
  1877. X        system(f);
  1878. X        sprintf(s, "\n/public/pd/%s\n", subj);
  1879. X        fputs(s, ff);
  1880. X        fl = fopen( PDSCRIPT, "a" );
  1881. X        fprintf(fl, "mv %s/PD.%d /public/pd/%s\n", BRETT, tdummy, subj);
  1882. X        fclose(fl);
  1883. X    }
  1884. X    fclose(fp);
  1885. X    unlink(f);
  1886. X
  1887. X    unlink(rep);
  1888. X
  1889. X    if ((USER.level > WRITE_IN_LEV) && (BINFILE == 0)) {
  1890. X        sprintf(s, "%s/usr/%d/.signature", HOME, USER.id);
  1891. X        fp = fopen(s, "r");
  1892. X        if (fp != NULL) {
  1893. X            while (fgets(s, 80, fp) != 0) {
  1894. X                fputs(s, ff);
  1895. X            }
  1896. X            fclose(fp);
  1897. X        }
  1898. X    }
  1899. X    fclose(ff);
  1900. X
  1901. X    sprintf(ex, "/bin/sh ./etc/inews.sh %s %s", NG, t);
  1902. X    system(ex);
  1903. X
  1904. X    unlink(t);
  1905. X
  1906. X    sprintf(s, "%s \"%s\" %s", MIS37_MSG, NG, MIS38_MSG);
  1907. X    control(s, 3);
  1908. X
  1909. X    
  1910. X    if(BINFILE != 0){
  1911. X        maybe_locked(NGROUPS, "r");
  1912. X        fp = fopen(NGROUPS, "r");
  1913. X        if (fp == NULL) {
  1914. X            nerror("misc.c", 895, "schreiben", "Datei-Lesefehler", NGROUPS);
  1915. X        }
  1916. X
  1917. X        ok = 0;
  1918. X
  1919. X            while ((ok == 0) && (fscanf(fp, "%s %d %d %s", s, &a, &b, f) > 0)) {
  1920. X            if(strcomp(NG, s) == 0){
  1921. X                i = a;
  1922. X                ok = 1;
  1923. X            }
  1924. X         }
  1925. X        fclose(fp);
  1926. X
  1927. X        fl = fopen( PDSCRIPT, "a" );
  1928. X        fprintf(fl, "mined %s/%d\n", BRETT, i); 
  1929. X        fprintf(fl, "#%s   %s\n\n", NG, USER.name);
  1930. X        fclose(fl);
  1931. X    }
  1932. X
  1933. X    printf("%s", MIS39_MSG);
  1934. X
  1935. X#ifndef _SYS7
  1936. X    sleep(30);    /* Scheinbar laeuft INEWS bei SYSV im Hintergrund */
  1937. X#endif
  1938. X
  1939. X    sprintf(s, "%s %s", MB_DAEMON, group);
  1940. X    system(s);
  1941. X    unlink(tmp);
  1942. X    printf("\n");
  1943. X  }
  1944. X  else {
  1945. X    ansi("md");
  1946. X    printf(" %s\n\n", MIS40_MSG);
  1947. X    ansi("me");
  1948. X  }
  1949. X  umask(0007);
  1950. X}
  1951. X
  1952. X
  1953. X
  1954. X
  1955. X
  1956. X/***************************************************************************/
  1957. X/*      FUNKTION  prf()                               */
  1958. X/*  BESCHREIBUNG  Stellt fest, ob eine Datei (die per UPLOAD empfangen     */
  1959. X/*          wurde) einen Text oder ein ausfuehrbares Programm ent-   */
  1960. X/*          haelt.                                                   */
  1961. X/*     PARAMETER  arg  =  Dateiname                                        */
  1962. X/*     RUECKGABE  0    =  Text-Datei                                       */
  1963. X/*          1    =  Ausfuehrbares Programm               */
  1964. X/***************************************************************************/
  1965. X
  1966. Xint prf(arg)
  1967. Xchar arg[];
  1968. X{
  1969. X  FILE *fp;
  1970. X  char ex[255];
  1971. X  int i, a;
  1972. X
  1973. X  fp = fopen(arg, "r");
  1974. X  if (fp == NULL) return -1;
  1975. X  while ((fgets(ex, 250, fp) != NULL) && (strlen(ex) < 30));
  1976. X  fclose(fp);
  1977. X
  1978. X  i = 0;
  1979. X  a = 0;
  1980. X  while (ex[i] != '\0') {
  1981. X    if ((ex[i] < 32) || (ex[i] > 127)) a++;
  1982. X    i++;
  1983. X  }
  1984. X  if (a > 3) return 1;        /* BINFILE */
  1985. X
  1986. X  return 0;            /* TEXTFILE */
  1987. X}
  1988. X
  1989. X
  1990. X
  1991. X
  1992. X/***************************************************************************/
  1993. X/*      FUNKTION  pruefe()                            */
  1994. X/*  BESCHREIBUNG  Stellt fest, ob eine Datei aus den News-Artikeln die     */
  1995. X/*          Kennung "BINFILE" enthaelt. Faellt die Antwort positiv   */
  1996. X/*          aus, wird die Routine "pd()" aufgerufen.           */
  1997. X/*     PARAMETER  arg  =  Nummer des Artikels                              */
  1998. X/*     RUECKGABE  0    =  Text-Datei                                       */
  1999. X/*                1    =  BINFILE                       */
  2000. X/***************************************************************************/
  2001. X
  2002. Xint pruefe(arg)
  2003. Xchar arg[];
  2004. X{
  2005. X  FILE *fp;
  2006. X  char ex[255];
  2007. X  char s[STRING];
  2008. X  char entry[STRING];
  2009. X  char keywds[STRING];
  2010. X
  2011. X  if ((arg[0] == '\0') || (arg[0] == '*')) return -1;
  2012. X
  2013. X  if (strcomp(BRETT, "PM") != 0) {
  2014. X    sprintf(entry, "%s/%s", BRETT, arg);
  2015. X  }
  2016. X  else {
  2017. X    sprintf(entry, "%s/usr/%d/%s", HOME, USER.id, arg);
  2018. X  }
  2019. X
  2020. X  keywds[0] = '\0';
  2021. X
  2022. X  fp = fopen(entry, "r");
  2023. X  if (fp == NULL) return -1;
  2024. X
  2025. X  while ((fgets(ex, 250, fp) != NULL) && (ex[0] > 32)){
  2026. X    if(strcomp("Keywords: ", ex) == 0){
  2027. X        ex[80] = '\0';
  2028. X        strcpy(keywds, strcopy(ex, 10, 80));
  2029. X    }
  2030. X  }
  2031. X
  2032. X  while ((fgets(ex, 250, fp) != NULL) && (ex[0] < 32));
  2033. X
  2034. X  if (strcomp("BINFILE", ex) == 0) {
  2035. X    fgets(s, 80, fp);
  2036. X    fclose(fp);
  2037. X    pd(s, keywds);
  2038. X    return 1;
  2039. X  }
  2040. X  fclose(fp);
  2041. X
  2042. X  return 0;
  2043. X}
  2044. X
  2045. X
  2046. X
  2047. X
  2048. X
  2049. X
  2050. END_OF_FILE
  2051.   if test 21563 -ne `wc -c <'src/misc.c'`; then
  2052.     echo shar: \"'src/misc.c'\" unpacked with wrong size!
  2053.   fi
  2054.   # end of 'src/misc.c'
  2055. fi
  2056. if test -f 'src/portinfo.c' -a "${1}" != "-c" ; then 
  2057.   echo shar: Will not clobber existing file \"'src/portinfo.c'\"
  2058. else
  2059.   echo shar: Extracting \"'src/portinfo.c'\" \(14668 characters\)
  2060.   sed "s/^X//" >'src/portinfo.c' <<'END_OF_FILE'
  2061. X/***************************************************************************/
  2062. X/*        PROGRAMM  ix/Mbox                           */
  2063. X/*             DATEI  portinfo.c                       */
  2064. X/*        FUNKTIONEN  port(), show_level(), userliste(), finger()       */
  2065. X/*             AUTOR  vs (Volker Schuermann/MINIX-Version)           */
  2066. X/*  LETZTE AENDERUNG  11.06.1992                       */
  2067. X/***************************************************************************/
  2068. X
  2069. X#include <sys/types.h>
  2070. X#include <sys/stat.h>
  2071. X#include <fcntl.h>
  2072. X#include <unistd.h>
  2073. X#include <stdio.h>
  2074. X#include <utmp.h>
  2075. X#include <time.h>
  2076. X
  2077. X#include <string.h>
  2078. X
  2079. X#include "mbox.h"
  2080. X
  2081. X
  2082. X
  2083. X
  2084. X/***************************************************************************/
  2085. X/*      FUNKTION  port()                           */
  2086. X/*  BESCHREIBUNG  Anzeigen was die Mbox- und die SH-User z. Zt. anstellen. */
  2087. X/*     PARAMETER  keine                                                       */
  2088. X/*     RUECKGABE  keine                                                       */
  2089. X/***************************************************************************/
  2090. X
  2091. Xvoid port(arg)
  2092. Xchar arg[];
  2093. X{
  2094. X  FILE *fp;
  2095. X  FILE *ff;
  2096. X  FILE *pp;
  2097. X  int fd;
  2098. X  char s[STRING];
  2099. X  char t[STRING];
  2100. X  char ks[STRING];
  2101. X  char ls[STRING];
  2102. X  char tmp[STRING];
  2103. X  char ex[255];
  2104. X  char terms[MAX_TERMINALS][STRING];
  2105. X  int termc = 0;
  2106. X  int a, b, k, l;
  2107. X  struct utmp US;
  2108. X  struct tm *tmt;
  2109. X  long ltime;
  2110. X  
  2111. X
  2112. X  if(arg[0] != '-'){
  2113. X    headline( POR01_MSG );
  2114. X  }
  2115. X  else printf("\n\n");
  2116. X
  2117. X  printf("%s\n", POR02_MSG);
  2118. X  printf("===============================================================================\n");
  2119. X
  2120. X  printf("%s ", POR03_MSG);
  2121. X
  2122. X  maybe_locked(WHO, "r");
  2123. X  fp = fopen(WHO, "r");
  2124. X  if (fp == NULL) {
  2125. X    nerror("portinfo.c", 56, "port", "Datei-Lesefehler", WHO);
  2126. X  }
  2127. X  while (fgets(s, 80, fp) != NULL) {
  2128. X    printf(".");
  2129. X    if(s[0] > 32){
  2130. X        strcpy(t, (char *) strcopy(s, 9, 37));
  2131. X        sprintf(terms[termc], "%s  ", t);
  2132. X        strcpy(t, (char *) strcopy(s, 37, 80));
  2133. X        strcat(terms[termc], t);
  2134. X        strcat(terms[termc], "                 ");
  2135. X        terms[termc][56] = '\0';
  2136. X        sprintf(t, "%s", (char *) strcopy(s, 37, 49));
  2137. X
  2138. X        sprintf(s, "%s/etc/%s.", HOME, (char *) stripped(t));
  2139. X        ff = fopen(s, "r");
  2140. X        if (ff == NULL) {
  2141. X            continue;
  2142. X        }
  2143. X        fgets(s, 80, ff);
  2144. X        s[23] = '\0';
  2145. X        fclose(ff);
  2146. X        strcat(terms[termc], s);
  2147. X        strcat(terms[termc], "\n");
  2148. X        termc++;
  2149. X    }
  2150. X  }
  2151. X  fclose(fp);
  2152. X
  2153. X  sprintf(tmp, "%s/%dps", TMP, getpid());
  2154. X  sprintf(s, "ps -a > %s", tmp);
  2155. X  system( s );
  2156. X
  2157. X#ifdef _SYS7
  2158. X  maybe_locked(UTMP, "r");
  2159. X  fd = open(UTMP, O_RDONLY);
  2160. X#else
  2161. X  maybe_locked(UTMP_FILE, "r");
  2162. X  fd = open(UTMP_FILE, O_RDONLY);
  2163. X#endif
  2164. X
  2165. X  if (fd == -1) {
  2166. X
  2167. X#ifdef _SYS7
  2168. X    nerror("portinfo.c", 83, "port", "Datei-Lesefehler", UTMP);
  2169. X#else
  2170. X    nerror("portinfo.c", 83, "port", "Datei-Lesefehler", UTMP_FILE);
  2171. X#endif
  2172. X
  2173. X  }
  2174. X  while (read(fd, &US, sizeof(US)) == sizeof(US)) {
  2175. X
  2176. X    printf(".");
  2177. X    t[0] = '\0';
  2178. X    strcat(t, "[$] -\n");
  2179. X
  2180. X    if (US.ut_type == USER_PROCESS) {
  2181. X        terms[termc][0] = '\0';
  2182. X        sprintf(ex, "%.8s [SH-Account]                                                  ",
  2183. X            US.ut_user);
  2184. X        ex[33] = '\0';
  2185. X        strcat(terms[termc], ex);
  2186. X
  2187. X        sprintf(ex, "%8.8s   ",
  2188. X            US.ut_line);
  2189. X        strcat(terms[termc], ex);
  2190. X
  2191. X        ltime = US.ut_time;
  2192. X        tmt = localtime(<ime);
  2193. X        sprintf(ex, "%02.2d:%02.2d   ",
  2194. X            tmt->tm_hour, tmt->tm_min);
  2195. X        strcat(terms[termc], ex);
  2196. X
  2197. X        l = atoi(strcopy(US.ut_line, 3, 6));
  2198. X
  2199. X        pp = fopen(tmp, "r");
  2200. X        if (pp == NULL) {
  2201. X            nerror("portinfo.c", 113, "port", tmp, "???");
  2202. X        }
  2203. X        while (fgets(s, 80, pp) != NULL) {
  2204. X            k = atoi((char *) strcopy(s, 8, 10));
  2205. X            if ((k == l) && (s[17] != '-')) {
  2206. X                t[0] = '\0';
  2207. X                strcat(t, "[$] ");
  2208. X                strcat(t, (char *) strcopy(s, 17, 40));
  2209. X                s[0] = '\0';
  2210. X                strcat(s, t);
  2211. X                t[0] = '\0';
  2212. X                strcat(t, (char *) stripped(s));
  2213. X                t[27] = '\0';
  2214. X                strcat(t, "\n");
  2215. X            }
  2216. X        }
  2217. X        fclose(pp);
  2218. X
  2219. X        strcat(terms[termc], t);
  2220. X        termc++;
  2221. X    }
  2222. X  }
  2223. X  close(fd);
  2224. X
  2225. X  unlink(tmp);
  2226. X
  2227. X  printf("%c", CR);
  2228. X
  2229. X  for (a = 0; a < termc; a++) {
  2230. X    for (b = 0; b < termc; b++) {
  2231. X        sprintf(ks, "%s", (char *) strcopy(terms[a], 34, 40));
  2232. X        sprintf(ls, "%s", (char *) strcopy(terms[b], 34, 40));
  2233. X        if((strcomp(ks, ls) == 0) && (a != b)){
  2234. X            if (terms[a][53] == '$') terms[a][0] = '*';
  2235. X            if (terms[b][53] == '$') terms[b][0] = '*';
  2236. X        }
  2237. X        sprintf(s, "%d", ks); k = atoi(s);
  2238. X        sprintf(s, "%d", ls); l = atoi(s);
  2239. X        if (k < l) {
  2240. X            s[0] = '\0';
  2241. X            strcat(s, terms[a]);
  2242. X            terms[a][0] = '\0';
  2243. X            strcat(terms[a], terms[b]);
  2244. X            terms[b][0] = '\0';
  2245. X            strcat(terms[b], s);
  2246. X        }
  2247. X    }
  2248. X  }
  2249. X
  2250. X
  2251. X  for (a = 0; a < termc; a++) {
  2252. X    if (terms[a][0] != '*'){
  2253. X        if(terms[a][53] != '$') ansi( "md" );
  2254. X        printf("%s", terms[a]);
  2255. X        if(terms[a][53] != '$') ansi( "me" );
  2256. X    }
  2257. X  }
  2258. X
  2259. X  printf("\n");
  2260. X}
  2261. X
  2262. X
  2263. X
  2264. X
  2265. X
  2266. X/***************************************************************************/
  2267. X/*      FUNKTION  show_level()                           */
  2268. X/*  BESCHREIBUNG  Zuweisung der Userlevel anzeigen.               */
  2269. X/*     PARAMETER  keine                                                       */
  2270. X/*     RUECKGABE  keine                                                       */
  2271. X/***************************************************************************/
  2272. X
  2273. Xvoid show_level()
  2274. X{
  2275. X  headline( POR04_MSG );
  2276. X  printf("\n");
  2277. X
  2278. X  printf("%s\n", POR05_MSG);
  2279. X  printf("-----------------------------------------\n");
  2280. X  printf("%s (%d)\n", POR06_MSG, GUEST_LEV);
  2281. X  printf("%s (%d)\n", POR07_MSG, WRITE_IN_LEV);
  2282. X  printf("%s (%d)\n", POR08_MSG, MAILOUT_LEV);
  2283. X  printf("%s (%d)\n", POR09_MSG, WRITE_EX_LEV);
  2284. X  printf("%s (%d)\n", POR10_MSG, WRITE_INTERNAT);
  2285. X  printf("%s (%d)\n", POR11_MSG, PD_D_LEV);
  2286. X  printf("%s (%d)\n", POR12_MSG, PD_U_LEV);
  2287. X  printf("%s (%d)\n", POR13_MSG, EXE_LEV);
  2288. X  printf("%s (%d)\n", POR14_MSG, ADMIN_LEV);
  2289. X
  2290. X  printf("\n%s (%d), %s !\n\n", POR15_MSG, USER.level, USER.name);
  2291. X
  2292. X}
  2293. X
  2294. X
  2295. X
  2296. X/***************************************************************************/
  2297. X/*      FUNKTION  userliste()                           */
  2298. X/*  BESCHREIBUNG  Verschieden Formen der Userliste ausgeben.           */
  2299. X/*     PARAMETER  arg  =  ''   =  nur Username und ID                      */
  2300. X/*              '*'  =  Name, letzter Anruf etc.                 */
  2301. X/*              '#'  =  Name, Up- / Downloads               */
  2302. X/*              '%'  =  Gebuehren-Stand               */
  2303. X/*     RUECKGABE  keine                                                       */
  2304. X/***************************************************************************/
  2305. X
  2306. Xvoid userliste(arg)
  2307. Xchar arg[];
  2308. X{
  2309. X  FILE *fp;
  2310. X  int fd;
  2311. X  struct userdaten LOOSER;
  2312. X  char s[STRING];
  2313. X  char u[(STRING*2)];
  2314. X  char tmp[STRING];
  2315. X  char t[STRING];
  2316. X  int i = 0, l, z;
  2317. X  int mode = 0;
  2318. X  int totalusr = 0;
  2319. X  int totalact = 0;
  2320. X  int totalgas = 0;
  2321. X
  2322. X  char c;
  2323. X
  2324. X  if (arg[0] == '*') mode = 1;
  2325. X  if ((arg[0] == '#') && (USER.level >= ADMIN_LEV)) mode = 2;
  2326. X  if ((arg[0] == '%') && (USER.level >= ADMIN_LEV)) mode = 3;
  2327. X  if ((arg[0] > 47) && (mode == 0)){
  2328. X    finger(arg);
  2329. X    return;
  2330. X  }
  2331. X  headline( POR15aMSG );
  2332. X
  2333. X  show(UDBASE, 99, 99); /* RESET */
  2334. X
  2335. X  if (mode == 1) {
  2336. X    printf("%s\n", POR16_MSG);    
  2337. X    printf("===============================================================================\n");
  2338. X    printf("%s", POR17_MSG);
  2339. X  }
  2340. X  if (mode == 2) {
  2341. X    printf("%s\n", POR18_MSG);    
  2342. X    printf("===============================================================================\n");
  2343. X    printf("%s", POR17_MSG);
  2344. X  }
  2345. X  if (mode == 3) {
  2346. X        printf("%s\n", POR18aMSG);    
  2347. X    printf("===============================================================================\n");
  2348. X    printf("%s", POR17_MSG);
  2349. X  }
  2350. X
  2351. X  sprintf(tmp, "%s/%d", TMP, getpid());
  2352. X  fp = fopen(tmp, "w");
  2353. X  if (fp == NULL) {
  2354. X    nerror("portinfo.c", 231, "userliste", "Datei-Schreibfehler", tmp);
  2355. X  }
  2356. X  maybe_locked(UDBASE, "r");
  2357. X  fd = open(UDBASE, O_RDONLY);
  2358. X  if (fd == -1) {
  2359. X    nerror("admin.c", 254, "userliste", "Datei-Lesefehler", UDBASE);
  2360. X  }
  2361. X  while (read(fd, &LOOSER, sizeof(LOOSER)) == sizeof(LOOSER)) {
  2362. X    if (mode == 0) {
  2363. X        sprintf(u, "%s", LOOSER.name);
  2364. X        sprintf(s, " (%d) ", LOOSER.id);        
  2365. X        u[26 - strlen(s)] = '\0';
  2366. X        strcat(u, s); strcat(u, "                                ");    
  2367. X         u[26] = '\0';
  2368. X        fprintf(fp, "%s", u);
  2369. X        i++;
  2370. X        if (i == 3) {
  2371. X            i = 0;
  2372. X            fprintf(fp, "\n");
  2373. X        }
  2374. X    }
  2375. X    if (mode == 1) {
  2376. X        sprintf(s, "%s", "   ");
  2377. X        if ((LOOSER.elapsed / 60) > 2) {
  2378. X            if (LOOSER.wohnort[0] < 48) {
  2379. X                if (strcomp(GUEST, LOOSER.name) != 0)
  2380. X                    sprintf(s, "%s", "<?>");
  2381. X            }
  2382. X        }
  2383. X        else {
  2384. X            sprintf(s, "%s", "{-}");
  2385. X        }
  2386. X        fprintf(fp, "%-30.30s  %10s %s%6.d   %6.ld\"  %5.d%10.10s\n",
  2387. X            LOOSER.name, LOOSER.lastlog, s, LOOSER.seq, (LOOSER.elapsed / 60), LOOSER.level, LOOSER.sh_name);
  2388. X
  2389. X    }
  2390. X    if (mode == 2) {
  2391. X        fprintf(fp, "%-30.30s  %8.d kB  %10.d kB %8.d\"\n",
  2392. X            LOOSER.name, LOOSER.upratio, LOOSER.downratio, (LOOSER.elapsed / 60));
  2393. X    }
  2394. X        if (mode == 3) {
  2395. X        if(LOOSER.level >= WRITE_INTERNAT){
  2396. X            if(LOOSER.account[0] == '\0') strcpy(LOOSER.account, "00.00.0000");
  2397. X            strcpy(s, LOOSER.account);
  2398. X            s[10] = '\0';
  2399. X            c = ' ';
  2400. X            strcpy(t, (char *) strcopy(LOOSER.account, 11, 16));
  2401. X            z = atoi(t);            
  2402. X            fprintf(fp, "%-30.30s  %5.d   %c %s   [%3d.%02d DM]\n",  
  2403. X                LOOSER.name, LOOSER.id, c, s, fix(z), flt(z));
  2404. X        }
  2405. X        }
  2406. X    totalusr++;
  2407. X    sprintf(s, "%s", (char *) mydate( 0 )); 
  2408. X    if((strcomp(s, LOOSER.lastlog) < 3) && (LOOSER.seq > 10)) totalact++;
  2409. X    if(strcomp(GUEST, LOOSER.name) == 0) totalgas = LOOSER.seq;
  2410. X  }
  2411. X  close(fd);
  2412. X
  2413. X  fclose(fp);
  2414. X
  2415. X  if (mode != 0) {
  2416. X    printf("%c", CR);
  2417. X    sprintf(s, "sort -d -o %s %s", tmp, tmp);
  2418. X    system(s);
  2419. X    show(tmp, 9999, USER.more + 100);
  2420. X    if (mode == 1) {
  2421. X        printf("\n%s\n%s", POR19_MSG, POR20_MSG);
  2422. X    }
  2423. X  }
  2424. X  else{
  2425. X    show(tmp, 9999, USER.more);
  2426. X  }
  2427. X  if(mode == 0){
  2428. X    printf("\n\n%s %d %s %d %s", POR21_MSG, totalusr, POR22_MSG, totalact, POR23_MSG); 
  2429. X    printf("\n%s %d %s", POR24_MSG, totalgas, POR25_MSG);
  2430. X  }
  2431. X  printf("\n");
  2432. X  unlink(tmp);
  2433. X}
  2434. X
  2435. X
  2436. X
  2437. X
  2438. X/***************************************************************************/
  2439. X/*      FUNKTION  finger()                           */
  2440. X/*  BESCHREIBUNG  Informationen ueber einen Teilnehmer anzeigen.       */
  2441. X/*     PARAMETER  arg  =  User-Name/User-Id des Teilnehmers                */
  2442. X/*     RUECKGABE  keine                                                       */
  2443. X/***************************************************************************/
  2444. X
  2445. Xvoid finger(arg)
  2446. Xchar arg[];
  2447. X{
  2448. X  int fd;
  2449. X  struct userdaten DUMMY, LOOSER;
  2450. X  char s[STRING];
  2451. X  char t[STRING];
  2452. X  long ll = -1L;
  2453. X  size_t dummy = sizeof(DUMMY);
  2454. X  char c;
  2455. X  char ex[LONGSTRING];
  2456. X  int i, ok, a, b;
  2457. X  int uid = -1;
  2458. X  char name[STRING];
  2459. X  char domain[STRING];      
  2460. X
  2461. X
  2462. X  FILE *fp;
  2463. X
  2464. X  
  2465. X  if ((arg[0] > 47) && (arg[0] < 58)) {
  2466. X    uid = atoi(arg);
  2467. X  }
  2468. X  else{
  2469. X    a = 0; b = 0;
  2470. X    i = 0;
  2471. X    while(arg[i] != '\0'){    
  2472. X        if(arg[i] == '!') a = i;
  2473. X        if(arg[i] == '@') b = i;
  2474. X        i++;
  2475. X    }
  2476. X    if((a != 0) && (b == 0)){
  2477. X        if(a != 0){
  2478. X            strcpy(name, (char *) strcopy(arg, (a+1), length(arg)));
  2479. X            strcpy(domain, (char *) strcopy(arg, 0, (a-1)));
  2480. X        }
  2481. X        else{
  2482. X            strcpy(name, (char *) strcopy(arg, 0, (b-1)));
  2483. X            strcpy(domain, (char *) strcopy(arg, (b+1), length(arg)));
  2484. X        }
  2485. X        strcpy(t, USER.name);
  2486. X        i = 0;
  2487. X        while(t[i] != '\0'){
  2488. X            if(t[i] == ' ') t[i] = '.';
  2489. X            i++;
  2490. X        }
  2491. X        chdir( "/" );
  2492. X        sprintf(s, "%s %s!%s!\"finger %s\" \\| mail %s@%s", UUX, SMARTHOST, domain, name, t, UUCPID);
  2493. X        /*
  2494. X        printf("\n\n%s\n\n", s);
  2495. X        */
  2496. X        system( s );
  2497. X        chdir( HOME );
  2498. X        printf("\n\n%s \"%s\",\n%s \"%s\" %s.", POR25aMSG, name, POR25bMSG, domain, POR25cMSG);
  2499. X        ansi( "md" );
  2500. X        printf("\n%s\n", POR26_MSG);
  2501. X        ansi( "me" );
  2502. X        return;
  2503. X    }
  2504. X    else{
  2505. X        if(b != 0){
  2506. X            ansi( "md" );
  2507. X            printf(" <- %s\n\n", POR26aMSG);
  2508. X            ansi( "me" );
  2509. X            return;
  2510. X        }
  2511. X    }
  2512. X  }
  2513. X
  2514. X  maybe_locked(UDBASE, "r"); mblock(UDBASE);
  2515. X  fd = open(UDBASE, O_RDONLY);
  2516. X  if (fd == -1) {
  2517. X    nerror("admin.c", 324, "aendern", "Datei-Lesefehler", UDBASE);
  2518. X  }
  2519. X  while (read(fd, &DUMMY, dummy) == dummy) {
  2520. X    if (uid == DUMMY.id) {
  2521. X        ll = lseek(fd, 0L, SEEK_CUR) - dummy;
  2522. X    } 
  2523. X    else{
  2524. X        if ((strcomp(arg, DUMMY.name) == 0) ||
  2525. X            (strcomp(arg, DUMMY.nick) == 0) ||
  2526. X            (strcomp(arg, DUMMY.sh_name) == 0)) {
  2527. X            ll = lseek(fd, 0L, SEEK_CUR) - dummy;
  2528. X        }
  2529. X    }
  2530. X  }
  2531. X  lseek(fd, ll, SEEK_SET);
  2532. X  read(fd, &LOOSER, sizeof(LOOSER));
  2533. X  close(fd);
  2534. X  mbunlock(UDBASE);
  2535. X
  2536. X  if (ll == -1L) {
  2537. X    ansi( "md" );
  2538. X    printf(" <- %s\n\n", POR27_MSG);
  2539. X    ansi( "me" );
  2540. X    return;
  2541. X  }
  2542. X
  2543. X  sprintf(s, " %s: %s ", POR28_MSG, arg);
  2544. X  headline( s );
  2545. X
  2546. X  ansi( "md" );
  2547. X  printf("\n%s ", POR29_MSG);
  2548. X  ansi( "me" );
  2549. X  printf("%d\n", LOOSER.id);
  2550. X
  2551. X  ansi( "md" );
  2552. X  printf("%s ", POR30_MSG);
  2553. X  ansi( "me");
  2554. X  printf("%s\n", LOOSER.name);
  2555. X
  2556. X  if(LOOSER.sh_name[0] != '\0'){
  2557. X    ansi( "md" );
  2558. X    printf("%s ", POR31_MSG);
  2559. X    ansi( "me" );
  2560. X    printf("%s\n", LOOSER.sh_name);
  2561. X  }
  2562. X
  2563. X  if(LOOSER.nick[0] != '\0'){
  2564. X    ansi( "md" );
  2565. X      printf("%s ", POR32_MSG);
  2566. X    ansi( "me" );
  2567. X    printf("%s\n", LOOSER.nick);
  2568. X  }
  2569. X
  2570. X  ansi( "md" );
  2571. X  printf("%s ", POR33_MSG);
  2572. X  ansi( "me" );
  2573. X  strcpy(s, LOOSER.name);
  2574. X  i = 0;
  2575. X  while(s[i] != '\0'){
  2576. X    if(s[i] == ' ') s[i] = '.';
  2577. X    i++;
  2578. X  }
  2579. X  if(LOOSER.level >= WRITE_INTERNAT)
  2580. X    printf("%s@%s\n", s, UUCPID2);
  2581. X  else
  2582. X    printf("%s@%s\n", s, UUCPID1);
  2583. X
  2584. X  printf("\n"); ok = 0;
  2585. X
  2586. X  if(USER.level >= WRITE_EX_LEV){
  2587. X    if(LOOSER.wohnort[0] != '\0'){
  2588. X        ok++;
  2589. X        ansi( "md" );
  2590. X        printf("%s ", POR34_MSG);
  2591. X        ansi( "me" );
  2592. X        printf("%s\n", LOOSER.wohnort);
  2593. X    }
  2594. X  }
  2595. X
  2596. X  if(USER.level >= ADMIN_LEV){
  2597. X    if(LOOSER.strasse[0] != '\0'){
  2598. X        ok++;
  2599. X        ansi( "md" );
  2600. X        printf("%s ", POR35_MSG);
  2601. X        ansi( "me" );
  2602. X        printf("%s\n", LOOSER.strasse);
  2603. X    }
  2604. X    if(LOOSER.telefon1[0] != '\0'){
  2605. X        ok++;
  2606. X        ansi( "md" ); 
  2607. X        printf("%s ", POR36_MSG);
  2608. X        ansi( "me" );
  2609. X        printf("%s", LOOSER.telefon1);
  2610. X
  2611. X        if(LOOSER.telefon2[0] != '\0'){
  2612. X            printf(" // %s\n", LOOSER.telefon2);
  2613. X        }
  2614. X        else{
  2615. X            printf("\n");
  2616. X        }
  2617. X    }
  2618. X
  2619. X    if(ok != 0) printf("\n"); 
  2620. X    ok = 0;
  2621. X
  2622. X    if(LOOSER.geburtsdatum[0] != '\0'){
  2623. X        ok++;
  2624. X        ansi( "md" );
  2625. X        printf("%s ", POR37_MSG);
  2626. X        ansi( "me" );
  2627. X        printf("%s\n", LOOSER.geburtsdatum);
  2628. X    }
  2629. X  }
  2630. X
  2631. X  if(ok != 0) printf("\n");
  2632. X
  2633. X  if(USER.level >= WRITE_EX_LEV){
  2634. X    ansi( "md" );
  2635. X    printf("%s ", POR38_MSG);
  2636. X    ansi( "me" );
  2637. X    printf("%d\n", LOOSER.seq);
  2638. X      ansi( "md" );
  2639. X    printf("%s ", POR39_MSG);
  2640. X    ansi( "me" );
  2641. X    printf("%s // %s\n", LOOSER.lastlog, (char *) timereconv(LOOSER.lasttime));
  2642. X  }
  2643. X
  2644. X  ansi( "md" );
  2645. X  printf("%s ", POR45_MSG);
  2646. X  ansi( "me" );
  2647. X  b = 0;
  2648. X  sprintf(s, "%s/usr/%d/INDEX", HOME, LOOSER.id);  
  2649. X    
  2650. X  fp = fopen(s, "r");
  2651. X  if (fp == NULL) {
  2652. X    nerror("intro.c", 291, "intro", "Datei-Lesefehler", s);
  2653. X  }
  2654. X  while (fgets(ex, 200, fp) != NULL){
  2655. X    if(ex[0] < 65) b++;
  2656. X  }
  2657. X  fclose(fp);
  2658. X  printf("%d\n", b-1);
  2659. X
  2660. X  if(USER.level >= ADMIN_LEV){
  2661. X    ansi( "md" );
  2662. X    printf("%s ", POR40_MSG);
  2663. X    ansi( "me" );
  2664. X    printf("%d:%02.2d", (LOOSER.elapsed/3600), (LOOSER.elapsed - (LOOSER.elapsed/3600 * 3600))/360);
  2665. X    printf(" %s\n", POR41_MSG);
  2666. X        ansi( "md" );
  2667. X        printf("%s ", POR41aMSG);
  2668. X        ansi( "me" );
  2669. X        printf("%s\n", LOOSER.account);
  2670. X    ansi( "md" );
  2671. X    printf("%s ", POR42_MSG);
  2672. X    ansi( "me" );
  2673. X    printf("%ld %s\n", LOOSER.upratio, POR43_MSG);
  2674. X    ansi( "md" );
  2675. X    printf("%s ", POR44_MSG);
  2676. X    ansi( "me" );
  2677. X    printf("%ld %s\n", LOOSER.downratio, POR43_MSG);
  2678. X  }
  2679. X
  2680. X  printf("\n");
  2681. X}
  2682. X
  2683. END_OF_FILE
  2684.   if test 14668 -ne `wc -c <'src/portinfo.c'`; then
  2685.     echo shar: \"'src/portinfo.c'\" unpacked with wrong size!
  2686.   fi
  2687.   # end of 'src/portinfo.c'
  2688. fi
  2689. echo shar: End of archive 5 \(of 11\).
  2690. cp /dev/null ark5isdone
  2691. MISSING=""
  2692. for I in 1 2 3 4 5 6 7 8 9 10 11 ; do
  2693.     if test ! -f ark${I}isdone ; then
  2694.     MISSING="${MISSING} ${I}"
  2695.     fi
  2696. done
  2697. if test "${MISSING}" = "" ; then
  2698.     echo You have unpacked all 11 archives.
  2699.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2700. else
  2701.     echo You still must unpack the following archives:
  2702.     echo "        " ${MISSING}
  2703. fi
  2704. exit 0
  2705. exit 0 # Just in case...
  2706.