From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Tue, 3 Jun 2003 12:17:29 +0400 From: "Dmitry V. Levin" To: ALT Devel discussion list Message-ID: <20030603081729.GB13299@basalt.office.altlinux.org> Mail-Followup-To: ALT Devel discussion list Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="cvVnyQ+4j833TQvp" Content-Disposition: inline X-fingerprint: 9658 398D 181B 1200 8FC5 26B8 F6F8 846B C1E2 3429 Subject: [devel] I: temporary file handling: C coding guideline Sender: devel-admin@altlinux.ru Errors-To: devel-admin@altlinux.ru X-BeenThere: devel@altlinux.ru X-Mailman-Version: 2.0.9 Precedence: bulk Reply-To: devel@altlinux.ru List-Unsubscribe: , List-Id: List-Post: List-Help: List-Subscribe: , List-Archive: Archived-At: List-Archive: List-Post: --cvVnyQ+4j833TQvp Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: 8bit Greetings! Я планирую добавить "C coding guideline" в дополнение к нынешнему shell coding guideline из SPP: #define _GNU_SOURCE #include #include #include #include #include ... char *fname; int fd; FILE *fp; if (asprintf (&fname, "%s/progname.XXXXXX", getenv ("TMPDIR") ?: P_tmpdir) < 0) error (EXIT_FAILURE, errno, "asprintf"); if ((fd = mkstemp (fname)) < 0) error (EXIT_FAILURE, errno, "mkstemp: %s", fname); if (unlink (fname) < 0) error (EXIT_FAILURE, errno, "unlink: %s", fname); if ((fp = fdopen (fd, "w+")) == NULL) error (EXIT_FAILURE, errno, "fdopen: %s", fname); ... if (fclose (fp)) error (EXIT_FAILURE, errno, "fclose: %s", fname); free (fname); fname = NULL; Комментарии приветствуются. -- ldv --cvVnyQ+4j833TQvp Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQE+3FmZ9viEa8HiNCkRAr+NAJ45iALZY56Nq1GqzXD/5VSIxLnQaQCfYVdB tNY+oZOoQRGfrfGalCa4Gk4= =PH1x -----END PGP SIGNATURE----- --cvVnyQ+4j833TQvp--