util.c (8874) | util.c (18532) |
---|---|
1/* 2 * Copyright (c) 1980, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 281 unchanged lines hidden (view full) --- 290 * the stack. 291 */ 292 293static int ssp; /* Top of file stack */ 294struct sstack { 295 FILE *s_file; /* File we were in. */ 296 int s_cond; /* Saved state of conditionals */ 297 int s_loading; /* Loading .mailrc, etc. */ | 1/* 2 * Copyright (c) 1980, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 281 unchanged lines hidden (view full) --- 290 * the stack. 291 */ 292 293static int ssp; /* Top of file stack */ 294struct sstack { 295 FILE *s_file; /* File we were in. */ 296 int s_cond; /* Saved state of conditionals */ 297 int s_loading; /* Loading .mailrc, etc. */ |
298} sstack[NOFILE]; | 298}; 299#define SSTACK_SIZE 64 /* XXX was NOFILE. */ 300static struct sstack sstack[SSTACK_SIZE]; |
299 300/* 301 * Pushdown current input file and switch to a new one. 302 * Set the global flag "sourcing" so that others will realize 303 * that they are no longer reading from a tty (in all probability). 304 */ 305int 306source(arglist) 307 char **arglist; 308{ 309 FILE *fi; 310 char *cp; 311 312 if ((cp = expand(*arglist)) == NOSTR) 313 return(1); 314 if ((fi = Fopen(cp, "r")) == NULL) { 315 perror(cp); 316 return(1); 317 } | 301 302/* 303 * Pushdown current input file and switch to a new one. 304 * Set the global flag "sourcing" so that others will realize 305 * that they are no longer reading from a tty (in all probability). 306 */ 307int 308source(arglist) 309 char **arglist; 310{ 311 FILE *fi; 312 char *cp; 313 314 if ((cp = expand(*arglist)) == NOSTR) 315 return(1); 316 if ((fi = Fopen(cp, "r")) == NULL) { 317 perror(cp); 318 return(1); 319 } |
318 if (ssp >= NOFILE - 1) { | 320 if (ssp >= SSTACK_SIZE - 1) { |
319 printf("Too much \"sourcing\" going on.\n"); 320 Fclose(fi); 321 return(1); 322 } 323 sstack[ssp].s_file = input; 324 sstack[ssp].s_cond = cond; 325 sstack[ssp].s_loading = loading; 326 ssp++; --- 379 unchanged lines hidden --- | 321 printf("Too much \"sourcing\" going on.\n"); 322 Fclose(fi); 323 return(1); 324 } 325 sstack[ssp].s_file = input; 326 sstack[ssp].s_cond = cond; 327 sstack[ssp].s_loading = loading; 328 ssp++; --- 379 unchanged lines hidden --- |