Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

unix.c File Reference

#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include "cpp.h"

Include dependency graph for unix.c:

Include dependency graph

Go to the source code of this file.

Functions

int getopt (int, char *const *, const char *)
void * memmove (void *dp, const void *sp, size_t n)
void setup (int argc, char **argv)

Variables

int Cplusplus = 1
int Mflag
char * objname
char * optarg
int optind
char rcsid []
int verbose


Function Documentation

int getopt int  ,
char *const *  ,
const char * 
 

Referenced by setup().

void* memmove void *  dp,
const void *  sp,
size_t  n
 

Definition at line 96 of file unix.c.

References count, i, and n.

Referenced by adjustrow(), BotAI(), BotRemoveTildes(), BotReplaceReplySynonyms(), Cbuf_Execute(), CL_NextDownload(), CollapseMultitexture(), EasyClientName(), Field_CharEvent(), Field_KeyDownEvent(), FinishShader(), foldline(), gettokens(), Item_TextField_HandleKey(), Log_UnifyEndOfLine(), MField_CharEvent(), MField_KeyDownEvent(), movetokenrow(), newhideset(), Q2_MoveBrushesToWorld(), RemoveLinearMeshColumnsRows(), StringReplaceWords(), SubdivideMesh(), SubdivideMeshQuads(), trigraph(), UnifyWhiteSpaces(), and Winding_RemovePoint().

00097 {
00098     unsigned char *cdp, *csp;
00099 
00100     if (n<=0)
00101         return 0;
00102     cdp = dp;
00103     csp = (unsigned char *)sp;
00104     if (cdp < csp) {
00105         do {
00106             *cdp++ = *csp++;
00107         } while (--n);
00108     } else {
00109         cdp += n;
00110         csp += n;
00111         do {
00112             *--cdp = *--csp;
00113         } while (--n);
00114     }
00115     return 0;
00116 }

void setup int  argc,
char **  argv
 

Definition at line 16 of file unix.c.

References argc, argv, c, Cplusplus, creat(), doadefine(), dup2(), error(), FATAL, fp, fprintf(), getopt(), gettokens(), i, maketokenrow(), Mflag, newstring(), NINCLUDE, NULL, open(), optarg, optind, rcsid, setobjname(), setsource(), setup_kwtab(), stderr, strlen(), strrchr(), Tokenrow, tr, uchar, unsetsource(), and verbose.

Referenced by main().

00017 {
00018     int c, fd, i;
00019     char *fp, *dp;
00020     Tokenrow tr;
00021     extern void setup_kwtab(void);
00022 
00023     setup_kwtab();
00024     while ((c = getopt(argc, argv, "MNOVv+I:D:U:F:lg")) != -1)
00025         switch (c) {
00026         case 'N':
00027             for (i=0; i<NINCLUDE; i++)
00028                 if (includelist[i].always==1)
00029                     includelist[i].deleted = 1;
00030             break;
00031         case 'I':
00032             for (i=NINCLUDE-2; i>=0; i--) {
00033                 if (includelist[i].file==NULL) {
00034                     includelist[i].always = 1;
00035                     includelist[i].file = optarg;
00036                     break;
00037                 }
00038             }
00039             if (i<0)
00040                 error(FATAL, "Too many -I directives");
00041             break;
00042         case 'D':
00043         case 'U':
00044             setsource("<cmdarg>", -1, optarg);
00045             maketokenrow(3, &tr);
00046             gettokens(&tr, 1);
00047             doadefine(&tr, c);
00048             unsetsource();
00049             break;
00050         case 'M':
00051             Mflag++;
00052             break;
00053         case 'v':
00054             fprintf(stderr, "%s %s\n", argv[0], rcsid);
00055             break;
00056         case 'V':
00057             verbose++;
00058             break;
00059         case '+':
00060             Cplusplus++;
00061             break;
00062         default:
00063             break;
00064         }
00065     dp = ".";
00066     fp = "<stdin>";
00067     fd = 0;
00068     if (optind<argc) {
00069         if ((fp = strrchr(argv[optind], '/')) != NULL) {
00070             int len = fp - argv[optind];
00071             dp = (char*)newstring((uchar*)argv[optind], len+1, 0);
00072             dp[len] = '\0';
00073         }
00074         fp = (char*)newstring((uchar*)argv[optind], strlen(argv[optind]), 0);
00075         if ((fd = open(fp, 0)) <= 0)
00076             error(FATAL, "Can't open input file %s", fp);
00077     }
00078     if (optind+1<argc) {
00079         int fdo = creat(argv[optind+1], 0666);
00080         if (fdo<0)
00081             error(FATAL, "Can't open output file %s", argv[optind+1]);
00082         dup2(fdo, 1);
00083     }
00084     if(Mflag)
00085         setobjname(fp);
00086     includelist[NINCLUDE-1].always = 0;
00087     includelist[NINCLUDE-1].file = dp;
00088     setsource(fp, fd, NULL);
00089 }

Here is the call graph for this function:


Variable Documentation

int Cplusplus = 1
 

Definition at line 13 of file unix.c.

int Mflag
 

Definition at line 11 of file unix.c.

Referenced by doinclude(), and setup().

char* objname
 

Definition at line 12 of file unix.c.

Referenced by doinclude(), and setobjname().

char* optarg
 

Definition at line 7 of file getopt.c.

Referenced by getopt(), and setup().

int optind
 

Definition at line 5 of file getopt.c.

Referenced by getopt(), and setup().

char rcsid[]
 

Definition at line 8 of file cpp.c.

Referenced by asdl_progend(), emitheader(), main(), main_init(), opt(), and setup().

int verbose
 

Definition at line 10 of file unix.c.


Generated on Thu Aug 25 15:47:57 2005 for Quake III Arena by  doxygen 1.3.9.1